Forum Discussion

TESTUS's avatar
TESTUS
Contributor
15 years ago

Difference between test and test run

I have a little supporter tool, that resets my database. When the tool has finished its work it will show a message box. Now I dont't want to stop all tests, I want to stop only the test execution of one sub if the tool has a problem and does not show the message box. I've found Runner.Stop. But this does not seem to work. Here ist my litte demo programm:



Sub Main

   TestA

   TestB

End Sub



Sub TestA

  MsgBox("A1")

  Runner.Stop(true)

  MsgBox("A2")

End Sub



Sub TestB

  MsgBox("B")

End Sub



If I run this I would suppose that I get the messageboxes with A1 and than B. But I only get the A1. All subs are in different files.

So I did not understand the difference between test and testrun. Can you please explain this.

How can I implement my example above, so that I get the messages as supposed?
  • Hi Oliver,


    The runner.stop(false) will stop the entire execution (as if you would click stop button), and runner.stop(true) will stop execution of the current test item ( not your sub procedure ).


    So in your case you should just exit your procedure after first message box.


    Sub Main

    TestA

    TestB

    End Sub



    Sub TestA

    MsgBox("A1")

    Exit Sub

    MsgBox("A2")

    End Sub



    Sub TestB

    MsgBox("B")

    End Sub




  • Hi Oliver,





    So I did not understand the difference between test and testrun.


    A 'test item' was meant by 'test'. During one test run, several test items can be executed.





    How can I implement my example above, so that I get the messages as supposed?


    You can assign the TestA and TestB routines from Pavel's post to individual test items and call Runner.Stop(True) when you need to stop the current test item without stopping the entire test run.