Tech Tips: JavaScript Output File Not Created While Staging a Test Case to a Remote Simulator

Document created by MarcyNunns Employee on Aug 18, 2017
Version 1Show Document
  • View in full screen mode

Issue:
Have Input data sets which are read by Test scripts and these Test scripts in-turn write output data (using Java script step) into Excel/csv files which are used by other test scripts to continue the suite execution. No issue found when we run the test scripts in ITR mode. However, when we stage test suites from DevTest Portal / Lisa Invoke / TestRunner, the input data is read by test scripts from input data files which are present in DevTest Project folders, but it fails to create output data files in DevTest Project folder. Instead DevTest is creating temp folders for project under C:\Users\***\lisatmp_10.1.x\lads and writing data into these files which are not pointed in the test scripts for further execution. Due to this behavior, output files are at DevTest Project folder path (C:\DevTest\***) are not getting updated.

 

Diagnostic Findings:
This is expected behavior when doing a stage to a remote Simulator.

The /lads directory stores files temporarily while a Test Case or Suite is running. When the Suite or Test Case ends, the files get deleted.

Suggested to write your output file to a common location outside the project or MAR.

 

Resolution:
Create a property in the local.properties file on your local Workstation (you determine the drive, this example is Drive D)
File_Location=D:/Automation

 

Create a property in the local.properties file on the machine where the Simulator is running (you determine the drive, this example is Drive D)
File_Location=D:/Automation

 

If this is on Linux, create a property in the local.properties of where the Simulator is running:

File_Location=/opt/Automation

 

Restart the Simulator to pick up the new property.

 

Note: If you have multiple Simulators, this will have to be done for each Simulator machine.

 

Change the Javascript to reference the input file as {{LISA_RELATIVE_PROJ_ROOT}}/Data/Datasheet.xls  (easy reference when reading in an input file in the Project /data folder)

 

Change the Javascript to reference the output as {{File_Location}}/test.xls

 

Bring up the Portal, this instance is a local Portal running on the local machine.

 

Choose Manage --> Tests

 

Scroll down to your Project.

 

Click on your test case and Run.

 

Test runs with no errors and writes out the expected output file.


When running from a remote Portal, and you need to make a change to an existing test case or add a new test case, do these steps:

 

1. Make your change to your test case.
2. Right-click the test case.
3. Choose Create MAR Info File...
4. A pop-up comes up.
5. The Coordinator server should be filled in unless your have more than one Coordinator running, then will need to choose which Coordinator you want.
6. You will need to choose a Staging doc.
7. Right-click the .mari file you just created.
8. Choose Build Model Archive...
9. A file navigation dialog appears and save the mar file where the mari file is.
10. Bring up the remote Portal.
11. Login.
12. On the upper right section of the page where Current Project is, to the right of the drop down list box is a gear icon, click this.
13. This will bring up a Manage Projects dialog.
14. Choose the upload icon next to your Project.
15. Click the Force to merge conflicted filed checkbox if you need to overlay what is there.
16. Click the Drop file here or click to choose area.
17. Navigate to where the mar file is.
18. Now you can run the test with the updated script from the Portal.

 

 

Although this example is a JavaScript Step, these same principles apply to any test case writing an output file.

2 people found this helpful

Attachments

    Outcomes