Thomas Sundberg

October 31, 2011

Why separate test definitions from a driving JUnit class?

This post is available at http://www.thinkcode.se/blog/2011/10/31/why-separate-test-definitions-from-a-driving-junit-class

3 Comments »

  1. Thanks for the writeup Thomas. Some things are a little unclear:

    * “One particular step can be used in more than one feature” – you mean step definition I suppose (steps are in gherkin)
    * The recent change not allowing methods in JUnit classes doesn’t have anything to do with performance.
    * You say “methods are instantiated twice”. Did you mean “classes are instantiated twice”?
    * Not sure what you mean by “JUnit runner creates all its methods”? You mean JUnit instantiates classes?

    The main reason for this change is to prevent step definitions to be coupled to a particular feature (so they can be reused in other features).

    Keep up the good work!

    Comment by Aslak Helles√ły — November 1, 2011 @ 01:26

  2. How do you parameterize Junit with cucumber please?

    Comment by Karthik — November 27, 2013 @ 08:14

    • The short answer is, you don’t. The long answer is that it might get very complicated if you have parameters that are mandatory for some test and not relevant for others. I can think of at least one case where it is possible that it would be nice to have a the functionality similar to a parametrized class. I will write up an example that might give you a one hint one way of getting the functionality similar to a parametrized JUnit class. Stay tuned for he upcoming days.

      /Thomas

      Comment by Thomas Sundberg — November 27, 2013 @ 23:08


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: