Sunteți pe pagina 1din 3

Questions from Parasoft Education Webinar: SOAtest Tips and Best Practices Part 2 Presented by James Chan on March

h 7th, 2012

Q1: How do I add my own java classes? How do I call them from a Jython or a groovy script? A1: Adding your own custom Java classes is a simple process in SOAtest. To add your jar files to SOAtest, go to: Parasoft > Preferences > Parasoft > SOAtest > System Properties. This preferences panel allows you to add your jar files or Class Folders the class path. Once you have added the appropriate files to the class path, you can access them by importing the Java classes at the top of your script as was shown in the webinar (alongside of com.parasoft.api). Q2: Can you explain different test flow logic values? A2: For additional information, you can reference: Parasoft SOAtest Users Guide > Functional/Integration Testing > End-to-End Test Scenarios > Configuring Test Suite Properties Q3: How do I control looping; should I use script or test flow logic? A3: Its always best to default to built-in capability. Therefore, I would recommend first trying to use test flow logic. If the capabilities available there are not sufficient to test your single use case, then you should start exploring scripting. However, depending on your use case, this may be a simple case of leveraging data sources and parameterization. Q4: Should I use automatically generated XPaths or create them manually? Q4: The answer to this really depends on what you are trying to accomplish. Most of the time, you can simply use the auto-generated XPaths. However, the XPaths we generate can be sensitive to change within the XML document. i.e. if the element you selected moves from its original location. One situation where you might want to use a manually tuned XPath would be if the response you are validating changes structure frequently. Of course, there are other solutions to this like using the XML Sort tool, but a smarter XPath can be used as well to locate the appropriate element. I would also like to mention that it can sometimes be tricky to manually write an XPath for a SOAP message because of the various namespace definitions that are usually included in those messages. Here, I would recommend that you leverage the auto-generation feature to get you started, and then tune the XPath from there if necessary.

Q5: Is it possible to parameterize an XPath with a data source? Where can I find an example of XPath Parameterization? A5: Yes, it is possible to parameterize an XPath with a data source. As mentioned in the webinar, XPath Parameterization is most commonly used in web browser testing. You can find more information about this along with an example here: Parasoft SOAtest Users Guide > Reference > XPath Reference > Using XPath with a Parameterized Value. Q6: Is there an example of using the writable data source in a script? A6: The scripted interactions with a data source in SOAtest do not change depending on the type of data source. If you are designing your tests properly, you probably wont need to write to the writable data source using a script. This functionality is built into the XML Databank. Ive created a simple example of using the writable data source and subsequently accessing the information within it using a script. It will be uploaded along with the other examples from today. Be sure to examine the console to understand the order of test execution. I would also recommend that you read: Parasoft SOAtest Users Guide > Functional/Integration Testing > End-to-End Test Scenarios > Parameterizing Tests (with Data Sources or Values from Other Tests) > Configuring a Writable Data Source Q7: Is there a way to write in a data source via scripting? I tried to use context.set but it didnt work A7: To use a writable data source, see my response to the previous question (Is there an example of using the writable data source in a script?). If you are trying to store a single value for use later on, use context.put(String key, Object value) and context.get(String key). Please reference the SOAtest API for more details. Q8: How to perform unit tests via SOAtest easily (not creating them one by one)? A8: SOAtest has the ability to automatically generate test cases from a service definition. i.e. a WSDL for SOAP services and a WADL for RESTful services. This should help automate the process of creating tests. I would recommend that you watch Testing SOA with Parasoft Test (SOAtest) because this webinar talks about how to efficiently create functional tests for your services. Please also reference: Parasoft SOAtest Users Guide > Functional/Integration Testing > SOA Functional Tests > Creating Tests From a WSDL. Parasoft SOAtest Users Guide > Functional/Integration Testing > SOA Functional Tests > Creating Tests From a WADL.

Q9: Is there a way to write data to an excel file to a specific column using Jython when you are running test cases from data source, especially an excel? A9: Technically it is possible to do this in SOAtest. There are java apis available that you could use to interact with Excel files. However, I would strongly caution against doing so. Without having additional contextual information, its hard to deterministically say that you should not go this route. That being said, I would recommend that you reconsider exactly what you are trying to test and apply your knowledge of SOAtest functionality to help you design the proper test case.

S-ar putea să vă placă și