Passing Multiple Documents Through a Java Application
Hello everyone. I've been trying to find an answer on this, but haven't had much luck.
So for my project, I have a Java Application (JAR) which allows me to compare two SOAP responses from a data source, a baseline (external regression), and new responses; I used the Write File option to write the new responses, and separated the baseline and new responses into 2 separate folders. If a certain parameter matches between the two (a simple number that can be no higher than 3000, but may vary between environments), the Java Application will compare a separate parameter within the two responses that is Base 64 Encoded, and report the difference. The reason we aren't doing this with a normal regression test is because that parameter is over 10,000 characters long; SOATest doesn't point out where the difference is between the two, only saying that there is a difference, which is where the Java Application comes in.
I've been having trouble figuring out how to compare responses when it comes to using a Data Source. As it is now, the Data Source has 32 rows of input/output data, and I'm having trouble figuring out how I could do the following:
- Add External Regression Control for multiple rows in a data source (right now, it's only allowing me to do one row at a time; it says it creates a new diff control file in the same directory as my .tst file, but it doesn't exist).
- Pass each input as a parameter into the Java Application. I tried using the Extension Tool, but it only allows me to pass in one input. Since I'm working with 2 folders, each of which will have 32 text file responses (baseline and new tests), I need to pass both folders instead of just one. I'm trying to figure out how I can test each corresponding text file as well (for example, Row 1 vs Row 1, Row 2 vs Row 2, etc). Any help would be greatly appreciated, and I can provide extra clarification to the best of my ability.
Comments
-
I will address a few of your comments. I could imagine this scenario getting difficult to do just in the forums, so I would suggest contacting Parasoft support for additional assistance if needed.
You are right that the error message from Diff Tool does not specify the difference, but if you double-click on the error message a difference editor will show with the differences highlighted. I can imagine that with a 10,000 character string it may be hard to pick our the differences, but they will be shown.
To create External Regression Controls for multiple rows in a data source, you first configure your test to use the data source. Then you right-click on the test and choose Create/Update Regression Control. Expand Create Regression Controls, then Create Multiple Controls, then select Create External Regression Controls and click Finish. It should run the test through all the data source options and generate regression control files in the workspace. I just confirmed that it works in a simple scenario on my side. Please check that you followed those steps and let us know if you still have problems.
Can you show some details about how you are configuring your Extension Tool? To use data sources in an Extension Tool, you simply need to check the option "Use Data Source" and choose the correct data source. Then within the script, you can use the API call context.getValue("DataSourceName", "RowName") to retrieve the data source value and use it where needed. For example in Groovy:
public void doSomething(x, context) { String dataSourceValue = context.getValue("New Datasource", "foo") }
0