Raj*_*aju 2 selenium selenium-grid selenium-rc selenium-webdriver
我用Maven Java设置了Selenium框架.所以所有依赖都存储在POM.xml中我怀疑..如何启动服务器java -jar selenium-server-standalone-2.18.0.jar -role hub ..我应该把这个jar再次放在某个文件夹中,我应该从那条路开始?或者我应该去Maven Dependencies文件夹(.m2\Repositories)?
任何人都可以建议我吗?
如果问题不明确,请回击.我将以不同的方式解释.
谢谢Raju
从Maven运行Selenium Grid可能不是一个好主意; 这取决于你将要做什么以及如何做.
通常,您将针对多个/多个不同的环境并行运行Selenium测试,这会产生相当大的资源成本.当您从Maven启动进程时,它们在其主线程内运行(作为子线程),因此将其资源限制为Maven的配置.这取决于您的机器和配置,但是从Maven启动网格并在一台普通机器上并行运行一些Selenium测试(集线器和几个节点,每个节点有5个实例)可能会使Maven因缺乏而挂起记忆 为了避免这种情况,您可以调整配置,按顺序运行测试(不是并行运行,仅运行一个节点)等,但是再次:它取决于您想要做什么和如何做,也许您应该考虑其他运行方式硒测试.
不过,如果您只想尝试Selenium Grid的工作方式,或者只是几个将要运行的特定测试,您可以使用maven-antrun-plugin
和启动您的集线器和节点,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>pre-integration-test</phase> <!-- your Selenium tests should run in integration phase -->
<configuration>
<target>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role hub"/>
</java>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role node
-browser 'browserName=firefox,version=19.0,maxInstances=3'
-browser 'browserName=internet explorer 64bits,version=9.0,maxInstances=2'
-hub http://localhost:4444/grid/register
-port 5555
-timeout 40000"/>
</java>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role node
-browser 'browserName=chrome,version=24.0.1312.56,maxInstances=3'
-browser 'browserName=internet explorer 64bits,version=9.0,maxInstances=2'
-hub http://localhost:4444/grid/register
-port 5556
-timeout 40000"/>
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
您应该在pom.xml中具有此依赖关系:
<dependency>
<groupId>org.seleniumhq.selenium.server</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>2.30.0</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8856 次 |
最近记录: |