mvn clean install
You won't notice any difference. However if you now specify some threads by performing this:
mvn clean install -Dthreads=2
You will see that this time two Firefox browsers open, both tests run in parallel, and then both browsers are closed again.
Are you seeing only one browser start up? In the maven-failsafe- plugin con guration, we have speci ed all les that end with WD.java. If you use lenames that start or end with Test, they will be picked up by the maven-surefire plugin and the threading con guration will
be ignored. Double-check to make sure that your failsafe con guration
As you may have noticed, with two very small tests such as the ones we are using in our example, you will not see a massive decrease in the time taken to run the complete suite. This is because most of the time is spent compiling the code and loading up browsers. However, as you add more tests, the decrease in the time taken to run the tests becomes more and more apparent.
This is probably a good time to tweak your BasicTest.java le
and start adding some more tests that look for different search terms. Play about with the number of threads and see how many concurrent browsers you can get up-and-running at the same time. Make sure that you note down execution times to see what speed gains you are actually getting (they will also be useful later on in this chapter). There will come a point where you reach the limits of your computer's hardware and adding more threads will actually slow things down rather than making them faster. Tuning your tests to your hardware environment is an important part of running your tests in multiple threads.
So how can we speed things up even more? Well, starting up a web browser is a computationally intensive task, so we could choose not to close the browser after every test. This obviously has some side effects. You may not be at the usual entry page of your application, and you may have some session information that is not wanted.