Ask a Question

Reference the Current Keyword Test Variables

0 Kudos

Reference the Current Keyword Test Variables

I have searched the forums and documentation and can't find an easy way to reference the current keyword test variables using the "code" option. Something similar to the aqTestCaseObj.CurrentTestCase function, but would also extend to the parameters and variables contained within it.

KeywordTests.Current.Variables.OldName
or
KeywordTests.this.Variables.OldName

I am basically trying to store a value, then append something to it by referencing that variable. But, if I copy/paste into similar tests, I have to go in and manually edit each reference to the old test, and modify it to the new test name.

So, if my original test contains a reference to a variable in a parameter like this as code...

KeywordTests.TESTNAME1.Variables.OldName + "something"

When I copy it to the new tests I have to edit the test name manually to be:

KeywordTests.TESTNAME2.Variables.OldName + "something"

This is time consuming given all the dialog boxes involved in some places, and also error prone to typos, etc.

1 Comment
Marsha_R
Community Hero

Make the variables Project variables or Project Suite variables instead of having them local to a Keyword Test. Then you can reference them from any Keyword Test inside the Project or the Project Suite.

 

https://support.smartbear.com/testcomplete/docs/testing-with/variables/collections/index.html

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Welcome to the Community
Sign Up Here