cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Passed Log with Script test

SOLVED
kevintran1308
Contributor

How to make Passed Log with Script test

Hi, I know there is a Log.Error when a variable is wrong.

However, how to make the Passed Log if there is a right variable.

For example in Python:

if (variable == False):

   Log.Error("There is an error")

else:

   ......

 

I don't know how to make an else to make the test passing.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
tphillips
Community Leader

Re: How to make Passed Log with Script test

Basically, a test passes if there are no Error messages (or no exceptions have been thrown). So if your test never calls Log.Error(), the test will pass.

We use Log.Checkpoint() to create "Pass" log messages in our scripts.

 

Essentially you will have to check each variable value. If it's not what you expect, log an error message. If it is what you expect, either do nothing or use Log.Checkpoint() to create informational messages with a green check mark.

 

Note, Log.Checkpoint() doesn't explicitly mark a test as a pass. A test will pass if there are no Error messages.


--------------------
QA Systems Architect

View solution in original post

3 REPLIES 3
hkim5
Staff

Re: How to make Passed Log with Script test

can you provide us some context on what you are checking with that variable value?

for the most part, if there isn't anything concrete that you are verifying, you don't need to "assert" a "passed log" (since whatever UI interaction you are preforming will go ahead and get performed as long as there are no failures)

 

otherwise, if you are trying to "validate" the value of a variable against some other contextual value (maybe like an object property or something) then you would create a validation checkpoint against that variable value. that way, TestComplete produces within the test logs, a step for the property checkpoint with the green check for pass or red x for fail. https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/property/about.html

Best,
Justin Kim
kevintran1308
Contributor

Re: How to make Passed Log with Script test

So I have to check if the variables have the values in there.

If all of them have values. The test is passed.

If one of them does not have the value, the test is failed.

I don't know if property checkpoint can check different variables.

and I need to find the way to validate the test if it passes.

tphillips
Community Leader

Re: How to make Passed Log with Script test

Basically, a test passes if there are no Error messages (or no exceptions have been thrown). So if your test never calls Log.Error(), the test will pass.

We use Log.Checkpoint() to create "Pass" log messages in our scripts.

 

Essentially you will have to check each variable value. If it's not what you expect, log an error message. If it is what you expect, either do nothing or use Log.Checkpoint() to create informational messages with a green check mark.

 

Note, Log.Checkpoint() doesn't explicitly mark a test as a pass. A test will pass if there are no Error messages.


--------------------
QA Systems Architect

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements