Forum Discussion
http://stackoverflow.com/questions/31472381/dynamically-compare-rest-xml-json-response-and-jdbc-using-groovy-array-in-soapui/35706976#35706976
Hi Rao,
I have a challenge here in building JDBC request, I am using Mongo Client and there is no inbuilt JDBC congiguration for MongoDB.
My expectations are listed in the DataSource step. I have to compare the JSON response with respective to Data Source Step.
Regards,
Saradhi
- nmrao9 years agoChampion Level 3Is not the question about compring the results from jdbc and another request step response?
- nmrao9 years agoChampion Level 3In that case, you need to download the respective client library and add it to READYAPI_HOME/bin/ext directory.
In the connection string use the mango documentation.
Good luck.- saradhipb9 years agoOccasional Contributor
Hi Rao,
I have downloaded and placed the files in the respective directory.
I have written groovy script (Named the script as Script1) for retrieving values from Database. I added one more groovy script and trying to access the response from the groovy script in the new script, but I was getting 'null' value.
Any suggestions please.
- saradhipb9 years agoOccasional Contributor
I tried to put everything in the same script, now challenge arises on assertion. I am not able to compare below database and rest responses getting assertion failed. Please advise.
Database Groovy Script response
{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D001" ,
"Response2" : "E001"
}
{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D003" ,
"Response2" : "E003"
}{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D005" ,
"Response2" : "E005"
}REST Response:
[{"id":"57560fb04c4013fef4e31d20",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D001",
"propertyValue":"E001"
},
{"id":"57560fb04c4023fef4e31d20",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D003",
"propertyValue":"E003"},
{"id":"5761aa6a02d875aeb096bc22",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D005",
"propertyValue":"E005"}] - saradhipb9 years agoOccasional Contributor
I tried to put everything in the same script, now challenge arises on assertion. I am not able to compare below database and rest responses getting assertion failed. Please advise.
Database Groovy Script response
{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D001" ,
"Response2" : "E001"
}
{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D003" ,
"Response2" : "E003"
}{
"_id" : {"$oid" : "57560fb04c4013fef4e31d20"} ,
"Datarequest1" : "A001" ,
"Datarequest2" : "B001" ,
"Datarequest3" : "C001" ,
"Response1" : "D005" ,
"Response2" : "E005"
}REST Response:
[{"id":"57560fb04c4013fef4e31d20",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D001",
"propertyValue":"E001"
},
{"id":"57560fb04c4023fef4e31d20",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D003",
"propertyValue":"E003"},
{"id":"5761aa6a02d875aeb096bc22",
"Datarequest1":"A001",
"Datarequest2":"B001",
"Datarequest3":"C001",
"propertyKey":"D005",
"propertyValue":"E005"}]