Comments (17)
The problem is, that the TestCases are generated before Suite Setup.
So even if the file is modified at suite Setup it wouldn't have any impact, because generation is already done.
But:
What do you think of the following idea?
I add an option do DataDriver to call a spacific Keyword.
Like
Library DataDriver config_keyword=Config DataDriver
This Keyword can be defined by you globally or in each Suite individually.
I would design is so, that this Keyword must have a specific Interface, where it gets all configs from DataDriver and it must return a Dictionary where the content will be read as "new" config.
With this you could generade the CSV file, and define {'file': 'ga28rid6247hd.csv'}
as a return value and DataDriver uses these information to create TestCases.
from robotframework-datadriver.
I would call this Keyword with BuiltIn Features so it could be a robot keyword or a Python one.
from robotframework-datadriver.
Thank you for your reply. When are you planning to add support for this request?
from robotframework-datadriver.
First i would like to know if this would suite your needs.
from robotframework-datadriver.
We are using xlsx file in data driver. As I understand, there would be way to provide keyword name which will be called where I can generate file and return file path in json format. Let me know if I understood it correctly. If this would be the way then it will satisfy my requirement.
from robotframework-datadriver.
Hi,
This is the proof of concept.
The Keyword gets all arguments, that DataDriver gets from Library import, as Robot Dictionary.
It has to return a dictionary with these keys you want to set/override.
Example
*** Settings ***
Library OperatingSystem
Library DataDriver dialect=excel encoding=utf_8 config_keyword=Config
Test Template The Keyword
*** Test Cases ***
Test aaa
*** Keywords ***
The Keyword
[Arguments] ${var}
Log To Console ${var}
Config
[Arguments] ${original_config}
Log To Console ${original_config.dialect} #just a log of the original
Create File ${CURDIR}/test321.csv
... *** Test Cases ***,\${var},\n123,111,\n321,222, #generating file
${new_config}= Create Dictionary file=test321.csv #set file attribute in a dictionary
[Return] ${new_config} # returns {'file': 'test321.csv'}
Result:
==============================================================================
Test
==============================================================================
excel
123 111
123 | PASS |
------------------------------------------------------------------------------
321 222
321 | PASS |
------------------------------------------------------------------------------
Test | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
I try to get time tomorrow and release this as beta, so that you can test it.
from robotframework-datadriver.
Thank you
from robotframework-datadriver.
You should be able to use it.
pip install --upgrade --pre robotframework-datadriver[XLS]
the version 0.4.0b2 include an option config_keyword=
This option enables you to name a keyword that will be called from DataDriver before it starts its work.
Example from previous post works.
The Config Keyword need to accept one argument, which will be the whole config with all values as robot framework dictionary.
And the keyword must return a dictionary that shall include all config keys that should be changed.
Config
[Arguments] ${original_config}
${new_config}= Create Dictionary file=new.csv encoding=cp1252
[Return] ${new_config}
from robotframework-datadriver.
Thank you @Snooz82 . This enhancement is working as expected. Could you please add this enhancement as a part of default installation.
from robotframework-datadriver.
Why not passing directly the configuration dictionary?
from robotframework-datadriver.
How and when would you generate it?
The only solution would be a python variable file, that is imported before Robot Framework.
from robotframework-datadriver.
But then it must be python.
So you can also use a robot keyword.
from robotframework-datadriver.
Hi @Snooz82 ,
When are you planning to make this GA?
from robotframework-datadriver.
Hi @aniketnjoshi,
Maybe in the next two weeks. But you can use it.
It will stay compatible to this behavior.
from robotframework-datadriver.
Hi @Snooz82 ,
Could you please merge this enhancement?
from robotframework-datadriver.
@aniketnjoshi
Is available not with
pip install -U --pre robotframework-datadriver
from robotframework-datadriver.
Will be fixed with 1.0 Release
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.