Forum Discussion

MrDysprosium's avatar
MrDysprosium
Contributor
7 years ago
Solved

How can I cause a test to fail programatically?

In my test, I need to check to see if two values are the same.. simple enough in code, but how to I get TestComplete to fail via Python code? eample: if Var1 != Var2: # Do something tha...
  • tristaanogre's avatar
    7 years ago

    Define "fail".  Do you want it just to log an error and continue?  Then simply call Log.Error.  Do you want it to throw an exception to get trapped by a try/catch logic?  I'm not familiar with Python but, in JavaScript that would be a call to throw Error('blah').  

     

    Generally, define what you want to call a "failure" (and, perhaps, different "levels" of failure), and we should be able to find a way to get that to happen. :)