Forum Discussion
Marsha,
With this code expression:
"Lens = " + KeywordTests.Sheet1.Variables.lens
we did pull a variable from the Sheet1 keyword test for use in the TestCase1 keyword test so I tried using the following command from within Sheet1 keyword test and it did not work there either
" Country = " + KeywordTests.Sheet1.Variables.CountryLanguageTestSet["Country"]
This syntax seems to work when the log message is set to Table Data but not when it is set to Code Expression.
The not-so-pretty way would be to add another variable and set it equal to the table data value and then use that new variable in the code expression.
tristaanogre If there's a spiffy trick for this I don't know it. Any ideas?
- WillyPete7 years agoContributor
That worked! I created a string variable "Country" in the Sheet1 keyword test. I then set that variable to KeywordTests.Sheet1.Variables.CountryLanguageTestSet["Country"] and then I can grab this variable from the other keyword tests and it is updated every time the data driven loop starts again.
I was getting hung up before when i tried this path because i was trying to set the variable to the value in the spreadsheet during the variables creation(which apparently can't be done) rather than setting the variable from within the keyword test (which works great).
- Marsha_R7 years agoModerator
Hurray! If you're going to cross over between tests a lot, those Project variables will save you every time!
- WillyPete7 years agoContributor
That is what I am trying to do right now. ;) Great minds and all that...
- tristaanogre7 years agoEsteemed Contributor
This is an issue of scope... the variable in the Sheet1 keyword test is scoped within that keyword test. So, this basically means that there are factors of it that are only initialized and incremented within that keyword test. This is probably why you're having trouble using it in your other test. I'm honestly not sure how to reference this across keyword tests.
- Marsha_R7 years agoModerator
This one's fixed. :)
A project variable took care of the problem.
Related Content
Recent Discussions
- 2 days ago