How to duplicate MSTest attachment functionality with XUnit?

人盡茶涼 提交于 2019-12-08 12:37:00

问题


This Collect screenshots and video azure-devops page describes how to attach files to test reports generated while running tests with MSTest.

The page links to a github repo where a class is provided which claims to publish files for a test run, but the code appears to be more concerned with handling values in a temporary CSV file.

Given that this is for the benefit of those using XUnit (or any non-MSTest-based test runner) there are some problems...

The first is how to identify a test uniquely (especially given that a test method can be run multiple times with different parameters) so that files generated by it can be logically associated with it. I believe this is handled by the MSTest API but that there is no facility for it in the REST APIs.

A further problem is that while the (build or release) pipeline is running actually trying to call the VSTS API (to publish test-output files) will fail because the build, release and test information is not available (via the REST API) until after the pipeline completes.

How can the MSTest functionality allegedly described by Microsoft be implemented with XUnit (other others) so that (as the page says) screenshots (etc) can be collected and attached to test results (and subsequently displayed) using VSTS?

来源:https://stackoverflow.com/questions/55949301/how-to-duplicate-mstest-attachment-functionality-with-xunit

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