dfsaf

主机上建立一个hub,在作为slave的多个主机上建立一个或多个node,要执行的项目pom.xml文件中通过设置线程数,hub平均分配任务给下面的node去执行。

比如:

<plugin>

<artifactId>maven-surefire-plugin</artifactId>

<version>2.16</version>

<configuration>

<testFailureIgnore>true</testFailureIgnore>

<failIfNoTests>false</failIfNoTests>

<forkCount>5</forkCount>

<resuseForks>false</resuseForks>

<argLine>-Dfile.encoding=UTF-8</argLine>

<systemProperties>

                <property>

<name>net.sourceforge.cobertura.datafile</name>

<value>target/cobertura/cobertura.ser</value>

</property>

</systemProperties>

</configuration>

                                                               

<executions>

                    <execution>

                        <id>default-test</id>

                        <phase>test</phase>

                        <goals>

                            <goal>test</goal>

                        </goals>

                        <configuration>

                            <skip>false</skip>

                            <includes>

                                <include>**/ServiceAvailability/VirtualPrinterServices/*.java</include>

                            </includes>

                        </configuration>

                    </execution>

</executions>

</plugin>

 

按以上pom文件的设置,如果hub下有3node,那么会将5个线程先平均分3case3node,然后把剩下的2case随机分给其中2node。最后你能看到2node上都在多线程跑2case,最后那个node上只有一个case在跑。

 

启动Grid建立hub或者node时都需要进入selenium-server-standalone-2.39.0.jar所在目录。通常我们建一个bat文件用来启动Grid server。下面我们将它放在D盘根目录下:

hub.bat: (hub  -port  3737需要跟项目中remote controllerserver port设置一致)

d:

java -jar selenium-server-standalone-2.39.0.jar  -role hub  -port  3737

 

node.bat: (http://10.10.55.32:3737hub的主机地址)

d:

java -jar selenium-server-standalone-2.39.0.jar  -role  node  -hub  http://10.10.55.32:3737/grid/register  -port 7001

hub端可以再 http://localhost:3737/grid/console上看到注册的node信息,这样在hub端run的所有case都会在node上的浏览器中去执行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值