9

I have some code in my project I personally call tests that are not unit tests. They are meant to be run and the result has to be evaluated by a human. I did this because I'm making a physics engine and during development, I needed to see what I'm doing. So I made a simulation package in my test module. It is technically unit tests because the simulations are using the unit test library but I do not mean to run them all like my actual unit tests.

What I would like to do is differentiate those special tests from my unit tests because I want to run all unit tests easily. I think it is a bit like functional tests. Did you ever encounter a case where you had to prepare your application for a functional tests ? Where does that functional test preparation (basically what my simulations are) should be placed in the project and how to distinguish them from unit tests ?

I'm in Java so I could change all my methods signatures from @Test public void myNamedTest() to public static void main(String[] args) but it would be laborious and less practical for me to use my simulations.

I'm using junit in a gradle project. Any solution creating a special test folder with gradle is welcome.

Winter
  • 705

1 Answers1

10

It looks like later versions of Junit support categories of tests. These can be useful to classify each test. Then when the build automation runs, it can include or exclude those tests based on category.

Whether you want to mix in these tests to the unit tests is a matter of organization preference. One may want to create a separate "test rig" project to separate the regular unit tests versus the more specialized ones.

https://dzone.com/articles/closer-look-junit-categories

Jon Raynor
  • 11,773