获取trx文件内容 [英] Getting trx file contents

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

问题描述

Hi All
我希望能够在执行测试结束时打开并解析.trx文件(但在执行中)。所以我从TestContext对象的TestDir属性获取了测试结果写入的trx文件的名称,并且在[AssemblyCleanup]方法中,这应该是最新执行的东西,我把代码打开并解析文件。
但是此代码因System.IO.FileNotFoundException而失败。我用来打开文件的路径是正确的,并且在测试执行完成后立即存在文件。因此,我假设虽然所有测试都已完成运行,但当[AssemblyCleanup]方法运行时,文件尚未写入并关闭。
有什么方法吗?有没有办法在执行[AssemblyCleanup]方法之前强制将结果写入文件并关闭文件?

谢谢

迈克尔

Hi All
I want to be able to open and then parse the .trx file at the end of an execution of tests (but within that execution). So I get the name of the trx file the test results are being written to from the TestDir property of the TestContext object, and in the [AssemblyCleanup] method, which should be the latest thing executed, I put the code to open and parse the file.
However this code fails with a System.IO.FileNotFoundException. The path I use to open the file is correct, and immediately after the test execution completes the file does exist. Therefore I am assuming that although all the test have completed running, when the [AssemblyCleanup] method runs, the file has not been written to and closed.
Is there any way around this? Is there a way of forcing the results to be written to the file and the file closed before the [AssemblyCleanup] method is executed?

thanks

Michael

推荐答案

Michael,

这是一个应该得到的选项工作:搜索结果1。在Solution Items文件夹中打开.testrunco​​nfig文件。
2。选择"设置和清理脚本"

3。在"清理脚本"文本框中,浏览到可以完成所需的可执行文件,例如解析.trx并对数据执行一些有趣的操作。

这可能不是您正在寻找的但它是一个可行的选择。希望它有所帮助!
Michael,

Here is an option that should get things working:

1. Open up your .testrunconfig file in your Solution Items folder.
2. Select "Setup and Cleanup Scripts"
3. In the Cleanup script text box browse to an executable that will accomplish what you want, like parsing the .trx and doing something interesting with the data.

This may not be exactly what you are looking for but it is a workable option.  Hope it helps!


这篇关于获取trx文件内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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