Ready API 3.3.1 - messed date up
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ready API 3.3.1 - messed date up
I just updated my SoapUI to 3.3.1 and now my Groovy dates don't work. I keep getting errors "groovy.lang.MissingMethodException: No signature of method: java.util.Date.format() ..." Has anyone else had this and do they have a fix? To recreate I have 2 different ways:
1. in a Groovy script: String todaysDate = new Date().format("YYYYMMdd")
2. in XML injection ${new Date().format("YYYYMMdd")}
Everything was running fine. I did the update, made no changes and now this doesn't work. I'm going back to 3.3.0 for now due to this is a complete stop for me.
I appreciate any help someone can provide.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using Java 8 or more?
Please check the below:
log.info java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('yyyy-MM-dd'))
In xml
<!-- assuming date is element; change as you needed-->
<date>${= java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('yyyy-MM-dd'))}</date>
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure what you mean by using Java 8?
I'm just using ReadyAPI, so it's the Java version that is wrapped in it.
Is there a way to use the other class or is that deprecated?
We will have to do a bunch of rewrites along with manipulating the date by adding or subtracting a day as well.
If we can load in the class that allows us to use the previous way then that would buy us some time. Is that possible?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even I'm facing same issue, all of my test cases used date.format function, so all of them are failing.
Not sure how local JDK version matters to ReadyAPI, anyway I'm having Java 8, but still facing issue, I'm also reverting to 3.3.0. Hope SmartBear will fix it soon.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can check what version of java from Ready API.
As the error says, there is no such method. Lot of changes to Date in java 8.
If there are multiple places using the same code, then try considering to use library. Otherwise use search and replace in the project file in your preferred text editor, have a backup before doing so.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the ReadyAPI menu: Help -> System Properties the Java version used is 12.
My local machine I have Java 8 installed. I have not changed anything as far as the Java version on my local machine when I updated from 3.3.0 to 3.3.1, so I'm confused as to what changed with ReadyAPI?
I understand what you are saying I would like to know what is happening so I can better understand how Ready API works. If they are using an internal Java version from my own, that would be good to know. I have tried your fix and it does work, but why is this now necessary and why can I not use what I currently have instead? If there is going to be an update of the Java version being used it would be good of SmartBear to note that in there version update notes.
I will remain on 3.3.0 until I can find time to work these things out. I do have groovy in the XML requests, so a library won't help here.
Thank you @nmrao for your help here.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) I tried your solution, It's working fine(I checked for current time). Thanks for work around. But I have to look for LocalDate.now() how it work for time manipulations(Previous dates, future dates, different time zones, etc..).
2) Java Version: I'm bit confuse here, If I''m not wrong from even Ready API 3.3.0 also using Java 8(or more), they did update Java12 for 3.3.1. So in this case both versions have latest Java & 3.3.1 should work with date.formate. But not sure where we are missing.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@PrathapR, this is not workaround, that is the correct way.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 3.3.0 is also using 12.
So my guess is that Ready API maybe updated the 12 version to a more recent version of 12 and that the deprecated version of date is now removed?
So if I'm not mistaken to my question, ReadyAPI is then using internal Java files, not what is on my local machine?
Thank you!
