Ask a Question

ELSE statement is ignored in desktop test case

FLH092921
New Contributor

ELSE statement is ignored in desktop test case

Test Complete has been working really well with the VB6 .NET applications I'm testing, I seem to be hitting a wall when trying to use IF, THEN, ELSE.  I'm trying to test a simple calculation where Field Loi950 - Field Loi550 = Field CO2

 

I set up an IF statement where If CO2 does not equal 0, a message is generated saying "The value should equal 0" and the test ends.  ELSE: The record is saved and the test ends.

 

When I run the test, regardless of what value is calculated in CO2, the message "The value should equal 0" will be generated and the test ends.  So if the value is 0, THEN is still executed instead of ELSE.

 

The test is attached, many thanks in advance!

3 REPLIES 3
Marsha_R
Community Hero

Re: ELSE statement is ignored in desktop test case

The format of your if then else looks ok, so I will bet that the values really don't match.  

 

Make sure you are comparing text to text or numbers to numbers. If not, then use this to convert one or the other so the values can be compared.

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/index.html

 

You may want to print the C02 to the log right after you click it and before the IF, just to see what the actual value is.

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
FLH092921
New Contributor

Re: ELSE statement is ignored in desktop test case

Thanks for responding!  I made sure I was comparing numbers to numbers.  I also tried text fields on a web interface, same problem.  I'm still just trialing the software so I'm probably doing something wrong 😛  I'll try to figure it out, thanks again!

FLH092921
New Contributor

Re: ELSE statement is ignored in desktop test case

I tried replicating the same issue using Microsoft calculator and opposite happens, the If Then condition is ignored and the ELSE condition is always executed.

cancel
Showing results for 
Search instead for 
Did you mean: