首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Ant顺序+并行执行的Selenium网格

使用Ant顺序+并行执行的Selenium网格
EN

Stack Overflow用户
提问于 2012-04-09 15:22:22
回答 2查看 1.5K关注 0票数 6

我正在尝试使用设置好的selenium网格2运行selenium测试。我的测试更加依赖。我必须很好地定义我的顺序运行和并行运行。附上我的build.xml文件以供参考。在顺序节点中,我有许多具有不同目标的并行节点。我在运行这个build.xml时遇到了不一致的问题。

有时它会拾取第二个并行节点的目标&有时并非如此。它也没有给出错误。我尝试在详细模式下运行ant命令,仍然没有获得ant异常。

如果有人在这方面提供帮助,我会很高兴的。

代码语言:javascript
复制
<target name="startServerRC" depends="startServerhub">
        <echo>Starting Selenium Server...</echo>
        <java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
            <arg line="-port 5555"/>
            <arg line="-log log.txt"/>  
            <arg line="-firefoxProfileTemplate"/>
            <arg value="${lib.dir}/ff_profile"/>
            <arg line="-userExtensions"/>
                <arg value="${lib.dir}/user-extensions.js"/>
            <arg line="-role node"/>
            <arg line="-hub http://localhost:4444/grid/register "/>
            <arg line="-maxSession 10"/>
            <arg line="-maxInstances=10"/>
        </java>
    </target>

        <!-- Initialization -->
    <target name="init" depends="startServerRC" >
        <echo>Initlizing...</echo>
        <delete dir="${classes.dir}" />
        <mkdir dir="${classes.dir}"/>
    </target>

    <!-- Complies the java files -->
    <target name="compile" depends="init">
        <echo>Compiling...</echo>
        <javac 
            debug="true" 
            srcdir="${src.dir}" 
            destdir="${classes.dir}"   
            classpathref="classpath" />
    </target>

    <target name="CItarget">    
        <sequential>
            <antcall target="compile"/>
            <parallel> 
              <antcall target="run"/>
              <antcall target="run_PSDATA"/>
            </parallel>
            <parallel> 
                <antcall target="run_PreData"/> 
                <antcall target="run_DFPPulls"/> 
                <antcall target="run_AdTechPulls"/> 
                <antcall target="run_AppnexusPulls"/> 
                <antcall target="run_FTPPulls"/> 
                <antcall target="run_OASPulls"/> 
                <antcall target="run_GDFPPulls"/> 
                <antcall target="run_FreewheelPulls"/> 
                <antcall target="run_ThirdPartyPulls"/> 
            </parallel>
            <parallel>
        <antcall target="run_PostData"/> 
                <antcall target="run_Sales"/> 
            </parallel>
            <parallel>
                <antcall target="run_Administration"/> 
                <antcall target="run_E2EPartner360"/> 
                <antcall target="run_Sales"/> 
                <antcall target="run_Finance"/> 
                <antcall target="run_Loaders"/> 
                <antcall target="run_Accounts"/> 
                <antcall target="run_Adops"/> 
            </parallel>
            <parallel>
                <antcall target="run_Alerts"/> 
                <antcall target="run_CustomFields"/> 
            </parallel>
            <antcall target="stop-selenium"/>
       </sequential>
    </target>

提前感谢

安加纳语

EN

回答 2

Stack Overflow用户

发布于 2013-02-12 22:49:07

试试QAF (formerly ISFW),在那里你可以在使用网格的情况下并行运行测试。在您的情况下,以下配置文件可以满足您的需求:

代码语言:javascript
复制
<suite name="Sample Test Automation" verbose="0" parallel="tests">
<test name="Set1" > 
    <parameter name="selenium.server" value="server1"/>
    <parameter name="selenium.port" value="port"/>

    <!-- group or class or package entry as per testNG standard 
     -->    
    <classes>
    <class name="qualified name of class"></class>
    </classes>>     
</test>


<test name="set2" > 
    <parameter name="selenium.server" value="server2"/>
    <parameter name="selenium.port" value="port"/>

    <!-- <packages>
        <package name="package name" />
    </packages> 
     -->    
    <classes>
    <class name="qualified name of class"></class>
    </classes>
</test> 

</suite>
票数 1
EN

Stack Overflow用户

发布于 2013-11-08 19:25:31

使用tesng或junit来管理并行测试要比直接在Build.xml中做要好得多。

这是一个关于配置testng,Ant和selenium网格的很好的教程:

http://technologyandleadership.com/six-steps-for-complete-test-automation-with-selenium-grid/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10070175

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档