Forum Discussion

esoysal's avatar
esoysal
New Contributor
8 months ago
Solved

How to manipulate system date

When I run an API, it automatically gets system date and enters 'created_date' into the related DB table. Is there a way to manipulate it, so it'd look like I did it yesterday?

  • The obvious way would be to manually update the record using something like SQL Developer.

     

    If you want to do this as a step as part of a ReadyAPI test, either a test step or test startup script or teardown script, you can use Groovy script to create an JDBCobject, log into db and run the SQL.

     

    The easiest way would be an JDBC Test Step within your test.  This looks after creating the JDBC object and logging into your db.  Just configure it and add your query and you're good.

     

3 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 2

    The obvious way would be to manually update the record using something like SQL Developer.

     

    If you want to do this as a step as part of a ReadyAPI test, either a test step or test startup script or teardown script, you can use Groovy script to create an JDBCobject, log into db and run the SQL.

     

    The easiest way would be an JDBC Test Step within your test.  This looks after creating the JDBC object and logging into your db.  Just configure it and add your query and you're good.

     

  • nmrao's avatar
    nmrao
    Champion Level 3

    It is also possible that the data in the table gets cached in memory, then just updating table might not be helpful.

    So, full use case would help to understand the problem.

    If there is no inmemory used in the application, then you should implement what ChrisAdams suggested.