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!
Solved! Go to Solution.
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.
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.
[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.
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!
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?
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.