I'm trying to set up a parallel test run for my project. So, here is a screenshot, where you can see JUnit 5 settings
According to junit.jupiter.execution.parallel.config.strategy and junit.jupiter.execution.parallel.config.fixed.parallelism settings, I was expecting that there are would be just 2 threads for the run. But as you can see in console output there are 4 different threads.
What do I need to make JUnit run a bunch of tests just with 2 threads ?
Related
I have a project with several hundred test files some of the test files use DataJpaTest annotation, some are MockMvc based controller tests and some uses mocked objects without database dependency, Based on test execution order I see context needs to be re-initialized for different flavors of test files, Is there a way to control execution of test files order so that context reload can be avoided? Say all mock tests first followed by controller tests and then DataJpaTest?
Right now test case execution taking about 30 minutes looking for way to improve the speed up test execution.
JUnit Jupiter provides options to control Test Execution Order.
However, you should look into your test setup and verify if your tests create too many Application Contexts.
Spring Test framework can cache Application Contexts and reuse them among different test suites. See Spring Test documentation for more info.
I'm writing unit tests using Selenium and xunit and on their own they run great but if I select all of the tests (multiple classes) in Test Explorer (they appear to be grouped by class - this is not intentional) they run in parallel. Run Tests in Parallel is not selected. Each one of my tests creates and then deletes test data so they obviously can't run in parallel. One test might delete data right after another test created that data and so the test would fail. So how can I run all of my tests and not have them run in parallel? I guess I could make them all use one partial class that spans multiple files but that's not my first choice.
I found a solution (although not an explanation). Just put [Collection("Sequential")] as the first line under each namespace. This forces everything to run sequentially.
In Junit 5, we can achieve parallel execution by specifying in junit-platform.properties file.
Also we can run the same testsuite multiple times by using #TestTemplate but this is sequential run.
Is there a way to combine both approaches.
I want to execute the same testsuite on multiple browsers parallelly.
When the testsuite execution start, the first test should be picked and run on all the available browsers. and so on.
I am using selenium Junit combination to write the UI testcases.
I’m trying to run a custom test suite which includes several test cases. For example, I’ve wrote 4 test scripts(test_login_success,test_login_fail,test_register_xxx,test_register_yyy), and I just want to run test_login_* module, how to set the defaultTestSuite and add testcases to it?
The test cases you create belongs to its class. If you want to customise test runs you shall consider updating to the new Xcode 11. The new version of Xcode has test plans feature allowing you to control tests executions better.
Introduction video:
https://developer.apple.com/videos/play/wwdc2019/413/
If you prefer to stay on previous Xcode, you should add schemes for your scenarios.
Also, you can pass tests names in xcodebuild shell command.
In my current project, we have already developed test scripts with junit framework. We have used all sort of locators methods which includes xpath as well.Now we have to do parallel execution on IE8,IE9 and FF21.We implemented grid2 with junit but we see that majority of the scripts are failing due to time out.
What I would like to know is if we have to execute 100 test cases on 5 nodes:
1.what is minimum hardware configuration required in terms of RAM,and JVM configuration
2.What is ideal hub/node configuration
3.What desired capabilities have to be set?
4.what is the best approach to set wait methods for elements and messages?
Has anyone successfully implemented selenium grid2 and ran more than 100 test cases in parallel?
Here goes my question, Have you ever executed those 100 test cases in sequence with out any such timeout issues? If yes, then you can do it in grid as well.For this, you may need minimum of 4 GB RAM and better clocked CUP. JVM version can be the same in which your scripts are done.
In general, you may need to handle some run time behavior of your application.