Skip to main content

The RSC Resource

There is one particular problem when working with distributed testing nodes: when a test requires additional resources like data files, these need to be sent to the remote location and saved in a different path, atypical of the common practice. This poses a problem when the tests may have been created with a hardcoded path to find the required data files and that mobilization will cause those paths to be broken and the files not accessible.

Appvance IQ provides a way to not only send the required resources safely to the remote location but also to always know where those resources are. To make that information available during the testing steps, a special DPL is used: RSC

This small named DPL is very useful indeed. All the resources needed for test steps, even for other DPLs, should be placed in the resources section. The RSC DPL provides a way to obtain the generated path (the ultimate path where the resource lies), using its index in the resource section. Let’s see a couple of examples.

For any CVSDPL, the setup will require the path of a CVS file. You can have the CVS file in your hard disk, but in order for the CVSDPL to find it once it is running in the remote testing node, you need to indicate that file in the resources section, like this:

<resources><data path="c:\mydata\data.csv"/>…
</resources>

See that the data tag represents file resources. In this case, data.csv is the first one, index 0 of the list.

Now, when defining the DPL instance, you need to pass the file’s path. To do this, you use the RSC DPL like this.

<DataSources><dpl name="mydpl" type="HashDPL"><argument name="file" dpl="rsc" value="getDataByIndex" index="0"/></dpl></DataSources>

Note that we are using the Resource as a normal DPL, but now in another’s DPL instance definition. The HashDPL setup method receives as an argument the path of the CSV file, where the true location is returned by Resource. We indicate to Resource we want the resource with index number 0 in the resources section, which is in the data.csv file example.

You can use that facility anywhere you like. In this other example, we are passing the correct path of a file to the test step agent, so it can read the data file correctly.

<run name="CheckInventory" module="JythonModule" testclass="testgen4web"method="run" langtype="jython"><argument name="frozenfile" dpl="rsc" value="getDataByIndex" index="0"/><argument name="ownerinfo" dpl="values" value="getData"/></run>

Last updated: February 22, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai