I am trying out templated test cases and it looks really promising.
Following the RF User Guide, I made this simple test file:
*** Test Cases ***
Sum template test
[Template] ${first} plus ${second} should equal ${expected_sum}
1 2 3
5 5 10
3 12 15
500 200 700
*** Keywords ***
${first} plus ${second} should equal ${expected_sum}
${sum} = Set Variable ${${first} + ${second}}
Should Be Equal As Integers ${sum} ${expected_sum}
I would like to ask whether it is possible to name each case (set of arguments)?
The example here is trivial. But if I will use templates, it will be with many cases and more complex actions. For example:
Sum template test
[Template] ${first} plus ${second} should equal ${expected_sum}
First case 1 2 3
Another case 5 5 10
Special case 3 12 15
Quite a different case 500 200 700
So it would be descriptive in the source file, as well as in the report.
Here is you modified example (followed by screenshots of RIDE ):
*** Settings ***
Test Template ${first} plus ${second} should equal ${expected_sum}
*** Test Cases *** FIRST SECOND RESULT
First case 1 2 3
Another case 5 5 10
Special case 3 12 15
Quite a different case
500 200 700
*** Keywords ***
${first} plus ${second} should equal ${expected_sum}
${sum} = Set Variable ${${first} + ${second}}
Should Be Equal As Integers ${sum} ${expected_sum}
That’s fantastic @HelioGuilherme66 , just what I was looking for!
Surprisingly, I tried same approach, or very similar at least, and got an error instead.
Can you tell me, do you use a particular linter to have the columns with arguments so nicely aligned? Or did you edit manually?
As you can see from the title bar in the screen shots that’s RIDE he’s using for editing the test cases. RIDE probably handles the formatting for you, but @HelioGuilherme66 can tell you much more about it than I can.
Like @damies13 said, RIDE does that alignment automagically.
Unfortunately, RIDE does sometimes unexpected alignments, but if we are willing to accept them, then is a good tool