We are looking at implementing a test framework and curious as to which framework to use. We are choosing between TestNG and Spock. This is going to be a UI Automation framework so it should handle as little mock data as possible. Our codebase will be comprised of Geb (Groovy).
That being said, there are 3 advantages that Spock holds over TestNG:
Detailed information Spock's runtime collects a wealth of information, and presents it to you when needed. Condition not satisfied:
max(a, b) == c
| | | | |
3 1 3 | 2
false
Beautiful language Express your thoughts in a beautiful and highly expressive specification language.
def "subscribers receive published events at least once"() {
when: publisher.send(event)
then: (1.._) * subscriber.receive(event)
where: event << ["started", "paused", "stopped"]
}
Extensible for everyone @Transaction? @SpringBean? @DeployApp? With Spock's interception-based extension mechanism, you can easily create your own extensions.
Does anyone have any input on why one may be better than the other?
Are there downfalls to either?
Is there a way to create the "beautiful language" in reports for TestNG? Essentially can I create my own tags and have a program that parses for them? Or is there already a third party library to add?
For UI automation, take a look at Geb before trying to build a new framework. http://www.gebish.org
Geb will work with both spock and TestNG.
In general, I've had really good experience with spock, but can't speak to TestNG.
I do wish spock had BDD style reports like Cucumber, and property style testing like ScalaCheck, but as far as straightforward TDD style testing, spock is expressive, easy to use, feature rich, and really well designed. Compared to things like JUnit, spock is a joy - very little ceremony needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With