Forum Discussion
Hello,
To assign data to keyword test variables, you should use the appropriate TestComplete keyword operations rather than direct JavaScript assignments. Here's the correct approach to populate a keyword test table variable:
- Create a keyword test and define a table variable in it. Let's assume the table variable is named "MyTable".
- In your script, you can access the keyword test and the table variable as follows:
// Get a reference to the keyword test
var keywordTest = KeywordTests.Test1; // Replace "Test1" with the actual name of your keyword test
// Assign data to the table variable
keywordTest.Variables.MyTable.RowCount = 2; // Number of rows in the table
// The first row
keywordTest.Variables.MyTable.Name(0) = "John Smith";
keywordTest.Variables.MyTable.Age(0) = 24;
keywordTest.Variables.MyTable.City(0) = "Seattle";
// The second row
keywordTest.Variables.MyTable.Name(1) = "Bob Feather";
keywordTest.Variables.MyTable.Age(1) = 59;
keywordTest.Variables.MyTable.City(1) = "Milltown";
Please ensure that the keyword test variable "MyTable" is properly defined in your keyword test before running the script.
By using this approach, you'll be able to populate the keyword test table variable with the desired data. Remember to replace "Test1" with the actual name of your keyword test.
I hope this helps! If you have any further questions or issues, please feel free to ask.
- David912 years agoFrequent Contributor
Problem is still same.. script..
KW table define...
BUT same Error after run script...
- David912 years agoFrequent Contributor
Same problem is Here..https://community.smartbear.com/t5/TestComplete-Questions/JavaScript-quot-ReferenceError-Invalid-left-hand-side-in/m-p/196706 a i tried this solution but no function for me.. i dont understand with this problem..
it doesn't respond to the table at all. We also tried the $set method but nothing 😞 Please help
Related Content
Recent Discussions
- 3 minutes ago
- 23 hours ago
- 7 days ago
- 11 days ago