Java 용 BDD 프레임 워크의 차이점은 무엇입니까? [닫은]
Java 용 BDD ( Behavior Driven Development ) 프레임 워크 의 장단점은 무엇입니까 ?
예를 들어 여기 에서 일부를 발견했습니다 .
이미 모의 라이브러리 (예 : Mockito )를 사용하는 경우 BDD 프레임 워크를 사용하는 것이 합리적 입니까?
Java에 대한 세 가지 BDD 프레임 워크 비교를 마쳤습니다. 분명히 내 결과는 사용 기간이 상당히 짧습니다.
- 매우 유연
- 매우 예쁜 보고서 출력
- 멋진 플러그인 프레임 워크
- 잘못 문서화되었습니다. 나는 그것을 알아 내기 위해 소스를 읽어야했습니다 (행운 적으로 매우 좋은 품질).
- 비품은 html과 밀접하게 연결되는 것으로 보입니다.
- 매우 얕은 학습 곡선 (Groovy가 아닌 개발자에게도 해당)
- 매우 강력한 DBUnit 통합
- 분명히 매개 변수를 지원하지 않습니다 (매우 모호한 이야기 또는 텍스트와 코드 사이의 복제로 이어집니다 (편집 : 실제로는 있지만 문서는 잘 숨겨져 있습니다).
- 스토리와 코드가 매우 밀접하게 결합되어 있습니다 (동일한 파일).
- 매우 기본적인 보고서 출력
- IntelliJ 플러그인이 작동하지 않습니다
- 비활성 커뮤니티 (Maven 플러그인이 3 개월 동안 중단 된 것 같습니다. 코드 예제가 많지 않음)
- 매우 강력하고 유연합니다 (예 : 스토리를 사전 요구 사항으로 구성하여 보일러 플레이트 감소)
- 광범위한 (조각화 된 경우) 문서 및 예제
- 다양한 프레임 워크 및 환경에 대한 광범위한 (압도적 인 경우) 지원
- 스토리 파일과 코드의 탁월한 분리
- 꽤 활발한 커뮤니티와 웹에서 더 많은 예제와 토론을하는 것으로 보입니다.
- 상당히 가파른 학습 곡선 (Concordion / EasyB보다 알아 내기 위해 3-4 배 더 길었습니다)
나는 내가 원했던 것처럼 JDave의 Cuke4Duke를 시험해 볼 기회가 없었지만 아마도 이번에는 JBehave를 밀어 붙일 것입니다.
"장단점"은 사람들마다 다를 수 있습니다. 나는 보통 한 번 봐
- 개발 활동 , 예를 들어 새로운 릴리스 일 가능성이 있거나 2 년 된 마지막 릴리스 일 수 있습니다.
- 성숙도 , 예를 들어 얼마나 오래 있 었는가, 튜토리얼과 책이있을 수 있습니다. (저는이 책들을 읽지 않고 단지 채택의 표시 일뿐입니다.)
- 도구 지원 (예 : Eclipse 플러그인, Ant 지원 등)
- 의존성의 크기 , 나는 그들 자신의 모든 것과 함께 제공되는 프레임 워크를 좋아하지 않습니다. 예를 들어, 조롱 프레임 워크를 직접 선택하고 싶습니다.
- 라이센스의 종류 , 이것은 내가 일하는 회사의 법적 조건 때문에 나에게 중요합니다.
- 관련 도구와의 호환성 ( 예 : Gherkin 언어 사용 여부)
그리고 일부 프레임 워크에서 살펴 보았습니다.
- 본능 나쁜 : 마지막 활동 2010 년 3 월, 좋은 : ASF 라이센스
- JDave bad : matcher와 mocks가 함께 제공됩니다. good : 마지막 활동 2011 년 1 월, ASF 라이센스
- easyb bad : 마지막 활동 2010 년 10 월, 확실하지 않음 : Groovy를 사용합니다. 이것은 괜찮을 수도 있지만 제 경우에는 채택에 문제가 될 것입니다.
- beanspec bad: only one version in 2007, this is dead
- bdoc bad: last activity Jan 2010, not sure: it looks like going the other way, creating a report from the code.
- spock bad: maybe a bit extreme, this is a complete testing framework, not only BDD, good: very active, very cool.
- jbehave, the "mother" of all BDD in Java, bad: very powerful = complex, incompatible license (for me), comes with almost every test library and much more, good: based on RSpec and therefore compatible, eclipse plugins, maven integration, very active community
- ginkgo4j, a BDD framework for Java also based on Ruby's RSpec but using Java lambda's (instead of annotations) to allow you to create highly contextual, highly readable tests. Simple. Very powerful. Open source Apache 2 license.
Concerning the mocks: You definitely need a mocking framework as well. The BDD frameworks just help you in writing the specs, but some tests will need mocks or stubs, esp. when you design top down (from overview to detail).
What's the best BDD framework to use with Java? Why? What are the pros and cons of each framework?
Here is an interesting link about Concordion vs. Cucumber and Java based Acceptance Testing
I've found couple of them here, but I'm not sure which one to choose.
Really, look at the one mentioned above.
Does it make sense to use a BDD framework if I already use a mocking library (e.g. Mockito)?
Short answer: yes, definitely. Actually, acceptance testing using a BDD framework and unit testing in isolation using mock objects are so different that I don't really get the question. Acceptance testing is black box testing, tests are used to verify that a business feature is working and are ideally written by business analyst. Unit tests in isolation using mocks is white box testing, tests are used to verify that a unit is working and are written by developers. Both are useful buty they have totally different purposes. In other words, using Mockito doesn't replace a BDD framework at all and the inverse is also true.
I originally did my BDD with plain jUnit but I've been looking at JDave lately because it's almost 1:1 to what I was doing with jUnit. It also runs on top of jUnit so it already works on Eclipse and is also easy to configure to work on continuous integration systems such as Hudson. Can't really compare it with others but my experiences with JDave have been good so far.
Oh and it's never a stupid idea to use mocks! They're not tied to TDD/BDD specifically, their purpose is to ease the burden of testing in general.
Wow, I see the topic is hot, lot of good answers...
Irony aside, I recently discovered BDD and found the concept interesting. Hey, it forces to write both tests... and specifications! As surprising as it might seem, the latter can be also missing in some projects... Or just lacking the precision that BDD forces to introduce.
The Behavior Driven Development article summarizes the concept and links to some good articles (like the one written by Andrew Glover). Moreover, to the topic of this thread, it gives a rather comprehensive (I suppose) listing of BDD frameworks, a good number of them being for Java.
It doesn't solve the problem of choosing the framework but at least it will ease the search...
Since BDD relies heavily on readability of test code, I suppose a good criterion of choice is to look at the quick tours/tutorial and see which one seems the more fitting your style. Other criteria could be the fact a framework leverage tools you are familiar with (unit test, mocking), usage with IDE, and so on.
I tried Cucumber-JVM (previously developed as Cuke4Duke). It uses Gherkin DSL for specification, stored as plain text.
It can be run as a JUnit test. So the only problem to start using it is to make business people or Product Manager read/write .features in Sources.
Results
My team have been using JBehave for some time. It uses plain text files to store specifications. Every step (Given, When, Then) is then executed by a certain method which can extract parameters from the step. Scenarios can be indented and well formatted which helps a lot if clients want to verify them.
There are some problems, too. We have switched to Java 6. Sometimes some scenario steps are ignored during execution. It may cause a lot of trouble figuring out where's the bug.
My team have used JBehave with success - we moved to it after using EasyB and found the plain text scenario files easier to deal with.
참고URL : https://stackoverflow.com/questions/1068785/what-are-the-differences-between-bdd-frameworks-for-java
'programing tip' 카테고리의 다른 글
Visual Studio 2010없이 MSBuild 4.0 설치 (0) | 2020.07.14 |
---|---|
JAR 파일 외부의 특성 파일 읽기 (0) | 2020.07.14 |
Express에서 HTML을 뷰 엔진으로 사용하려면 어떻게합니까? (0) | 2020.07.14 |
JUnit 대 TestNG (0) | 2020.07.14 |
Mockito와 JMockit의 비교-Mockito가 JMockit보다 더 나은 투표를하는 이유는 무엇입니까? (0) | 2020.07.14 |