Forum Discussion
hello bqualters
That is a lot to unpack for a question you need answered... 🙂
"If the assertion fails the script errors out - that doesn't seem to make sense as I thought it would simply cause the test to fail"
If you would like the testcase to finish even though an assertion fails you can un-ticked the "Abort test if an error occurs" within the TestCase Options feature of every testcase.
Also, in regards to the logs that SoapUi provides - they suck. Maybe I'm missing something but they simply tell you whether or not the test step passed or failed - but lack the details as to WHY
You get as much out of the log information as you put into them... My testcases consist almost entirely of Groovy test steps...
- 1) A Groovy test step that calls JDBC for dynamic data to be put into a Properties test step.
- 2) A Rest/Soap Request test step that uses data from the Properties test step (for Rest, I often use a Groovy test step that has a coded Request instead of using a SoapUI provided Rest test step just so I can add logging to it).
- 3) A Groovy test step that asserts the content of the Rest or Soap Response from the previous test step.
As you can see from the sample Groovy I submitted before, you can put as much log information as you need to help debug your scripts. As a testcase runs, I can view the "script log" tab at the bottom of SoapUI screen to see all of the log statement content so I know exactly where my issue might be when a failure occurs. I often include a lot of log.info code when developing a test and comment it out or delete it after I see what is happening. If there is a groovy failure, I can usually review the "error log" tab for specific language/programmatic failure reasons. That might be a communication gap here... I use the script log as my canonical report which is different than an actual report that you can generate in SoapUI user interface.
I was drawn to SoapUI to begin with because of its ability to be flexible in meeting my needs. If it did not have a feature I needed, I could write my own in Groovy. I think I won't be of much help in your endeavor to create a monolithic script to do what you want. I AM a Java / Java Script / object oriented programming languages person and prefer my projects to be modular in nature instead of your desired "purpose of having ONE SCRIPT for all test cases." I can try to answer small specific questions though.
Regards,
Todd
Still not sure why this is happening-->
I can not seem to get the test steps to execute using the referenced variables (either as part of the request or part of the assertion) - for example, I run a SQL - it retrieves an OrderKey - which I write as a Property at the testcase level - then I sub in that value using the parameter in the API Request of the test step and instead of using the hardcoded value I supply ${#TestCase#OrderKey} in the parameter value column - this works if I trigger the execution of the step manually as it uses the value currently stored in the test case Property called OrderKey BUT--> when I run the script to get it to execute this step it fails even though the SQL has run and defined the value in the test case property (OrderKey) successfully - it fails to make the request and throws an error. If I manually execute it again at this point with the retrieved value from the SQL - it works. The same goes for the Assertions - if I reference a property - it fails when run through the script (which I removed the variablized "submission" value and hardcoded it) - but if I click the Request to run manually with same setup - it works.
Sooo...what's the deal?
- TNeuschwanger3 years ago
Champion Level 3
hello bqualters
it is hard to visualize what you are doing... could you include some screen pictures of your test case and show the code/dialog where you are setting and getting properties? Are you using jdbc, property transfers, groovy script for the tasks you describe?
The community edition of SoapUI is a pretty mature product, so I don't think it could be a bug or many people would have encountered this issue. We will have to look to see what the test steps are in your test case.
Regards,
Todd
- bqualters3 years agoOccasional Contributor
I was using code in a way to set the property variable but - I thought if I put ${#TestCase#HexKey} for example in the Request itself that it would automatically use whatever value was stored in the TestCase property referenced. The value may change from one run to the next as I run an SQL to retrieve a valid value from the database and write that value as the HexKey testcase property BEFORE having the Groovy script driver call the test step to execute. The Request works if I manually trigger it's execution (as the value has already been written to that property from previous script attempt to run it where the SQL gets the value - it doesn't go away) but if I run the script it fails and returns-->{"Message": "No HTTP resource was found that matches the request URI 'http://api.xxxxx.xxxxx1.xxx.sc.xxx.com/xxxxx
/createauditbycase/'."} (I replaced parts of the URL with xxx's obviously) -
Below is a pictur eof how I have the request set up - works manually -(The Not Found message IS EXPECTED as using bad value) but try to run it with a command from Groovy and get the above error mentioned. It looks like it sent a null value I guess. I execut eit in the script with these commands-->status = tstep.run(testRunner,context);
result = status.getStatus().toString();If I hard code the value in the Value column pictured it works both ways - manually and through the script. This is obviously not good so I need to understand what is wrong.