sampig / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Spock and TestNG or Maven #267

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm a huge fan of Spock.  I've tried to integrate it with TestNG test suites 
via some Maven magic, and this is met with limited success.  

Is it feasible to create a TestNG runner for Spock much like the JUnit runner?  
If so, can you provide one or two hints?  I've looked at doing this but I can't 
quite wrap my brain around what is required.  If you can get me started I would 
love to get this going to make my life easier.

Original issue reported on code.google.com by thatsnot...@gmail.com on 27 Sep 2012 at 3:05

GoogleCodeExporter commented 9 years ago
I don't think it's feasible, and I don't think you'd win much. What do you hope 
to gain from this?

Original comment by pnied...@gmail.com on 27 Sep 2012 at 3:30

GoogleCodeExporter commented 9 years ago
Writing tests with TestNG and Mockito/Hamcrest is just not as elegant as Spock. 
 I really enjoy how Spock structures tests and how easy it is to assert 
conditions or mock objects.

Original comment by thatsnot...@gmail.com on 27 Sep 2012 at 3:37

GoogleCodeExporter commented 9 years ago
Sure. The question is, why do you want to execute Spock tests via TestNG? What 
do you hope to gain from this?

Original comment by pnied...@gmail.com on 27 Sep 2012 at 3:44

GoogleCodeExporter commented 9 years ago
I have had terrible luck integrating Spock tests with TestNG in things like 
Cobertura, Findbugs when they both have to run in the same Maven task.  Two 
different runs has caused me problems of missing cobertura results or 
inconsistent test behavior.  If Spock ran under TestNG this would all run as a 
single execution and I don't think I would see the inconsistent problems.

Original comment by thatsnot...@gmail.com on 27 Sep 2012 at 3:48

GoogleCodeExporter commented 9 years ago
I don't think that implementing a TestNG runner for Spock is a viable solution 
to these problems. Last time I checked (a few years back), it didn't even seem 
to be possible, because TestNG wasn't extensible in the way JUnit is. My 
conversations with Cedric Beust on the TestNG mailing list confirmed this 
impression.

Original comment by pnied...@gmail.com on 27 Sep 2012 at 3:55

GoogleCodeExporter commented 9 years ago
So I guess I will look at implementing a TestNG runner in JUnit.

Every time I try to bring some kind of new greatness to a team it fails with 
issues like this.  Scala and Groovy in Eclipse?  Nope.  *sigh*  We have the 
technology!

Original comment by thatsnot...@gmail.com on 27 Sep 2012 at 4:13

GoogleCodeExporter commented 9 years ago
Peter just so you know, I've been at a few shops that use TestNG.  I show then 
Spock and they go "wow that's awesome" but none of them can spend the time to 
move all the tests to Spock, so it's always an awkward mashup in our pom that 
never works quite right.  It's very frustrating.

Original comment by thatsnot...@gmail.com on 28 Sep 2012 at 2:56

GoogleCodeExporter commented 9 years ago
I understand, but I don't think Spock can realistically do anything about it. 
We are already investing a lot in the best possible JUnit, Groovy, Maven, 
Eclipse, and IDEA support, and I wouldn't even know how to achieve 
"compatibility" with TestNG. I think that the problems you mentioned are best 
solved on the build tool level. For example, Cobertura coverage files can be 
merged (there is both an API and an Ant task for that). I don't see how running 
Spock and TestNG side by side could cause any problems with FindBugs.

By the way, it would have been better to lead this conversation at 
http://forum.spockframework.org

Original comment by pnied...@gmail.com on 28 Sep 2012 at 3:13

GoogleCodeExporter commented 9 years ago

Original comment by pnied...@gmail.com on 4 Oct 2012 at 6:52