Forum Discussion

ivan_sy's avatar
ivan_sy
Contributor
12 years ago

KeywordTest runs script routine that uses its variables if it exists

I am looking for a way to standardize our Keyword Test to have the following variables as part of our test script development process



TC_NUM

TC_DESC



obviously, to provide the equivalent test case number and its description...



I made a common routine to push the indicator text, but what I wish is that the designers of this keyword test will will only create TC_NUM and TC_DESC variables (On the Keyword designer) and copy-paste the Run Routine lines from a template without editing the KeywordTest lines.



Sub ShowIndicator()



` if there two variables of the KeywordTest that calls this routine exists then..



Indicator.Show

Indicadtor.PushText(TC_NUMvariable + TC_DESCvariable)

' end if



End Sub







  • in short i'm looking for a way to change "Test_Name" (below) to the name of the KeywordTest that called the sub routine







    KeywordTests.Test_Name.Variables.VariableByName(Variable_Name)
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ivan,


     


    If you run your test via a test item, you can get keyword test's name via the test item's ElementToBeRun property. Here's the full name of the property whose value you need to get (for example, via the Call Object Method operation ):


    Project.TestItems.Current.ElementToBeRun.Caption


     

  • Hi Tanya, I've read that there's no way to get the KeywordTest variable without getting the name, and getting the name (as you said) can only be done when running via test items.



    I'd like to add a request that SmartBear consider adding a routine to get the current KeywordTest name regardless if it is via Test Items or via KeywordTest Editor.



    This is very useful in such, as creating variables on the fly inside the Keywordtest while on the KeywordTest editor
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ivan,


     


    We have a corresponding suggestion in our DB - I've increased its rating. 


    Thanks.