2012-04-09 99 views
6

我正在嘗試使用硒網格2設置運行硒測試。我的測試更加依賴。我必須很好地定義我的順序運行&並行運行。附加我的build.xml文件供參考。在順序節點中,我有許多具有不同目標的並行節點。我在運行這個build.xml時遇到了不一致的問題。Selenium Grid with Ant sequential + parallel execution

有時它會撿起第二個並行節點&的目標有時它不是。它也沒有給出錯誤。我試着在詳細模式下運行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> 

在此先感謝
美國之音

+0

的可能重複[螞蟻 - 繼續執行目標的執行,即使一個目標硒自動化完成(HTTP:/ /stackoverflow.com/questions/10117370/ant-continue-the-target-execution-even-if-one-target-completes-for-selenium-a) – oers 2012-05-09 09:12:46

回答

1

嘗試QAF (formerly 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>