Comments (7)
I have found that the method you suggested works to set a suite variable which the test set up will have access to. But I don't believe there is a way to get access to the variables of the test case from the listener. Per the docs, we'd have access to all attributes of the TestCase model in the Running submodule, and variables isn't an attribute of the current test case.
from robotframework-datadriver.
This is a typical use case that we'd like to run with a data sheet, but it is not possible.
*** Settings ***
Test Template Get data from API
*** Test Cases ***
Get data from API for ${accountNumber} and date ${userDate} Default UserData
*** Keywords ***
Get data from API
[Setup] Setup Keyword arg1=${accountNumber}
[Arguments] ${accountNumer} ${userDate}
${response}= Hit API endpoint body={"accountNumber": "${accountNumber}", "date": ${userDate}}
Should contain ${response} "valid"
Should contain ${response} ${userDate}
Setup Keyword
[Arguments] ${arg1}=Default
Log ${arg1}
Insert data to some DB {"weNeedToCustomizeThisFieldForEachTestCase": "${arg1}"}
from robotframework-datadriver.
Hi,
You could just use that Setup Keyword
directly as first call in that Get data from API
Template.
You can not use [Setup]
in keywords and even in Test Cases afaik the only "feature" of [Setup] is, that it is a little bit different in the log.html...
*** Settings ***
Library DataDriver
Test Template Get data from API
*** Test Cases ***
Get data from API for ${accountNumber} and date ${userDate} Default UserData
*** Keywords ***
Get data from API
[Arguments] ${accountNumer} ${userDate}
Setup Keyword arg1=${accountNumber}
${response}= Hit API endpoint body={"accountNumber": "${accountNumber}", "date": ${userDate}}
Should contain ${response} "valid"
Should contain ${response} ${userDate}
Setup Keyword
[Arguments] ${arg1}=Default
Log ${arg1}
Insert data to some DB {"weNeedToCustomizeThisFieldForEachTestCase": "${arg1}"}
from robotframework-datadriver.
As far as i know, it is also without DataDriver not possible to manipulate the Test Setup
by the Data-Driven approach.
from robotframework-datadriver.
Knowing what you know about the Robot API, would it be possible to feed variables into the [Setup] keyword? On top of being more explicit when set up failed in our reports, I like to keep everything syntactic and "to standard." Other than that, I think you're right that there wouldn't be any functional difference.
from robotframework-datadriver.
Puh that is a hard one.
maybe it would be possible to set a Robot Test Case Variable each time a start_test happens.
But that would also have other side effects.
have to check this. But no time.
if you want to try it by yourself and report what happened.
Use a listener version 3 and try to use BuiltIn().set_test_variable(...) in the start_test(...) method of the listener.
if this works, it maybe would be worth the effort
from robotframework-datadriver.
Thanks for the head start, I will take a look over the next couple of days
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.