I am using JUnit to run tests and I'd like to do so programmatically using JUnitCore. The thing is, I need several instances of JUnitCore to run the exact same test class at the same time (I also want to inject specific properties into each thread). As a result, I was wondering if JUnitCore will instantiate the class it is running before running it. I have non-static variables, so I know that if I were to be able to instantiate it each time, these variables would be thread-safe.
I've already encountered the below solution:
Computer computer = new Computer();
JUnitCore jUnitCore = new JUnitCore();
jUnitCore.run(computer, MySuite.class);
But I want to know if the last line will instantiate MySuite.class.
I also wish to use the Serenity Junit runner, so I can't use any special JUnit runner to achieve this thread-safety.
Aucun commentaire:
Enregistrer un commentaire