Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JUnit : org.junit.experimental.Theories

Tags:

java

junit4

I have implemented JUnit in my project. I found couple of good features using org.junit.experimental.theories.Theories.

One of the advantage is I could very well separate the data and test case.

JUnit version 4.12

Now the question is these classes are part of 'experimental' package. Does it mean in future releases this feature may not be available? [This question may not be the right kind of question for SO, however it is a decision point for the solution]

Thank you.

like image 739
Rakesh Avatar asked Jun 16 '16 08:06

Rakesh


People also ask

What is a Junit theory?

The Theories runner allows to test a certain functionality against a subset of an infinite set of data points. A Theory is a piece of functionality (a method) that is executed against several data inputs called data points.

What does @after do in Junit?

org.junit If you allocate external resources in a Before method you need to release them after the test runs. Annotating a public void method with @After causes that method to be run after the Test method. All @After methods are guaranteed to run even if a Before or Test method throws an exception.

Which annotations are used for creating test categories?

Class Categories. From a given set of test classes, runs only the classes and methods that are annotated with either the category given with the @IncludeCategory annotation, or a subtype of that category. Note that, for now, annotating suites with @Category has no effect.


1 Answers

For me it's a good question. As the FAQ and the Wiki of JUnit do not explicitely mention the experimental package. For Theories they are part at least since five years (maybe longer). So I would not expect that this feature would disappear. What might happen is that the API for those package changes.

edit At least in the JUnit 5 user guide there is a similar annotation mentioned (@API(Experimental)).

Experimental Intended for new, experimental features where we are looking for feedback. Use this element with caution; it might be promoted to Maintained or Stable in the future, but might also be removed without prior notice, even in a patch.

like image 187
SubOptimal Avatar answered Oct 05 '22 10:10

SubOptimal