问题
I am trying to run some basic database tests using Karate and Spring JDBC ( as mentioned in DBUtils class in Demo Project).
Here is what I am doing:
Background:
# Read url/username/pwd and provide it to the class
* def config = read('env_file.json')
* def DbUtils = Java.type('DbConnection')
* def db = new DbUtils(config)
Scenario: Validate the modd_ts is present in lob table
* def createdTs = db.readRows('SELECT crtd_ts FROM tableA ')
* print createdTs
Here is what it returns:
com.intuit.karate - [print] [{"crtd_ts":{"nanos":0}},{"crtd_ts":{"nanos":0}}
Not sure why it should return timestamp as "nanos":0 , seems a bug to me . Please confirm and I will open one in github.
回答1:
This is not a problem with Karate it is the implementation of DbUtils
. It is up to you to write something that is right for your environment and database etc. Remember this is just part of the karate-demo
as an example.
来源:https://stackoverflow.com/questions/46961265/karate-database-testing-getting-timestamp-displayed-as-nano