TestNG测试不是并行运行的

时间:2013-04-15 04:10:24

标签: testng

我对此问题感到沮丧。我有3个节点运行多个浏览器和网格很好地启动。然后我有一个测试套件,其中有3个测试,每个测试都有多个测试。当我执行测试时,三个浏览器被占用但在一段时间后,第一个节点中只有一个浏览器保持占用状态,另外两个节点保持空闲状态。这是我的设置代码

public void setUpEagle() throws Exception {
        DesiredCapabilities cap = DesiredCapabilities.firefox();
        cap.setBrowserName("firefox");
        cap.setPlatform(Platform.ANY);          
        ffdriver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);

        eagleLogin = new EagleLogin();
        LaunchEagle launchEagle = new LaunchEagle();
        driver = launchEagle.setUp(eagleLogin, LP1_GeneralManager, NonProductionPassword);

        // Print the Class Name
        System.out.println("Test Starting: " + this.getClass().getName());

        menuItem = new MenuItems();
        menu = new Menu();

        verify = new Verify();
    }

//testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="MRS_TestNGSuites1" verbose="10" parallel="tests" thread-count="30">    

<test name="mrs_testsuite1" junit="true">
    <classes> 
        <class    name="com.squaretwo.eagle.smoketests.noninvasive.AccountAssignmentTestNI"/>                   
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountCommentPODDataVerifyTest"/>
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountDebtorPODAddressDataVerifyTest"/>
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountDebtorPODEmailDataVerifyTest"/>
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountDebtorPODPhoneDataVerifyTest"/>
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountDebtorPODPInfoDataVerifyTest"/>              
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountDebtorTearOffTest"/>
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountFinancialPODDataVerifyTest"/>
    </classes>
 </test>

 <test name="mrs_testsuite2" junit="true"> 
    <classes> 

        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountHeaderViewTest"/>
        <class name="com.squaretwo.eagle.test.accounts.AccountID_CTC_US5211Test"></class>                                       
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountNotelineDataVerifyTest"/>                                    
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountNotelineTearOffTest"/>       
        <class name="com.squaretwo.eagle.test.accounts.Account_ReOpen_And_CancelTimTest"/>          
        <class name="com.squaretwo.eagle.smoketests.noninvasive.PerformanceLegalAccountSearchTest"/>                                    
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AdvDebtorsLifecycleCancelledTest"/>                     
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AdvSearchAcctNumberTest"/>  
    </classes>
 </test>
 <test name="mrs_testsuite3" junit="true"> 
    <classes>                       
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AdvSearchLifecycleCancelledTest" />                 
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AdvSearchMultipleCriteriaTest" />                                       
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AdvSearchSaveCriteriaTest" />                                       
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountPODDataVerifyTest" />
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountPODMediDataVerifyTest" />                    
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountStatusPODDataVerifyTest" />                  
        <class name="com.squaretwo.eagle.smoketests.noninvasive.AccountsTouchedReportTest" />
        <class name="com.squaretwo.eagle.test.accounts.AddPaymentPlanArrangement" /> 
    </classes>
 </test> 

1 个答案:

答案 0 :(得分:0)

你的套件xml中有parallel = tests,其中只有3个测试(<test>)。所以你实际上一次运行的浏览器不超过3个。其中一个<test>的运行时间比其他两个更长,这就是为什么&#34;经过一段时间后,第一个节点中只有一个浏览器仍处于占用状态,另外两个节点只是保持空闲状态&#34;。