T E S B O

Tesbo

If…Else condition

1. If condition

Syntax:

If:: @element is displayed
....
End::

Notes: End:: is optional, if End:: statement is not found then tesbo will consider all steps in if condition till test end statement not found.

i.e

Test: Verify if condition
#All #if
Step: Open URL 'https://www.mathsisfun.com/decimals.html'
Step: pause 2 sec
If:: @NewPageHeading is displayed
Verify: @NewTest text is equal 'The decimal point goes between Ones and Tenths.'
Step: pause 2 sec
End::
Verify: @NewTest text contains is 'The decimal point'
End

2. If…Else condition

Syntax:

If:: @element is displayed
....
Else::
....
End::

i.e

Test: Verify if else condition
#All #if
Step: Open URL 'https://www.mathsisfun.com/decimals.html'
Step: pause 2 sec
If:: @NewPageHeading is displayed
Verify: @NewTest text is equal 'The decimal point goes between Ones and Tenths.'
Step: pause 2 sec
Else::
Verify: @alphanumericText is present
Step: pause 2 sec
End::
Verify: @NewTest text contains is 'The decimal point'
End

3. Else If condition

Syntax:

If:: @element is displayed
....
Else If:: @element is displayed
....
Else::
....
End::

i.e

Test: Verify if else condition
#All #if
Step: Open URL 'https://www.mathsisfun.com/decimals.html'
Step: pause 2 sec
If:: @PageHeading is displayed
Verify: @NewTest text contains is 'The decimal'
Step: pause 2 sec
Else If:: @NewPageHeading is displayed
Verify: @NewTest text is equal 'The decimal point goes between Ones and Tenths.'
Step: pause 2 sec
Else::
Verify: @alphanumericText is present
Step: pause 2 sec
End::

4. If statement with AND condition

Syntax:

If:: @element is displayed AND @element text is to 'verify text'
....
Else::
....
End::

i.e

Test: Verify And condition
#All #if
Step: Open URL 'https://www.mathsisfun.com/numbers/counting.html'
Step: pause 2 sec
If:: @ThreadNumber text is grater then equal to '2' AND @SecondNum text contains is 'Count to 100'
Verify: @NewPageHeading text is equal 'Counting'
Step: pause 2 sec
Else::
Verify: @NumTitle is present
Step: pause 2 sec
End::
Verify: @SecondNum text contains is 'Count to 100'
End

5.  If statement with OR condition

Syntax:

If:: @element is displayed OR @element text is to 'verify text'
....
Else::
....
End::

i.e

Test: Verify OR condition
#All #if
Step: Open URL 'https://www.mathsisfun.com/numbers/counting.html'
Step: pause 2 sec
If:: @ThreadNumber text is grater then equal to '5' OR @SecondNum text contains is 'Count to 100'
Verify: @NewPageHeading text is equal 'Counting'
Step: pause 2 sec
Else::
Verify: @NumTitle is present
Step: pause 2 sec
End::
Verify: @SecondNum text contains is 'Count to 100'
End

6. Possible conditions

Syntax:

If:: @element is displayed
If:: @element is present
If:: @element text number is grater then equal to 'any number'
If:: @element text number is grater then 'any number'
If:: @element text number is less then equal to 'any number'
If:: @element text number is less then 'any number'
If:: @element text is equal to ignore case @element2 text
If:: @element text is equal to @element2 text
If:: @element text is equal to ignore case 'any text'
If:: @element text is equal to 'any text'
If:: @element text contains is 'any text'

You can find a all similar example from Tesbo-Skeleton as wellPrev

Powered by BetterDocs

Leave a Comment