I have a test case that provides arguments and executes the main method of a class. What would be the best approach using Junit to have multiple threads concurrenlty execute the main method of class.
Not sure if TestNG is an option for you, but it's pretty straightforward with it:
@Test(invocationCount = 100, threadPoolSize = 10)
public void myTest() { ... }
This will cause the test method to be invoked 100 times from 10 different threads. If this test passes and you run it a lot, you can be fairly confident that the code under test is multithread safe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With