Writing Custom HTML Logs

白昼怎懂夜的黑 提交于 2019-12-05 14:38:12

问题


My Coded UI Test is configured so that the output of the test automatically produces an HTML log file, the instructions for doing this can be seen here.

Is there any way to customize this HTML log or make my own HTML logger so that mine is used to produce the log instead? For instance the default HTML log only shows Assert events if they fail. I would like Assert events to be shown even if they don't fail.

I would like to use the default HTML logger as a base as it already does almost exactly what I need, I'm not looking for a solution such as create my own output messages during the test then create an HTML file with these messages myself.

Update: It looks like the .html file is ultimately written by C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\QTAgent32_40.exe if that helps at all...


回答1:


The instructions say:

With the modifications to the QTAgent32.exe.config file in place, when you run a coded UI test you will see there is an output link in the Test Explorer results. Log files are produced not only when your test fails, but also for successful tests when the trace level is set to “verbose.”




回答2:


We're currently evaluating what sort of logging we want and it doesn't sound like there's a lot of options.

this.TestContext.WriteLine("Some logging stuff");

  • This only goes to the standard output of the test, under the TestContext Messages header. Unfortunately, it doesn't go into the UITestActionLog.html, which is the question asked above.

It sounds like, based on these two links, there is not a way to do this easily out of the box: http://social.msdn.microsoft.com/Forums/vstudio/en-US/4c9b11bc-e1a6-4024-928f-c4ceb849fec3/how-to-edit-coded-ui-log-fileuitestactionloghtml-for-customizing-the-log-details?forum=vstest http://social.msdn.microsoft.com/Forums/vstudio/en-US/a53ddcf4-11f7-4586-8256-c4e238dc192a/is-it-possible-to-write-message-into-uitestactionlog?forum=vstest

You could use this to find the log file, and then write your own logger to append to that: How to get path to UITestActionLog.html from code



来源:https://stackoverflow.com/questions/18130028/writing-custom-html-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!