Is it possible to ask junit to run a prescript before doing tests ?
I don't wan't to run @Before
as it will only initialize one test.
Neither setUp
as I think it does the same thing.
There is ClassRule but it require to maintain a list of the Test.
A nice thing would be to have an entry test file so I could run my java code from here.
Example of usage :
- "the whole test require a database to be started."
- "a migration script need to be run"
I know people would tell me to run this in gradle before or another build tool.
I am using flyway for the database migration and the version number is stored in my spring boot yaml file. I choose to configure flyway using java instead of gradle because gradle needs to use the command line to do migration so it can't be run with jenkins.
Also, I don't know how I could read the value of my yaml in gradle, neither to run a script.