Comments (4)
I have myself always encounter the same issue as @joergschultzelutter . If you want a quick solution you can used the exclude option which work but it's pretty annoying as you need to exclude all except the one tag you need to use :-/
I.e.: -e checkORmodifyORupdate
from robotframework-datadriver.
Some additional thoughts - I think that the root cause might be twofold:
- RF cannot consider the Excel file's
tags
as input parameters as they are located in the Excel file and not in the Robot Test. This would mean that rather deciding on whether a RF test suite contains valid tests (based on the respectivetags
value), RF would first need to run and execute the test file - and then make a conclusion on the RF Excel file's input data. Tags which reside in the RF test suite should work - but there is another obstacle which brings me to the second issue: - Datadriver tests are keywords and not test cases. AFAIR, keywords associated with
tags
should not work with the--include
parameter (and I mean this on their selection - the keywords do work but thetags
parameter is simply ignored). Why: because RF usually executes tests and not keywords. In this case however, we have one single datadriver point-of-entry test which then results in 1..n keywords. So even if you can assign thetags
to the datadriver tests somehow, thesetests
would still bekeywords
from a mere technical perspective.
I don't know if this issue can be solved by using RF"s listeners but for now, I don't see any workarounds which would enable me to run Excel-based tests based on their tags
value.
from robotframework-datadriver.
https://github.com/Snooz82/robotframework-datadriver#filtering-with-tags
Have you read this in the docs?
To select tests by --include
you have to add that test to the "template Test" in the robot file.
Otherwise the suite is cleaned by the parser before DataDriver will be started.
There is also an option when using DataDriver to configure how tags from the template are added to the generated TestCases.
*** Settings ***
Library DataDriver handle_template_tags=NoTags
Allowed Values
- ForceTags
- UnsetTags
- DefaultTags
- NoTags
You can configure how to handle tags from the template in generated tests:
ForceTags
: Will add all tags of the template test to all data-driven test cases.
UnsetTags
: Will add only these tags from template test to the tests, that are not assigned to any of the test cases.
DefaultTags
: Will only add tags to data-driven test if no tag is set on that test.
NoTags
: Will not add any tags from the template to date-driven tests.
from robotframework-datadriver.
Yes, I did read the documentation :-) However, based my initial question, @ddufrasn 's comment and other inquiries related to the same topic I suggest enhancing the documentation on this issue as it was not really clear to all of us how this option really works.
For completeness sake, here is an updated version of my original example RF test suite. The additional Default Tags
line now enables to filter on a per-test basis via the --include
option (the Excel file has not been modified)
*** Settings ***
Library DataDriver file=datadriver.xlsx handle_template_tags=DefaultTags
Test Template DataDriver Demo Test Main
Default Tags check update modify world_domination
*** Variables ***
${JSON_BODY} ${EMPTY}
*** Test Cases ***
DataDriver Demo Test Call '${API_CALL}'
[Documentation] Run the test cases for method ${API_CALL}
*** Keywords ***
DataDriver Demo Test Main
[arguments] ${API_CALL} ${VAR1} ${VAR2}
Run Keyword DataDriver_Demo_Test_${API_CALL} ${API_CALL} ${VAR1} ${VAR2}
DataDriver_Demo_Test_Call_One
[arguments] ${API_CALL} ${VAR1} ${VAR2}
Log To Console Call One
DataDriver_Demo_Test_Call_Two
[arguments] ${API_CALL} ${VAR1} ${VAR2}
Log To Console Call Two
(.venv) C:\Test_Cases\DataDriver_Tag_Test>robot -i modify datadriver.robot
==============================================================================
Datadriver
==============================================================================
Test Case 2 :: Do even more Call Two
Test Case 2 :: Do even more | PASS |
------------------------------------------------------------------------------
Datadriver | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: C:\Test_Cases\DataDriver_Tag_Test\output.xml
Log: C:\Test_Cases\DataDriver_Tag_Test\log.html
Report: C:\Test_Cases\DataDriver_Tag_Test\report.html
from robotframework-datadriver.
Related Issues (20)
- `|` in test case name leads to not-executable tests with pabot and testlevelsplit HOT 1
- [Documentation] field on Test Case template not honored HOT 1
- Read literal "null" string from excel file HOT 4
- Variable '&{inputs}' not found. HOT 1
- Pabot Data Driver optimization HOT 1
- Datadriver not picking up timeout value from suite
- Unable to import robotframework-datadriver HOT 1
- [ ERROR ] Calling method '_start_suite' of listener 'DataDriver' failed: HOT 2
- -i tags does not work when [Tags] is column in excel sheet HOT 4
- Spaces around variablenames in CSV header destroy variable recognition HOT 4
- Unable to use dictionary variables in testcase names.
- Modify documentation - Force Tags and Default tags are deprecated
- DataDriver Run in Python with tags (include) HOT 6
- I am using data driver library. How can I include tags at test level when I have test template (suite). I tried giving [Tags] in excel but It's not working? do we have any solution? HOT 1
- Robot 6.1 compatibility HOT 6
- bug: importing a custom reader class from module doesn't work HOT 1
- All tests of a suite are run, if include tag not available in data file
- how to parse all .py files under a testcase dir and generate robot testcases dynamic using robotframework-datadriver lib
- https://docs.robotframework.org/docs/testcase_styles/datadriven interactive example is broken HOT 2
- Rerun failed tests raise an error in the latest 1.11.0 version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robotframework-datadriver.