Knowledge Share
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Knowledge Share

Knowledge is NOT Power IMPLEMENTATION of knowledge is Power!!!
HomePortalGalleryRegisterLog in


 purpose of Test Clean up

Go down 

Posts : 142
Points : 46895720
Reputation : 0
Join date : 2007-12-29
Location : Chennai

purpose of Test Clean up Empty
PostSubject: purpose of Test Clean up   purpose of Test Clean up Icon_minitimeWed Jun 10, 2015 10:31 am

Test Cleanup is code that runs after each test.
Test cleanup is declared inside the same class where your tests are declared. Also any assertions you have that go in TestCleanup can fail the test. This is very useful if you have values you check for each test in the same location that could potentially fail the test.
      public void CleanUp()
Here are the important events to consider:
      public static void Init(TestContext testContext)
         //Runs before any test is run in the class - imo not that useful.
      public void Init()
         //Runs just prior to running a test very useful.
Mostly I use TestInitialize to reset the uimap between tests, otherwise control references can go stale.
Next what runs at the end, once all the tests in your assembly have run (very good for checking for unhandled exceptions or maybe shutting down the application).
So if you run 100 tests via MTM, after the last one is finished, AssemblyCleaup will run, also note this method is a bit special it is declared once per assembly, in it's own class with the [CodedUITest] attribute on the class.
   public class TestRunCleanup
      public static void AssemblyCleanup()
Back to top Go down
purpose of Test Clean up
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Knowledge Share :: Testing :: Automation :: VSTS :: CODED UI-
Jump to: