Please follow the steps below: In .Net Explorer, create a new project and load the Web Service that you want to test. In the Objects tab, found in Design View | Loaded Components, highlight Global test Case Objects and right-click to create a new Global Variable: This variable will be used to call the files you want to submit as a parameter of the method you are testing. Enter a name for the variable, select variable type to be a string, and select Initialize Value (as opposed to Initialize from a File) and enter anything as the value. This value will be amended later. [Note: It is only required that the "Initialize Value" option is used, as opposed to "Initialize from a File" if you intend to generate a script for loadtesting in SilkPerformer. This is because of a known issue with the way that project attributes are implemented. If you want to test the submission for an xml document from within .Net Explorer alone, you could use the"Initialize from a File" option.] You will now see that a global variable has been created with the name and value that you entered. In the Input Data Properties section on the right change the User Attribute to read True so that this variable will appear in the SilkPerformer project as a Project Attribute. Switching back to the Design View | Loaded Components | Classes pane, select the method you want to test, click on the input parameter in the Method call | Input Data pane and click on the ellipse in the Input Data properties | Input value box. This will invoke the Input Value Wizard, from where you should select to use the variable that you defined earlier from the drop down list. You should now invoke your method. It is worth noting that it may fail at this stage because you have invoked it with the initial value that you set earlier, rather than the data from the file which is the end objective. Go to Export | SilkPerformer .Net Project, provide a name for the SilkPerformer project which is to be created and select for it to be opened in SilkPerformer. The script created is divided into 3 separate transactions. It is necessary that we move the DotNetLoadObject and theDotNetFreeObject into the same transaction as we will need to re-instantiate and then free the object every time we change the file to be used i.e. the project attribute. Therefore, the script should now look like this; The next step is to create a csv file form were we can read in the names of the other files that we want to test. For more information on this please see "Adding Parameters from Multi-Column Data Files" in the online Help. Select to have the Row Selection order as sequential and the attribute to be on a per transaction basis. The functions for accessing the file will be automatically entered into the script. Remember that you will need to add the data files to your project as well. For more information on this please see "Administering data files in a project" from the Online Help. The following function should be pasted into the dclfunc section of the script to allow the information contained within the xml documents to be read into the script; In SilkPerformer go to Projects | Project attributes and you will see that variable that we created in .Net explorer has now been entered as a project attribute with the initial value that we gave it. You now need to overwrite this attribute with the content from the xml files. To do so, call the function defined above with the output of FileGetCol, and then set the output of the function to overwrite the attribute using AttributeSetString. If you wish to delete each row from the csv file after it has been used please view the following information: Can SilkPerformer delete a row from a csv file after it has used the data contained in that row?
↧