Forum Discussion

FLH092921's avatar
FLH092921
Occasional Contributor
4 years ago

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!

  • 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.

  • 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.

    • FLH092921's avatar
      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's avatar
        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.