Forum Discussion

Sariali's avatar
Sariali
Contributor
13 years ago

Stop


Hello,





how can one stop a test from script? The funktion "raise" stops tests, however, "raise" is probably to be understood more for real system-errors than for final-result of the current test.





In other words: what does make "property checkpoint" to break off the test?









Yours sincerely

Necip Sariali

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Necip,



    > how
    can one stop a test from script?

    Runner.Stop, Runner.Halt - is this what you've looked for?

  • Hi Necip,





    how can one stop a test from script


    Use Runner.Stop.





    what does make "property checkpoint" to break off the test


    The CheckProperty method used in property checkpoints posts an error if a checkpoint fails - error appearance makes the test stop. To avoid this, use CompareProperty that lets you specify the type of the message posted if a checkpoint fails (warning by default).
  • Thank you, Alexei, but this is not really that what I am looking for.



    Imagin:

    the project-suite contains a lot of tests.

    some of these tests are using a script-function.

    if this function fails it calls the raise-method (exception) to stop the current test.

    tc runs then the next test. (stop on error = "none", stop on exception = "none")




    function CheckCompareEqu(const Value1, Value2 : string) : Boolean;

    begin

      if Value1 <> Value2 then

        raise('Value1 "'+Value1+'" not equal to Value2 "'+Value2+'"!'); 

    end;


    I would prefere to call another method but "raise",

    because I think that "raise" should be called for fundamental  errors like "file not found", "connection error occured" e.g.

    this would be an essential error "of missing base informationen to test".

    If all necessary Information are present and the test fails then, one shouldn't call raise, one should call "this test failed -> event "stop on error" will be called)



    Before I implemented my function "CheckCompareEqu" I used in my KeywordTest-test

    the "if"-Statement. I checked both strings and called "stop exection", but this stops my entier testsuite.



    I hope my english is good enough that you can duplicat and understand my idea.



  • That's it, David! :D






    function CheckCompareEqu(const Value1, Value2 : string) : Boolean;

    begin

    aqObject.CompareProperty(Value1, 0, Value2, true, 3); // error



    end;