groovyguyCommunity HeroJoined 11 years ago977 Posts382 LikesLikes received112 SolutionsView All Badges
ContributionsMost RecentMost LikesSolutionsRe: ReadyAPI 4.1.0 issues with groovy "assert" statements Support let me know this is indeed a bug and is being addressed! ReadyAPI 4.1.0 issues with groovy "assert" statements I have already opened a support ticket, but I wanted to see if anyone else is running into this issue. With ReadyAPI, a vast majority of our tests use groovy scripts to validate the data returned by a service matches the query made. Inside of these scripts, we usually have a simple assertion statement to verify that each individual object return matches the query. Something like a simple: assert variableName = "Expected Value", "Data does not match. Investigate" That statement has always worked for us from when I started using of SoapUI NG Pro over a decade ago, up and through at least ReadyAPI 3.66. My team is trying to migrate to ReadyAPI 4.X, and I'm trialing the new versions to prepare my team. I just installed ReadyAPI 4.1.0 during some brief downtime, and found a problem. The statement above? It works if the assertion is actually true. If the assertion fails? Instead of a clean failure with the message indicated, we now get an actual error and a stack-trace because ReadyAPI can no longer handle this. Error is as seen below. Fri Aug 14 12:32:03 UTC 2026: ERROR: An error occurred in the script of the Groovy Script test step [test]: Fri Aug 14 12:32:03 UTC 2026: ERROR: java.lang.ClassCastException: class java.lang.AssertionError cannot be cast to class java.lang.Exception (java.lang.AssertionError and java.lang.Exception are in module java.base of loader 'bootstrap') java.lang.ClassCastException: class java.lang.AssertionError cannot be cast to class java.lang.Exception (java.lang.AssertionError and java.lang.Exception are in module java.base of loader 'bootstrap') at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.runAndGetResult(SoapUIGroovyScriptEngine.java:137) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:110) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:99) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:156) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction.lambda$0(GroovyScriptStepDesktopPanel.java:364) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) The problem is now hundreds, if not thousands, of tests are effectively broken. If anyone has seen something like this, or has ideas, I am all ears. I'm hoping Support can help too. Re: Date as a Global property What nastester posted works. You can use a property value of an inline groovy script expression, which is what ${=Calendar.instance.time.format("yyyy-MM-dd")}. Every time you reference it and send it, say in a request, it'll grab basically a now() timestamp. If you put it in a variable called Date, you just put ${#Global#Date} in where you want that timestamp. Changing from SOAP to REST My team and I are currently working on changing from WSDL/XSD based testing to Swagger/OpenAPIv3Definition JSON files for schemas. I am trying to work through this the same as we did with previous tests and ensure all of our bases are covered. One thing that is giving me pause is with WSDL/XSD/SOAP tests, I could easily validate that the request matched the schema. With Swagger/JSON and REST tests, there's no real easy (ALT-V or Right Click->Validate) method to do this. How would one go about doing this sort of validation, to ensure that our data and requests going on match the schema to avoid muddying the waters with positive/happy-day-scenario tests? I started trying to write a groovy script to validate the request, but haven't mad progress so far. Any/all information appreciated! Re: [OffTopic] Who are you outside of testing? Wow, this thread really took off! I am glad to see the input from tristaanogre and sonya_m. I was away at GenCon in Indianapolis, so I was a bit tied up helping my wife sell her artwork to reply, but I was tracking. I also highly recommend Stephen King, especially The Dark Tower series. Those are some of my favorite books. I can provide a whole list of a lot more if anyone ever needs any reading recommendations. ;) I have ~6+ bookshelves full! Speaking of, as I mentioned in my first post, this love of reading hit me early and made me want to be an author one day. I've realized that dream and have had a few short stories published that are actually available on Amazon. I'm so geeked that you can go on Amazon and search my name and see books that have my stories in them! I'm also working on a novel. I already have it written (clocking in at 150,000 words!) but it needs a lot of polishing. My hopes is to eventually have a series. :) Re: WSDL load SoapUI credentials You're replying to a thread that's 8 years old, and if I am not mistaken, are referencing SoapUI Open Source versus ReadyAPI. You might want to try starting your own thread over in the right community area here. Re: Smartbear Virt server upgrade You'll probably want to open a support ticket for this. The forums has some really knowledgeable people here with the products themselves, but for activation/installation/etc. issues, that's usually something that requires official support. Smartbear Support Portal Re: Can I give github repo as a test project for executing via test runner As far as I am aware no, that doesn't quite work that way. Re: Test Engine and Custom Project Properties If you are using the command line testrunner.bat/testrunner.sh to run your projects, you can see a list of command line parameters and arguments here. Specifically: -P<args> Specifies a value of a project property for the test run. This value will override the variable’s value during the run. Usage: -P<variable>=<value>. If the value includes spaces, enclose the entire argument in quotes. To override several variable values, specify the -P argument several times. Re: Is there a way to store a global or project property inside a virtualized service response script? Gotcha, I wasn't certain what you meant in regards to "running in the cloud." That said, I still do not have a good idea of why it would error. What are you seeing as an error message when ran that way??