Reputation: 11
I have created some test cases using the data-driven style testing.
But when attaching the Test Setup
/Teardown
to the Setting
section, both the setup and teardown runs before and after the testing all the data sets.
Robot
*** Settings ***
Test Setup setup
Test Teardown teardown
*** Keywords ***
Test Case Should Pass
[Arguments] ${arg1} ${arg2} ${arg3}
something "${arg1}"
something "${arg2}"
something "${arg3}"
something "${arg}"
Log To Console ${arg}
setup
Log To Console setup
teardown
Log To Console teardown
*** Test Case ***
Test Case
[Template] Test Case Should Pass
a1 a2 a3
b1 b2 b3
Actual
==============================================================================
Something
==============================================================================
Test Case setup
.a1
a2
a3
.b1
b2
b3
.teardown
Test Case | PASS |
------------------------------------------------------------------------------
Something | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Expected
==============================================================================
Something
==============================================================================
Test Case setup
.a1
a2
a3
teardown
setup
.b1
b2
b3
.teardown
Test Case | PASS |
------------------------------------------------------------------------------
Something | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Are there any way that I can have the Setup
/Teardown
to be executed in between each data set tested?
Upvotes: 1
Views: 55
Reputation: 1062
This would work:
*** Settings ***
Test Setup setup
Test Teardown teardown
Test Template Test Case Should Pass
*** Keywords ***
Test Case Should Pass
[Arguments] ${arg1} ${arg2} ${arg3}
something "${arg1}"
something "${arg2}"
something "${arg3}"
something "${arg}"
Log To Console ${arg}
setup
Log To Console setup
teardown
Log To Console teardown
*** Test Case ***
A
a1 a2 a3
B
b1 b2 b3
Upvotes: 1