Java TestNG—并行运行的两个类测试没有按其应有的优先级排列

Java TestNG—并行运行的两个类测试没有按其应有的优先级排列,java,selenium-webdriver,testng,Java,Selenium Webdriver,Testng,我有以下xml文件: <suite name= "Ecommerce suite" group-by-instances="true" parallel="methods"> <test name = "Sanity tests" verbose = "2" > <classes> <class name = "tutorialTestNG.Search"> </class> &

我有以下xml文件:

<suite name= "Ecommerce suite" group-by-instances="true" parallel="methods"> 
<test name = "Sanity tests" verbose = "2" >
    <classes>
        <class name = "tutorialTestNG.Search">
        </class>
        <class name = "tutorialTestNG.AccountFunds">
        </class>
    </classes>
</test>
问题是,当我运行测试套件时,运行优先级为1的两个类中的方法,而不是先运行一个类中的所有方法,然后运行第二个类中的其他方法。所以输出是这样的:

Successfully logged in!
Successfully searched!
Successfully brought summary of the account!
Successfully advance searched!
Successfully transferred funds!
Successfully bought products!
Successfully paid bills!
Successfully logged out!

即使我将group by instances变量设置为true,您知道为什么会出现这种情况吗?

您可能已经发现了一个问题,我打开了一张罚单:您是否可以尝试用
dependsOnMethods
替换
优先级
?您好,Julien,使用dependsOnMethods是可行的,测试应该按优先级排列。然而,我仍然对
priority
参数不起作用的原因感兴趣,因为我正在学习的internet教程包含的类和方法与我编写的类和方法几乎相同(只有sysout不同,这无关紧要)。不过,他的输出是不同的,因为在他的示例中,这些方法正确地划分了优先级,而在我的示例中,出现了这个问题。请告诉我这件事。干杯,\t你能分享你所遵循的教程吗?检查我的答案你可能发现了一个问题,我开了一张罚单:你能尝试用
dependsOnMethods
替换
priority
吗?嗨,Julien,使用dependsOnMethods是可行的,测试按其应有的优先级排列。然而,我仍然对
priority
参数不起作用的原因感兴趣,因为我正在学习的internet教程包含的类和方法与我编写的类和方法几乎相同(只有sysout不同,这无关紧要)。不过,他的输出是不同的,因为在他的示例中,这些方法正确地划分了优先级,而在我的示例中,出现了这个问题。请告诉我这件事。干杯,\t你能分享一下你所学的教程吗?请查看我的答案
Successfully logged in!
Successfully searched!
Successfully brought summary of the account!
Successfully advance searched!
Successfully transferred funds!
Successfully bought products!
Successfully paid bills!
Successfully logged out!