使用NUnit适配器3.10.0.21的不可运行NUnit测试

时间:2018-09-27 13:22:48

标签: c# selenium-webdriver webdriver nunit test-explorer

在带有NUnit适配器3.10.0.21和NUnit Framework 3.10.1的Visual Studio 2015 V14 Update3中,Visual Studio测试资源管理器显示带有源的测试,但是某些测试无法通过T.Explorer运行。

Visual Studio - Test Explorer

运行所有测试后,并非所有测试都已运行:

要选择最后两个测试之一并运行它只会产生任何结果,并且在“测试输出”窗口中会显示相当无用的消息:

------ Run test started ------
NUnit Adapter 3.10.0.21: Test execution started
Running selected tests in C:\TFS\TestFactory\TA\DA\DAGICom\bin\Debug\DAGICom.exe
NUnit3TestExecutor converted 5 of 5 NUnit test cases
NUnit Adapter 3.10.0.21: Test execution complete
========== Run test finished: 0 run (0:00:02,49) ==========

1 个答案:

答案 0 :(得分:1)

我解决了,问题取决于传递给测试方法的字符串的长度。 使用以前的组合Nunit.Framework(“ 3.2.0”)和NUnit3TestAdapter(3.0.10)时,不会出现此问题。 当前,似乎最大字符串固定长度为850个字符。

最大固定长度(结果)= 850个字符。

[Test(Author = "Michele Delle Donne"), Description("")]
    [TestCaseSource("TC_XXXX_XXXXXXXXXX"), Category("XXXXX")]      
    public void DA_ACOM(Type testClass, string environment, string user, string pwd, string result)
    {           
        Services.ObjBase automationTest = null;

        object[] args = new object[] { Settings_Default.browser, environment, testClass.ToString(), testClass.ToString(), result };

        automationTest = (Services.ObjBase)Activator.CreateInstance(testClass, args);

        if (automationTest != null)
        {
            automationTest.ExecuteAutomation(environment, user, pwd);
        }

        Thread.Sleep(TimeSpan.FromSeconds(1));
        automationTest.End();       
    }