I have a number of integration tests that test my services api's and check responses (http response codes and where applicable the body). The api's themselves are hosted in a webapi service in the azure cloud. My integration tests are a separate project that use my proxy to make restful calls to the webapi and check responses and report back success and failure. The integration tests are subsequently executed using MSTest. Every one of my webapi's use an async await pattern and every one of my proxy calls are async and (as far as I can see) I am await'ing in all cases on my test api calls (indeed, I'm not sure you cannot with MSTest). It seems that on some occasions I receive the dreaded
'The agent process was stopped while the test was running.
when some failures occur and from what I can tell this is likely to be one of my integration tests failing on another thread other than the test-runner (a known problem). As a point of reference, I have created an IDisposable style pattern for my test scenarios:
using ( var scenario = new TestScenario() )
{
// do some testing stuff
}
which manages and cleans up downloaded files, manages proxy instances and generally logs information. The question is this: Is there a way to use my existing IDisposable pattern here to try/catch any unhandled exceptions that MSTest seems to not be able to cope with? Or am I stuck with having to wrap every test in a try/catch block of their own and unwrap an AggregateException?
Aucun commentaire:
Enregistrer un commentaire