Ask a Question

ELSE statement is ignored in desktop test case

SOLVED
FLH092921
Occasional 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!

5 REPLIES 5
Marsha_R
Community Hero

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
Occasional Contributor

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
Occasional Contributor

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.

Hi @FLH092921 - 

 

Where are you setting the value for CO2 in your test? Could you show me a screenshot of the details of the IF...Then values?

 

Thanks, 

Emma

FLH092921
Occasional Contributor

Hi Emma,

 

Thank you for your response, I was able to use another Validation (Check Field) method which made the IF/ELSE statement unnecessary.  Still not sure why it's a little whacky but as I found out it's not required for what I was trying to do.

cancel
Showing results for 
Search instead for 
Did you mean: