Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spock and TestNG or Maven #389

Closed
robfletcher opened this issue Aug 30, 2015 · 9 comments
Closed

Spock and TestNG or Maven #389

robfletcher opened this issue Aug 30, 2015 · 9 comments

Comments

@robfletcher
Copy link
Contributor

Originally reported on Google Code with ID 267

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.

Reported by thatsnotright on 2012-09-27 03:05:11

@robfletcher
Copy link
Contributor Author

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

Reported by pniederw on 2012-09-27 03:30:13

@robfletcher
Copy link
Contributor Author

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.

Reported by thatsnotright on 2012-09-27 03:37:01

@robfletcher
Copy link
Contributor Author

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

Reported by pniederw on 2012-09-27 03:44:00

@robfletcher
Copy link
Contributor Author

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.

Reported by thatsnotright on 2012-09-27 03:48:07

@robfletcher
Copy link
Contributor Author

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.

Reported by pniederw on 2012-09-27 03:55:25

@robfletcher
Copy link
Contributor Author

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!

Reported by thatsnotright on 2012-09-27 04:13:41

@robfletcher
Copy link
Contributor Author

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.

Reported by thatsnotright on 2012-09-28 02:56:18

@robfletcher
Copy link
Contributor Author

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

Reported by pniederw on 2012-09-28 03:13:38

@robfletcher
Copy link
Contributor Author

Reported by pniederw on 2012-10-04 06:52:20

  • Status changed: WontFix
  • Labels added: Milestone-0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant