硒网格与蚂蚁顺序+并行执行



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

有时它会拾取第二个并行节点的目标,有时不会。它也没有给出错误。我尝试以详细模式运行 ant 命令,但仍然没有收到 ant 异常。

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

<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>

提前
致谢安贾纳

尝试 QAF(以前称为 ISFW),您可以在使用/不使用网格的情况下并行运行测试。在您的情况下,以下配置文件可以满足您的要求:

<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>
最好

使用 tesng 或 junit 来管理并行测试,而不是直接在 Build.xml 中进行。

这里有一个关于配置testng,Ant和Selenium网格的好教程:

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

最新更新