C# 测试用例没有按照分配的‘;优先权’;在VisualStudio2019中使用MS测试框架

C# 测试用例没有按照分配的‘;优先权’;在VisualStudio2019中使用MS测试框架,c#,selenium,automation,webdriver,mstest,C#,Selenium,Automation,Webdriver,Mstest,我正在为自动化单元测试用例的测试项目使用MS测试。当我在同一类中为测试用例分配“优先级”后运行测试用例时,测试用例(即[test method])不会按照分配的“优先级”执行 这是我的代码: UnitTestProject22.AutomationFramework { [TestClass] public class LoginScenarios : TestBase { [Priority(2)] [TestMethod]

我正在为自动化单元测试用例的测试项目使用MS测试。当我在同一类中为测试用例分配“优先级”后运行测试用例时,测试用例(即[test method])不会按照分配的“优先级”执行

这是我的代码:

UnitTestProject22.AutomationFramework 
{
    [TestClass]
    public class LoginScenarios : TestBase
    {
        [Priority(2)]
        [TestMethod]
        public void IsUserLoginSuccessFully()
        {
             // second test case code
        }

        [Priority(1)]
        [TestMethod]
        public void IsUserLoginUnsuccessFullyWithInvalidPassword()
        {
        }
    }
}
以下是框架细节:

  • 操作系统-Windows 8.1(64位)
  • MSTest.TestFramework-版本2.1.2
  • MSTest.TestAdapter-版本2.1.2
  • Microsoft.NET.Test.Sdk-版本16.7.1
  • Selenium.WebDriver-版本3.141.0
  • WebDriverManager-版本2.11.0

  • 优先级用于筛选要运行的测试(您可以使用选定的优先级执行测试)-而不是定义执行顺序。您真的需要按特定顺序执行测试吗?它们应该是秩序独立的。