Newbie - combination of junit tests and spock tests with netbeans ide

596 views
Skip to first unread message

Mary

unread,
May 11, 2012, 4:17:07 PM5/11/12
to Spock Framework - User
I would like to start using spock for new unit tests, but we already
have junit tests in a test folder.

Our problem is that all of the developers use Netbeans as our IDE.
Netbeans does not support Spock tests but does support regular junit
tests. Because of this, I would like to separate the spock tests from
the regular junit tests.

Our folder structure is pretty standard:
src
lib
test

I was going to add:
stest - spock unit tests

Then run my spock tests as a separate ant task with either command
line or with jenkins.

Does this sound like a good plan or is there another way to solve the
netbeans problem?

Thanks,

Mary

Peter Niederwieser

unread,
May 11, 2012, 4:29:04 PM5/11/12
to spockfr...@googlegroups.com
Last time I looked into Spock + NetBeans, the problem was that NetBeans couldn't run any JUnit tests written in Groovy (see https://www.netbeans.org/bugzilla/show_bug.cgi?id=159256). If and once this gets fixed, Spock should work too.

Spock certainly works fine with Ant and Jenkins. I might call the folder "spec", as in "specification".

Cheers,
Peter

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.


Nick Vaidyanathan

unread,
May 12, 2012, 1:48:39 AM5/12/12
to spockfr...@googlegroups.com
Interestingly, I've used NetBeans and Grails and been successfully able to run tests using the spock plugin. So if you're working in that environment (with the Spock plugin), it shouldn't be a problem. 

Otherwise, this may be a good opportunity for 1/2 of the team to look at Ant/Gradle and become versed in DevOps. Situations like this occur often when working in a constrained IDE environment. While it's useful to be able to leverage the IDE to save time, your team should __incrementally__ learn what the IDE is actually automating for you, and learn incrementally how to make modifications to things like the build.xml. 

You should be able to drop to command line, change to your spec directory, and follow the instructions on http://code.google.com/p/spock/wiki/GettingStarted if NetBeans is failing.

Also, spec/ is the preferred name for a reason. You can think of Behavior Driven Development (read the link)  as the next evolution of TDD. TDD says you should write tests. BDD says how you should write them. It provides a set of conventions and best practices for thinking in the One Assert Per Test and smallest possible input, smallest possible stimulus, smallest possible check way.

Thinking in Given/When/Then becomes a powerful way of thinking about the way your software works and should work. This makes them more than just Tests. They're Specifications(Executable Requirements Documentation). Once that clicks, it should change the way you build software and interface with customers.
To post to this group, send email to spockframework@googlegroups.com.
To unsubscribe from this group, send email to spockframework+unsubscribe@googlegroups.com.

MJ Beebe

unread,
May 12, 2012, 5:43:59 AM5/12/12
to spockfr...@googlegroups.com
Thank you for these responses. 

I was introduced to Spock at a NoFluffJustStuff conference.  I learned many new processes at that conference, but Spock was the first new thing I wanted to introduce to our development team.  

I was on a team that was trying to practice the Agile Scrum process but was failing in many aspects.  I just switched to a smaller team which is practicing Agile Scrum.  I found this article on DevOps: http://www.jedi.be/blog/2010/02/12/what-is-this-devops-thing-anyway/.  I believe our small team is practicing this process but mostly because we are so small.  I will mention DevOps to the team and see what they say.

We do have a separate build.xml from the netbeans build.  We run it either at command prompt or through Jenkins.  I have been modifying this week to run our unit tests and to add Cobertura code coverage package.  This weekend I hope to add Spock to it.  I have looked at http://code.google.com/p/spock/wiki/GettingStarted.  I got the HelloSpock project to work without any issues.  Now I hope it will be easy to add spock to our regular package. 

The issue I am concerned about is that the HelloSpock project does not separate source from the unit tests,  which is why I started by creating targets to run our regular junit tests first to make sure I have an understanding of that first. 

Thanks,

Mary

To view this discussion on the web visit https://groups.google.com/d/msg/spockframework/-/FApZjpuAmioJ.

To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.

Peter Niederwieser

unread,
May 12, 2012, 5:50:04 AM5/12/12
to spockfr...@googlegroups.com
There is also https://github.com/spockframework/spock-example (you can just download a zip). It already comes with an Ant build. It has no separate production sources, but that should be easy to add. There is nothing specific to Spock that would have to change.

Cheers,
Peter
Reply all
Reply to author
Forward
0 new messages