Forum Discussion
use Log.Message
https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/logging/message.html
for the message text in Log.Message use Code Expression
https://support.smartbear.com/testcomplete/docs/keyword-testing/basic/operation-parameters.html
you will have one line of code that will look something like
"Spreadsheet = " + MySpreadsheet.Value + " My Variable Value = " + KeywordTest.Variable.MyVariable
if you need help with that code line, then we need to see a screenshot of your test that references the spreadsheet and the name of your variable
Thank You Marsha!
I am able to get the Keyword variable using the following code expression
KeywordTests.Sheet1.Variables.lens
What I don't know how to do is format a code expression to obtain a string from a cell on the spreadsheet.
I have tried the general format you mentioned:
CountryLanguageTestSet.Country
and I got the following error:
Unable to evaluate the operation's "MessageText" parameter. Error: NameError: name 'CountryLanguageTestSet' is not defined
I have also tried designating the spreadsheet as a variable (CountryLanguageTestSet) and calling that variable( KeywordTests.Sheet1.Variables.CountryLanguageTestSet) as a code expression but I cannot specify a particular cell within the spreadsheet so I get a blank entry in the log but no error, and when I try to concatenate the working Keyword variable with this variable I get the following error:
Unable to evaluate the operation's "MessageText" parameter. Error: TypeError: unsupported operand type(s) for +: 'IDispatchWrapper' and 'str'
If I try and specify a particular cell using the created variable as the only code expression:
KeywordTests.Sheet1.Variables.CountryLanguageTestSet.Country
i get the following error:
Unable to evaluate the operation's "MessageText" parameter. Error: AttributeError: The object does not support this property or method
I understand that you asked for screenshots but I am calling variables in one keyword test from another keyword test and I dont think I could make the screenshots make much sense...
To answer some of the other comments, I do understand programming structures and logic, I have taken a number of programming classes but that was many years ago and I did not use them, so I am only left with the general knowledge. My test is an automated test for a website, I cycle through a spreadsheet using a data driven loop to determine the country and language to select, then I use other spreadsheets for the input and verification values. The test currently consists of a "main" keyword test which calls other keyword tests depending on the data found in the country and language spreadsheet. This will allow testers to run the script and control the areas to be tested without having to understand the TestComplete keyword scripting, they just have to edit a spreadsheet according to the documentation I am providing.
- Marsha_R7 years agoModerator
Okay, we are close.
I cycle through a spreadsheet using a data driven loop to determine the country and language to select, then I use other spreadsheets for the input and verification values.
We are going to use the value that you get in the data driven loop. If you screenshot the loop where you use it, I can pick that out for you.
- WillyPete7 years agoContributor
I have attached a screenshot but I had to only show the highest level in the hierarchy to make it small enough to fit in a screenshot so I also attached the keyword test. I don't know if you can open and view a keyword test without the associated project but it's there...
- WillyPete7 years agoContributor
Oh. :manindifferent:I just realized while looking through the screenshot that I currently do just what I am trying to do elsewhere in the script. It has been a long road, over a year, trying to develop this on the side while still doing my regular testing duties and I just forgot that I had done this already, still don't know how I figured this out previously though...
- WillyPete7 years agoContributor
Hmm, what i did elsewhere to specify the specific value from the spreadsheet doesn't work here:
KeywordTests.Sheet1.Variables.CountryLanguageSelection["Country"]
So looks like I could still use some help.
Related Content
Recent Discussions
- 2 days ago