ryanta
(Ryan Ta)
15 December 2022 02:41
1
The documentation at Robot Framework User Guide allows this command line option:
--include fooANDbar # Matches tests containing tags 'foo' and 'bar'.
With this test case file:
*** Settings ***
Force tags suite1_tests
*** Test Cases ***
Test 1
[Tags] test1
Log To Console Running ${TEST NAME}, Tags=@{TEST TAGS}
Test 2
[Tags] test2
Log To Console Running ${TEST NAME}, Tags=@{TEST TAGS}
Test 3
[Tags] test3
Log To Console Running ${TEST NAME}, Tags=@{TEST TAGS}
Test 4
[Tags] test4
Log To Console Running ${TEST NAME}, Tags=@{TEST TAGS}
When I ran it with --include ‘test1ANDtest2’, the error was:
[ ERROR ] Suite ‘Suite1’ contains no tests matching tag ‘test1 AND test2’.
I expect test1 and test2 be run.
I’m using:
Robot Framework 5.0.1 (Python 3.8.10 on linux)
Thank you in advance.
damies13
(Dave)
15 December 2022 08:18
2
Hi @ryanta ,
Firstly while this is not related to your issue you should be aware of Deprecation of Force Tags and Default Tags
Regarding the error:
[ ERROR ] Suite ‘Suite1’ contains no tests matching tag ‘test1 AND test2’.
The error you received is correct, In those tests you gave, none of them have both a test1 and a test2 tag, actually none of them have more than one tag.
Refering to Tag patterns :
–include fooANDbar # Matches tests containing tags ‘foo’ and ‘bar’.
If you run with --include ‘test1ORtest2’ then you will get the result you were expecting.
Likewise if you add a 5th test:
Test 5
[Tags] test1 test2 test3 test4 test5
Log To Console Running ${TEST NAME}, Tags=@{TEST TAGS}
This will match when you use --include ‘test1ANDtest2’
as it has both those tags
Dave.
4 Likes
ryanta
(Ryan Ta)
15 December 2022 13:22
3
Thank you! It’s so obvious now. I was thinking “run test1 and test2” and not “run tests that have both test1 tag and test2 tag”.
Regards.
1 Like
Notice that --include foo --include bar
is effectively same as --include fooORbar
.