Posts

Showing posts from July, 2014

Running Spec2 Unit test case from eclipse

In this article I’ll give some quick hints about how you can run your Scala unit test cases written using Spec2 from eclipse. Writing unit test cases is fun and important aspect of any application where quality is important and large groups/teams are working on different parts of application. You may want to run unit test cases directly from editor where you are writing test cases. Almost every other editor support execution of Java Junit test cases from eclipse. When you are working with Scala code based you may want to write unit test cases using Spec2 and want to run directly from eclipse. As such you cannot do with making additional changes to test cases; here are the changes that you’ll have to add to your test cases so that you can run them from eclipse: 1)    Add below import statements to you Unit test class import org.junit.runner.RunWith import org.specs2.runner.{JUnitRunner} 2)    Annotate your test class with following annotation: @RunWith(classOf[JUnitRunner])