logging - How to log unit test entry and leave in MSTest -


i'm using mstest , want write log entry before test executes , after finishes. don't want add custom logging code @ beginning , end of each test - make test unreadable , seemed lot of effort (i have > 500 tests)

using testinitialize , testcleanup seemed way go can't test name.

does knows how this?

in mstest, name of test case available in test context property. access in test initialize (as test cleanup) method, can use this: -

    [testinitialize()]     public void mytestinitialize()      {         if (string.equals(**testcontext.testname**, "testmethod1", stringcomparison.ordinalignorecase))         {          }     } 

regards aseem bansal


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -