将测试状态报告给结果控制台 [英] To report the test status to result console

查看:95
本文介绍了将测试状态报告给结果控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

您能告诉我可用于向测试结果报告验证状态的方法。

Can you let me know the methods available to report the verification status to the test results.

我是什么理解为:

通过Console.Writeline(),您可以向结果报告您想要的任何消息。但是,如果任何验证/检查点失败,则测试用例状态不会失败。

By Console.Writeline() you can report whatever message you want to the results. However the testcase status doesn't fail if any of the verifications/checkpoints failed.

在其中一个问题中建议使用TestContext.WriteLine()。该方法的参数是"String"。和"objparam"。

In one of the questions its suggested to use TestContext.WriteLine(). The parameters for this method are "String" and "objparam".

你能举个例子吗?在其中一个博客答案中,我看到了以下示例,但它对我不起作用:

Can you give me an example for this. In one of the blog answer I have seen the following example but it didn't work for me:

如果UIMap.UIConnecttoinches03Window.Exists则为
TestContext。 WriteLine(sMessage&""&" Actual:登录窗口显示.-- PASSED")

       否则为
            'TestContext.WriteLine(sMessage&""&" Actual:登录窗口未显示.-- FAILED")

     Assert.Fail(sMessage&""&" Actual:Login window not displayed .-- FAILED")

       结束如果

If UIMap.UIConnecttoinches03Window.Exists Then
TestContext.WriteLine(sMessage & " " & "Actual: Login window is displayed.--PASSED")
        Else
            'TestContext.WriteLine(sMessage & " " & "Actual: Login window NOT displayed.--FAILED")
     Assert.Fail(sMessage & " " & "Actual: Login window NOT displayed.--FAILED")
        End If

让我知道TestContext.WriteLine的确切语法。如果你提供一个例子会很棒。

Let me know the exact syntax for TestContext.WriteLine. It would be great if you provide an example.

谢谢。

推荐答案

TestContext.Writeline与Console.Writeline具有相同的语法。

TestContext.Writeline carries the same syntax as Console.Writeline.

如果要将消息报告给测试结果窗口,可以使用

If you want to report the message to the Test Result Window, You can use

Assert.IsTrue (bool结果,字符串errorMessage); //如果result为false,它将在测试结果窗口以及测试结果的错误消息部分输出errorMessage(TRX)

Assert.IsTrue(bool result, string errorMessage); //If result is false, it will output the errorMessage on the test result window as well as in the Error Message section of the test results (TRX)

 

如果要在特定测试的TRX(测试结果详细信息)中报告这些消息,则必须使用TestContext.Writeline()。来自此的消息将在"附加信息"中输出。测试结果部分(TRX)

If you want to report these messages in the TRX(Test Result details) of a particular test, then you will have to use TestContext.Writeline(). The messages from this will be output in the "Additional Information" section of the Test results(TRX)

 

请选择您想要做的事情。

pls choose what you want to do.


这篇关于将测试状态报告给结果控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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