I then saved the script off to my project\Scripts directory as UserID.js. (by creating the file externally, I have the power to reuse the script from many locations from within my test). Now that I had something to generate the IDs all I had to do was set the rest up in SOATest. In order for the user ID to be generated every time I executed my Test Suite, I needed to create a Set-up test. This was done by:
- In the left frame, right mouse clicking the associated Test Suite directory
- Selecting Add Test > Setup Test > Test Method
- Selecting the new created Setup Method; the Tool page will appear in the right frame:
- Browse to the previously saved UserID.js file
- In the left Tests frame, right mouse click the Setup Method
- Select Add Return Value Output > New Output > XML Databank
With the above mentioned, executing the Set-up Test will now call the function from the .js file, return it to the SOAPUtil, and then will populate the XML Databank.
Now, from the test case in which I intend to use my random user ID I can select that Username attribute/node (in the right frame), select the value to be “Parameterized” from the dropdown, and then select the name of the Set-up Test I previously created (Set-up 1: z0 in my case).
Thus, a SOATest test case using a random user ID!