我使用selenium在c#中有10个测试用例,但它们没有按顺序运行,我如何命令运行测试用例。
这是我的代码。
[Test]
public void AddLeadWithOneTract()
{
ClickOnAddNewLead(driver);
EnterLeadInfo(driver, leadDictionary);
AddTract(driver);
EnterTractInfo(driver, tractDictionary, "4n", "2e", "22", "NENE", "1000", "1000", "10");
SaveTract(driver);
SaveLeadAndExit(driver);
TryFindElementById(driver, "R2017000000", 2000);
}
[Test]
public void TestTractInfoValidation()
{
ClickOnAddNewLead(driver);
AddTract(driver);
EnterTractInfo(driver, tractDictionary, "4", "2", "22", "NENE", "-1000", "-1000", "-10");
SaveTract(driver);
string alertText = CloseAlertAndGetItsText(driver);
Assert.IsTrue(alertText.Contains("Please enter a valid Township"));
Assert.IsTrue(alertText.Contains("Please enter a valid Range"));
Assert.IsTrue(alertText.Contains("Please set valid asked price"));
Assert.IsTrue(alertText.Contains("Please enter a valid NRI"));
Assert.IsTrue(alertText.Contains("Please enter a valid NMA"));
}
答案 0 :(得分:3)
Nunit 3.*
有order attribute
[Test, Order(1)]
public void AddLeadWithOneTract()
{
}
[Test, Order(2)]
public void TestTractInfoValidation()
{
}