方法一:
testng中加个这个preserve-order="true",用例就可以按照顺序执行
以如下XML为例:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<!--<suite name="test" parallel="true">-->
<suite name="test">
<test name="test" preserve-order="true">
<!-- preserve-order为true,表示<test>下所有<classes>顺序执行 -->
<classes>
<class name="testcase.xm.Test2"></class>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
方法二
在@Test中添加priority属性
priority小,先执行
testng和priority同时配置的话,priority的优先级高
@Story("")
@Feature("")
@Description("")
@Severity(SeverityLevel.BLOCKER)
@Test(dataProvider = "dp_1", dataProviderClass = DataProvider_Testcase1.class, priority = 1)
public void testCase1(Map<String, String> params) throws Exception {
}