Forum Discussion
- Marsha_RModerator
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
- WillyPeteContributor
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_RModerator
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.
- NisHeraValued Contributor
most simple way to extract data from excel is using DDT
can use log message to log entry.
If you are going to use automation testing then you have to get to know basic programming concepts.
It's not rocket science. I know ppl from different back grounds started manual testing, then learned automation.
- tristaanogreEsteemed Contributor
Marsha_R's answer is the best answer... it's not writing code per se where you are writing a function or routine, but to do what you want, you will need to write a code expression. That's the only way to concatenate strings into a single parameter for the Log.Message operation.
And, as NisHera suggests... Automated testing IS programming... it is software development. You are developing software that tests other software. So, in truth, to be an test automation engineer, you need to have skill sets from both disciplines. For that matter, even a good manual tester, to truly know what the various scenarios are that need tested, should have a basic understanding of how code is written.
I'd highly recommend starting with a free tutorial... plenty available online. One for JavaScript can be found at http://www.w3schools.com/js/.
Related Content
Recent Discussions
- 4 days ago
- 4 days ago
- 8 days ago