![]() |
| |||||||
Testing Anywhere Post messages and questions related to Testing Anywhere here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
Hello, In my Testing Anywhere script, I am calling a Test to be ran (Run Test function) and passing variables from the Caller to the Called Script. The Variables are null in the Called Script. Please can you tell me why this would be? Thanks and Regards, Claire |
| |||
|
Hello Clair, We have solved this problem by writing the data (more than 10 different parameter data) into a single separate predefined parameter file name. The called test script parses this parameter file and uses the stored data. The easiest way to get this to work, is to store the test data into a predefined log folder name (e.g. D:\TestingAnywhere\Log\MyTest) and work from there. With this method you can even send back the test result to the caller test script by storing the test result into a separate file e.g. Result.txt and parse that file in the caller test script for further processing. Hope this helps. Arjan |
| |||
|
Hello Clair, Adding to the above mentioned post you can also try two different processes to call the variable from one Test to another. Process 1: Follow below mentioned instructions to pass the variable from Test A (Caller Test) to Test B (Called Test): Suppose we want to pass the value of variable “Temp” from Test A to Test B. 1. Create variable “Temp” in Test A and assign some value which we need to transfer to Test B. 2. Create the variable “Temp” in Test B of value type and save the Test. 3. In Test A while using Run Test command, use the option of “Pass the Variable as Argument”. 4. Press F2 button and select the variable “Temp” and save the Test A. 5. Run the Test A. Test B variable “Temp” will contain the value of passed from Test A. Process 2: In case the above mentioned process does not works, you can use “Read from file variable” to pass variable from Caller Test (Test A) to Called Test (Test B). Suppose we want to pass the value of variable “Prompt-Assignment” from Test A to variable “Temp” in Test B. 1. Create ReadVariable.txt in C:\ 2. In Test A use “Log to file” command and select C:\ReadVariable.txt file and log the text as follows and save it: Temp=$Prompt-Assignment$ 3. In Test B create new variable of Type –Value, Name –Temp, Select –Read from text file, Select File - C:\ReadVariable.txt. 4. Use “Message Box” command to display the value of Temp. 5. Use “Run Test” command to call Task B in Task A 6. Run the Test A. Please have a look at the sample Tests in Tests.zip file attached with the post. |
| |||
|
Thanks for your response. The method that I was using to pass the variables was: Process 1: Follow below mentioned instructions to pass the variable from Test A (Caller Test) to Test B (Called Test): Suppose we want to pass the value of variable “Temp” from Test A to Test B. 1. Create variable “Temp” in Test A and assign some value which we need to transfer to Test B. 2. Create the variable “Temp” in Test B of value type and save the Test. 3. In Test A while using Run Test command, use the option of “Pass the Variable as Argument”. 4. Press F2 button and select the variable “Temp” and save the Test A. 5. Run the Test A. Test B variable “Temp” will contain the value of passed from Test A. As this is standard TA functionality, I would expect this to work successfully. Can you investigate why this method may not always pass the variables? As stated, I have managed to get this to work by displaying the passed variables in a message box in both the caller and called scripts. I don't know why this works, but it does! |
| |||
|
I also have a similar problem with this. I am passing a variable from one test to another. I am then grabbing some data from an application and comparing that to the passed variable. I can write the values of both variables (application variable and passed variable) to Notepad and both variables are the same. But as soon as I put in a Variable Checkpoint to match the variables the test fails. I found that if I use a Variable Operation and set Clipboard = Passed Variable, regardless of whether I use the Clipboard variable anywhere or not, the test now passes. Bit of a strange workaround, especially as I can see from Notepad that the variable is being passed between tests, but seems to work.... |
![]() |
| Thread Tools | |
| Display Modes | |
| |