Reputation: 2558
I have an Ant task that runs a batch of test cases that I have written, which runs perfectly fine... except Ant seems to be ignoring the fork="true"
attribute in the <junit>
and <batchtest>
elements.
Here is my Ant task:
<target name="run_tests" depends="init">
<java jar="${dir.testLib}${seleniumJar}" fork="true" spawn="true"/>
<junit fork="yes" haltonfailure="no" printsummary="no">
<classpath refid="test.classpath"/>
<batchtest todir="${test.reports}/acceptance/gui" fork="true">
<fileset dir="${dir.classes}">
<include name="**/*TestCase.class" />
<include name="**/*Test.class" />
<include name="**/Test*.class" />
<exclude name="**/AbstractSeleneseTestCase.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="test.classpath" />
</junit>
<junitreport todir="${test.reports}/acceptance/gui">
<fileset dir="${test.reports}/acceptance/gui">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.reports}/acceptance/gui" />
</junitreport>
</target>
It's taking 8+ minutes to run my test cases one-at-a-time, which is entirely way too long. I have noticed other flukes using Selenium, is this just another nuance of using the project?
Here is a synopsis of what is happening:
1. Run Ant task
2. Ant task spawns a thread to run Selenium server
3. Test cases (Selenium and jUnit) are running one-at-a-time
4. A dark cloud lingers over my cube as my keyboard is struck by lightning ;-(
Here is a synopsis of what I want to happen:
1. Run Ant task
2. Ant task spawns a thread to run Selenium server
3. Tests cases (Selenium and jUnit) launch concurrently
4. Bonuses all around and high fives and pat's on the back for everyone!
Upvotes: 2
Views: 1826
Reputation: 2558
One solution that I have seen, and done well mind you, is creating a SeleniumFactory. This would be your own class that spawns a new thread every time you need another web browser test. It takes a little work, but well worth the effort.
Upvotes: 0
Reputation: 2155
It would seem to me that you are not running a Selenium Grid, that allows you to run tests in Parallel (as many concurrent "threads" as you have Remote Controls registered in the Grid).
Here's more info: http://selenium-grid.seleniumhq.org/
Upvotes: 3