硒网格用Ant顺序+并行执行(Selenium Grid with Ant sequential +

2019-07-28 20:44发布

我试图运行与硒网格2设置Selenium测试。 我的测试是更加依赖。 我有良好的定义我连续运行和并行运行。 固定用于参考我的build.xml文件。 内连续节点我有不同的目标,许多并行节点。 我在运行该build.xml文件不一致所面临的问题。

有些时候,它拿起第二个并行节点有时它不是的目标。 它不给错误也。 我想在详细模式下运行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>

提前致谢
美国之音

Answer 1:

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


Answer 2:

这是更好的使用tesng或JUnit来管理并行测试,而不是直接在build.xml中这样做的。

这里是配置TestNG的,蚂蚁和硒电网一个很好的教程:

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



文章来源: Selenium Grid with Ant sequential + parallel execution