Forum Discussion

escap89's avatar
escap89
Contributor
8 years ago

How to auto run some script if some test in our test plan fail.

Hello!   I have for example 5 tests like: TEST A: Open Application TEST B: Add some user TEST C: Edit some user TEST D: Remove some user TEST E: Close Application   Lets say that i config al...
  • Bobik's avatar
    8 years ago

    I see 2 solutions:
    1. Add this logic into script. And run your tests from script instead of test items.
    2. Use project or project suite variables as flags. Next test will just stop if flag was set. In this case logic should be added into existing tests. You can set flags inside OnLogError event handler.

  • cunderw's avatar
    8 years ago

    My solution to this was to use the on test start and on test stop event, it checks that the AUT is on the starting screen. All tests are written to start and stop on this screen. If it any test is not on the start screen, the event handlers restart the application.

     

    You could also use the on log error event handler. 

  • NisHera's avatar
    8 years ago

    this is a usual dilemma faced by testers who start automate testing.
    The way you should design will depend on what you need to test.

     

    For eg. in your example if TEST A failed (Opening application) there are no way of running TEST -B
    how could you run other tests if application failed to open?..will it be pass second time if you do same?

     

    But in second case if you pass TEST A and failed TEST B (Add user) you can still run TEST C with some existing user.
    I would rather design TEST C independent of TEST B (newly add user not used in TEST C)
    So with the TEST D

     

    My advice is make it simple. Design each test as much as independent.
    So even TEST B fails your TEST C will run.
    Also design a set of smoke tests (link) which runs b'for actual test run
    In your eg TEST A and TEST E can be part of smoke tests.