Forum Discussion

Todd351's avatar
Todd351
Occasional Contributor
3 years ago
Solved

How do I get the current keyword test name from my scrip using JavaScript

I have a keyword test that starts then runs a script (JavaScript). I want to pass the keyword test name into the script to get a variable from the keyword test so that I can run a tested app.

 

This is the script that I tried, But I get an error.

 

let r;
// Get the variable value of the current keyword test
r = KeywordTests.r.Variables.Var1  (This is where the error occurs)

Log.Message("Message tested app to Run ->" + r);

//below runs batch file tested app from variable
r = eval("TestedApps." + r + ".run()");   (This runs fine)

 

The error is TypeError: Cannot read property 'Variables' of undefined