cruzader
14 years agoContributor
Need sample code using GoTo statement in TestComplete 7.5
Hello,
Can anyone please provide me a sample code demonstrating the usage of GoTo statement
inside a TestComplete script. My problem is that I have a procedure written in VBScript like:
Sub Test()
Dim bPassed
bPassed = True
If (Obj1.Enabled = True) Then
bPassed = False
GoTo CheckVerdict
End If
If(Obj2.Enabled = True) Then
bPassed = False
GoTo CheckVerdict
End If
:CheckVerdict
If(bPassed = False) Then
MsgBox("Failed")
End If
End Sub
In the sample code above, I always get a syntax error in the line with "GoTo".
Can anyone tell me why this error is showing? And how should I fix it?
Thank you in advanced.
Regards,
Ruel
Can anyone please provide me a sample code demonstrating the usage of GoTo statement
inside a TestComplete script. My problem is that I have a procedure written in VBScript like:
Sub Test()
Dim bPassed
bPassed = True
If (Obj1.Enabled = True) Then
bPassed = False
GoTo CheckVerdict
End If
If(Obj2.Enabled = True) Then
bPassed = False
GoTo CheckVerdict
End If
:CheckVerdict
If(bPassed = False) Then
MsgBox("Failed")
End If
End Sub
In the sample code above, I always get a syntax error in the line with "GoTo".
Can anyone tell me why this error is showing? And how should I fix it?
Thank you in advanced.
Regards,
Ruel
Hi Ruel,
Such GoTo usage is not supported in VBScript. For more information, refer to the Visual Basic for Applications Features Not In VBScript MSDN Library article.
Instead of using the GoTo statement, you can change your script like this:
Sub Test()
Dim bPassed
bPassed = True
If Obj1.Enabled or Obj2.Enabled Then
bPassed = False
End If
If Not bPassed Then
MsgBox("Failed")
End If
End Sub
BTW, the latest version of TestComplete is 8.10.