The RSC Resource
There is one particular problem whenWhen working with distributed testing nodes:nodes, whentests amay test requiresrequire additional resources likesuch as CSV files, data files, theseor needother toexternal files. These resources must be senttransferred to the remote locationtesting andnode savedbefore inthe test executes.
Because the resource may be stored at a different path,location atypical ofon the commonremote practice. This posesnode, a problempath that was hardcoded when the teststest was created may haveno beenlonger createdbe withvalid. aThis hardcodedcan pathcause the test to findfail because the required datafile files and that mobilization will cause those paths tocannot be broken and the files not accessible.found.
Appvance IQ provides athe wayRSC DPL to notsolve onlythis sendproblem. Resources can be declared in the requiredtest's <resources> safelysection, and the RSC DPL can then be used to retrieve the remoteactual locationpath butof alsoa toresource alwaysat knowruntime, regardless of where thosethe resourcesresource are.is Tostored make that information available duringon the testing steps, a special DPL is used: RSCnode.
Declaring Resources
ThisResources smallrequired named DPL is very useful indeed. Allby the test, including resources neededused for test steps, even forby other DPLs, should be placeddeclared in the <resources> section.
For example, suppose a HashDPL requires a CSV file. The CSV file can exist anywhere on the local machine, but it must be included in the resources section.section Theso RSCthat DPLAppvance 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. YouIQ can have the CVS file in your hard disk, but in order for the CVSDPL to findtransfer it once it is running into the remote testing node, you need to indicate that file in the resources section, like this:node.
<resources>
<data path="c:\mydata\data.csv"/>…
</resources>
The
<data> element represents a file resource.
SeeResources thatare assigned an index based on their order in the <resources> section. The first resource has index 0.
For example:
<resources>
<data tagpath="c:\mydata\data.csv"/>
represents<data filepath="c:\mydata\users.csv"/>
resources.</resources>
In this case,example:
data.csvistheresourcefirst0users.csvone,isindexresource01
Using RSC with another DPL
Once a resource has been declared, the list.RSC DPL can be used to obtain its actual runtime path.
Now,For whenexample, definingif a HashDPL requires the DPL instance, you needpath to passa theCSV file’s path. To do this, you use the RSC DPL like this.file:
<DataSources>
<dpl name="mydpl" type="HashDPL">
<argument name="file"
dpl="rsc"
value="getDataByIndex"
index="0"/>
</dpl>
</DataSources>
Here,
file argument of the HashDPL receives its value from the RSC DPL.
NoteThe following attributes are used:
Attribute | Description |
|---|---|
| Specifies that |
| Specifies that the |
| Identifies the resource declared at index 0 in the
section. |
The value returned by RSC is the actual path of the resource on the testing node. This means the test does not need to know or depend on the path used by the remote node.
Using RSC in Test Steps
RSC can also be used directly in test step definitions.
For example, a normalJython DPL,test butstep nowmay in another’s DPL instance definition. The HashDPL setup method receives as an argumentrequire the path of thea 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.resource:
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>
In
the
Lastfrozenfile updated:argument Februaryreceives 22,the 2023runtime path of resource 0.
IfThe youtest havestep anycan feedbacktherefore access the file without knowing where Appvance IQ stored the resource on thisthe topic,remote pleasetesting contactnode.
Recommended Usage
Use the following approach when a test depends on an external file:
- Add the file to the
<resources>section. - Determine its resource index based on its position in the section. Remember that indexing starts at
documentation@appvance.ai0. - Use the RSC DPL with
getDataByIndexwhenever the file path is required. - Avoid hardcoding paths to resources that will be used on distributed testing nodes.
This approach allows the same test to run reliably across different testing nodes and environments without requiring changes to file paths.
Summary
The RSC DPL provides a runtime-safe way to access resources transferred to distributed testing nodes. Instead of relying on a hardcoded local or remote path, the test references the resource by its index in the <resources> section.
For example:
<resources>
<data path="c:\mydata\data.csv"/>
</resources>
The resource can then be referenced anywhere a file path is required:
<argument name="file"
dpl="rsc"
value="getDataByIndex"
index="0"/>
The RSC DPL resolves the resource to its actual location on the testing node at runtime.