I want to read the User Variables and System Variables in custom code of my UFT API test. How can I do the same.
Asked
Active
Viewed 916 times
1 Answers
1
It's pretty straight forward, just insert this code in your custom code activity and it will take care of it.
Just replace the variable names that you want to capture.
string systemVar = System.Environment.GetEnvironmentVariable("JAVA_HOME");
CodeActivity4.Report("systemVar", systemVar);
string userVar = this.CodeActivity4.Input.myVar;
CodeActivity4.Report("userVar", userVar);
string testVar = this.Context.TestProfile.GetVariableValue("TestName");
CodeActivity4.Report("testVar", testVar);
Here here is the result:

ManishChristian
- 3,759
- 3
- 22
- 50