Date Format Editing
Hi All,
I am calling an API which will give me back the mainframe Job details like Run Date, Run time, Status, Job ID etc in an array. I need to take the Date and Time from the very first occurrence. The format I am receiving is YYYY/MM/DD and HH:MM:SS. I am storing these 2 values in a JSON databank.
I am creating a JSON Assertion to validate if the date is matching the current date (I am getting by writing in Jython Script) as enclosed. Is there a way to change the format of the run date from YYYY/MM/DD to YYYY-MM-DD, so that I could used the stored json databank date in subsequent steps. Similarly, I need to convert HH:MM:SS to HH.MM.SS format.
Also is it possible to return the value other than 1/0 or True/False from Custom Assertion and update the JSON Databank Values ?
Best Answer
-
You would probably need to use scripting to do custom date/time format conversion.
To report custom test violations, use com.parasoft.api.ScriptingContext.report(String message). A ScriptingContext object is passed as an optional argument to the script.
1