--include <tag> --exclude <tag> not working as expected
Closed this issue · 2 comments
paivikk commented
Having an issue with test filtering logic when trying to use both --include and --exclude options.
Using this dummy suite:
*** Settings ***
Documentation Foo 1
Library DataDriver
... reader_class=tests\\foodriver\\foo_reader.py
Test Template Foo Template
Default Tags default
#Force Tags forced
*** Variables ***
*** Test Cases ***
Execute Toolchain for ${fooarg}
*** Keywords ***
Foo Template
[Arguments] ${fooarg}
Log ${fooarg}
And custom driver:
from DataDriver.AbstractReaderClass import AbstractReaderClass
from DataDriver.ReaderConfig import TestCaseData
class foo_reader(AbstractReaderClass):
def get_data_from_source(self):
return self._read_file_to_data_table()
def _read_file_to_data_table(self):
test_data = []
flipflop = True
for i in range(6):
args = {'${fooarg}': i}
tags = ["flop"]
if flipflop:
tags = ["flip"]
flipflop = False
else:
flipflop = True
test_data.append(TestCaseData(f"Test {i}", args, tags))
return test_data
robot --include default --include flipORflop tests\foodriver -> 6 cases
robot --include default --include flip tests\foodriver -> 3 cases
robot --include default --exclude flip tests\foodriver -> 0 cases (expected 3)
robot --include default --exclude NOTflip tests\foodriver -> 0 cases (expected 3)
(seems to be working similarly also when 'default' is forced)
paivikk commented
Wow, that was fast. Works like a charm. Thank you very much! :)