This is the last post of the series regarding TestContext
. The other posts of this series include:
On Unit Testing:
Usage of TestContext:
- Getting Directory of Current Context with TestContext.
- Performance Measurement with TestContext.
- Output Additional Information with TestContext.
- Unit Testing in ASP.NET Context with TestContext.
- TestContext in Data Driven Unit Tests.
In this post, we discuss another member of TestContext
called AddResultFile
, which is defined as follows.
void AddResultFile(string filename)
Through TestContext.AddResulFile
, additional files can be added with the test results. This additional files will be stored in the unique folder created for current test run, as mentioned. This might be useful in some cases, for example, if we are validating our objects with some external resource, like schema— we can store the schema with our test result so that we can validate our test result later on after test run.