问题
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