如何从代码获取UITestActionLog.html的路径 [英] How to get path to UITestActionLog.html from code

查看:36
本文介绍了如何从代码获取UITestActionLog.html的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个测试用例将结果保存到单独的UITestActionLog.html文件中。但是在每个测试用例的最后,我想将.html移到另一个文件夹并重命名。

Each test case saves results to a separate UITestActionLog.html file. But in the end of each test case I'd like to move that .html to a different folder and rename it.

是否可以这样做,例如, [TestCleanup()]?如果是,那么如何以编程方式获取.html报告位置?

Is it possible to do so in, say, [TestCleanup()]? If yes, then how can I programmatically get .html report location?

推荐答案

TestContext 类包含几个名称中带有目录的字段。这些可以用来访问与运行测试相关的各个目录。

The TestContext class contains several fields with "directory" in their names. These can be used to access the various directories associated with running the tests.

以及根据您的问题 TestContext 类具有 AddResultFile 方法。 Microsoft关于此方法的文档尚不清楚,但似乎文件已保存以供失败测试使用,并丢弃以通过测试。

As well as managing the files as asked by your question the TestContext class has an AddResultFile method. The Microsoft documentation on this mehod is not clear, but it seems that the files are saved for failing tests and discarded for passing tests.

这篇关于如何从代码获取UITestActionLog.html的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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