2012-11-23 34 views
0

我嘗試使用網格在paralel TestSuites中運行。這是我的pom.xml的一部分。 如何在線程啓動之間強制延遲2秒?這裏最多隻有4個線程,只有3個套件可以運行,所以它們都是同時啓動的。如何在使用網格時強制延遲啓動每個線程?

java -jar selenium-server-standalone-2.25.0.jar -role webdriver -hub 
http://localhost:4444/grid/register -port 5556 -browser 
browserName=chrome,version=23,platform=WINDOWS,maxInstances=4 

它使2 3的實例中的應用程序衝突到一些已知的原因是由於: 起始節點與後。在螺紋加工時間中至少需要2秒的差異。 怎麼辦?

<plugins> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.1</version> 
     <configuration> 
      <source>1.6</source> 
      <target>1.6</target> 
     </configuration> 
    </plugin> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.12</version> 
     <configuration> 
      <skipTests>true</skipTests> 
     </configuration> 
    </plugin> 
    <plugin>    
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-failsafe-plugin</artifactId> 
     <version>2.12.4</version> 
     <executions>   
      <execution> 
       <id>integration-test-chrome</id> 
       <phase>integration-test</phase> 
       <goals> 
        <goal>integration-test</goal> 
       </goals>  
      </execution>   
     </executions> 
     <configuration> 
      <forkMode>perthread</forkMode> 
      <threadCount>4</threadCount> 
      <includes> 
       <include>**/HomeSuiteWithoutFailedTests.java</include> 
       <include>**/QuotaSuiteWithoutFailedTests.java</include> 
       <include>**/SpywareSuiteWithoutFailedTests.java</include> 
      </includes> 
      <systemPropertyVariables> 
       <browser>${browser}</browser> 
      </systemPropertyVariables> 
     </configuration>  
    </plugin> 
</plugins> 

回答

0

解決了在套件的驅動程序初始化之前添加隨機睡眠的問題。