vstest冗长 [英] vstest verbosity

查看:62
本文介绍了vstest冗长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我们通过TFS 2015运行带有控制台记录器的vstest.console.exe 14。 有时测试会挂起,TFS构建会超时。 日志没有给我们一个关于哪个测试挂起的线索。 似乎只有在测试
完成时才会记录消息。

We're running vstest.console.exe 14 with the console logger via TFS 2015.  Sometimes a test will hang and the the TFS build times out.  The logs don't give us a clue as to which test is hanging.  It seems a message is logged only when a test completes.

有没有办法提高记录器的详细程度以便为我们提供更多信息?

Is there a way to raise the logger verbosity to give us more information?

问候,

Kenn

推荐答案

嗨Kenn, 

Hi Kenn, 

正如我在单元测试中所知,我可以使用以下方法获得测试结果:

As I know in unit test I could get the test result by using the following method:

请在UnitTest.cs文件中添加以下代码

Please add the following code in your UnitTest.cs file

private TestContext testContextInstance;
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

 [TestInitialize]
        public void TestInit()
        {
            Debug.WriteLine("TestInitialize" + TestContext.TestName);
        }


        [TestCleanup]
        public void TestCleanup ()

        {
            
            Debug.WriteLine("TestCleanup" + TestContext.TestName);
            
        }




然后我运行 vstest.console.exe UnitTestProject1.dll / Logger:trx  在命令行中,最后我可以在TestResult文件夹下的trx文件中获取特定信息。

Then I run vstest.console.exe UnitTestProject1.dll /Logger:trx  in command line, at last I could get the specific information in the trx file under TestResult folder.

祝你好运, 

Best regards, 

Fletch


这篇关于vstest冗长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆