0
Testing started at 12:17 PM ...
"C:\Program Files\Java\jdk-11.0.3\bin\java.exe" -Dorg.jetbrains.run.directory=C:\Users\E7VJ\source\repos\Karate_Practice\Karate_Practice\Karate_Practice\src\test\java\examples\private "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=63177:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\E7VJ\source\repos\Karate_Practice\Karate_Practice\Karate_Practice\target\test-classes;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-apache\0.9.4\karate-apache-0.9.4.jar;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-core\0.9.4\karate-core-0.9.4.jar;C:\Users\E7VJ.m2\repository\com\jayway\jsonpath\json-path\2.1.0\json-path-2.1.0.jar;C:\Users\E7VJ.m2\repository\net\minidev\json-smart\2.2\json-smart-2.2.jar;C:\Users\E7VJ.m2\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\E7VJ.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\E7VJ.m2\repository\info\cukes\cucumber-java\1.2.5\cucumber-java-1.2.5.jar;C:\Users\E7VJ.m2\repository\info\cukes\cucumber-core\1.2.5\cucumber-core-1.2.5.jar;C:\Users\E7VJ.m2\repository\org\yaml\snakeyaml\1.24\snakeyaml-1.24.jar;C:\Users\E7VJ.m2\repository\de\siegmar\fastcsv\1.0.3\fastcsv-1.0.3.jar;C:\Users\E7VJ.m2\repository\info\picocli\picocli\3.0.1\picocli-3.0.1.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpclient\4.5.5\httpclient-4.5.5.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\E7VJ.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpmime\4.5.5\httpmime-4.5.5.jar;C:\Users\E7VJ.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\E7VJ.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\E7VJ.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\E7VJ.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-junit5\0.9.4\karate-junit5-0.9.4.jar;C:\Users\E7VJ.m2\repository\org\junit\jupiter\junit-jupiter-api\5.4.0\junit-jupiter-api-5.4.0.jar;C:\Users\E7VJ.m2\repository\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;C:\Users\E7VJ.m2\repository\org\opentest4j\opentest4j\1.1.1\opentest4j-1.1.1.jar;C:\Users\E7VJ.m2\repository\org\junit\platform\junit-platform-commons\1.4.0\junit-platform-commons-1.4.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\cucumber-java\lib\cucumber-jvmFormatter.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^test 1$" --glue com.intuit.karate C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/src/test/java/examples/private/authorization.feature
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
command: cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name ^test 1$ --glue com.intuit.karate C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/src/test/java/examples/private/authorization.feature
Warning: Nashorn engine is planned to be removed from a future JDK release
12:17:37.101 [main] INFO com.intuit.karate - found scenario at line: 8 - ^test 1$
12:17:37.350 [main] INFO com.intuit.karate - karate.env system property was: null
12:17:38.307 [main] DEBUG com.intuit.karate - request:
1 > GET https://test.nonprod-cpas.com/api/Cap?%24select=ACCT_ID&%24filter=ENTR_ID+eq+%555544433244615555%27
1 > Accept-Encoding: gzip,deflate
1 > Authorization: deleted, can not share here but can help to debug it via hangout or zoom
1 > Connection: Keep-Alive
1 > Host: test.nonprod-cpas.com
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/11.0.3)
1 > spring.jpa.show-sql: false

12:17:38.714 [main] DEBUG com.intuit.karate - response time in milliseconds: 404.78
1 < 200
1 < Connection: keep-alive
1 < Content-Length: 102
1 < Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
1 < Date: Thu, 16 Jan 2020 19:17:38 GMT
1 < OData-Version: 4.0
1 < Server: Microsoft-HTTPAPI/2.0
1 < api-supported-versions: 1.0
{"@odata.context":"https://test.nonprod-cpas.com/api/$metadata#Cap(ACCT_ID)","value":[]}

12:17:38.716 [main] INFO com.intuit.karate - [print] {
"@odata.context": "https://test.nonprod-cpas.com/api/$metadata#Cap(ACCT_ID)",
"value": [
]
}

HTML report: (paste into browser to view) | Karate version: 0.9.4
file:/C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/target/surefire-reports/src.test.java.examples.private.authorization.html

this is a simple get request with $ select and $ filter parameters. everything works fine in the Postman, but shows an empty value in karate. I had the same problem before with Rest-Assured / Java Framework. but I could fix it just by using a different user account for filter param. I tried the same solution with karate framework, checked 10 different user accounts for $filter param, but still got no value in json

Said Yusifli
  • 170
  • 11
  • this is not a karate issue. you are making a wrong request and the server is not giving you the data you expect. try exporting a `cURL` command from Postman and using that on the command line. if it works, carefully compare the request (from the log) and see if there is any difference. you can fix this in 5 minutes. otherwise, without a working example no one can help you. all the best – Peter Thomas Jan 17 '20 at 03:43

1 Answers1

2

Can you please focus your attention on the url in Karate. It has some encoding going on, e.g: %24 where it should be $

Take some time to read this: https://stackoverflow.com/a/53638335/143475

And try this:

* url 'https://test.nonprod-cpas.com/api/Cap?$select=ACCT_ID&$filter=ENTR_ID+eq+'5544433244615555'

And by the way, if that solves your problem - your server has a bug - because it should be able to handle encoded URL-s.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thank you @Peter Thomas * url 'https://test.nonprod-cpas.com/api/Cap?$select=ACCT_ID&$filter=ENTR_ID+eq+'5544433244615555' sending everything in one URL solved my issue. now i am getting value in response. looks like we have a bug in server – Said Yusifli Jan 17 '20 at 18:23