PePe
PePe

Reputation: 21

Karate - missing double quotes in the response of Runner.runFeature()

I'm trying to get response in java after Runner.runFeature() execution however double quotes are removed from some of entities.

The feature file called is reading external json file. Then dynamically changing values in karate and making post.

In output I see that the file have double quotes. However after execution when I see in the response map double quotes are removed on some of objects.

Initial json file (sample.json):

{"d":{"ChangeRequestType":"AAA","AdditionalInformation":"bla","RequestReason":"test BP creation","BusinessPartner":{"BPCategory":"2","Description":"BLA","CentralData":{"Name1":"NYJKPEFB0818GR4","Name2":"NYJKPEFB0818GR4","NameOrg1":"LM60Q9ZBBXM4SHXWNJZK","NameOrg2":"LM60Q9ZBBXM4SHXWNJZK"},"TaxNumbers":[{"TaxNumberCategory":"XYZ","TaxNumberProperty":"999"}],"IdentificationNumbers":[{"IdentificationType":"BLA01","IDNumber":"123"}],"BankDetails":[{"BankdetailsID":"0001","BankNumber":"210","BankAccount":"12344","BankCountry":"DE","BankAccountName":"Hardcoded bank account"}],"Addresses":[{"AddressType":"1","PhysicalAddresses":[{"HouseNumber":"40","City":"Berlin","PostalCode":"1333","CountryKey":"DE","Street":"BLA"}]}]}}}

Feature file, reading external json file:

    * def entityCreate = read('..//utils/sample.json')


  Scenario:Post
  ------------------------------------------------------------------------------------------------------------

  Creating unique BusinessPartner
    Given url uri
    And request entityCreate
    When method post
    Then status 201 

Invoking feature file from JAVA class:

  Map<String, Object> resultCreate = Runner.runFeature(getClass(), "/../odata/businesspartner/businessPartnerCreateTest.feature", null, true);

Result of getting result from Runner:

 System.out.println(resultCreate.get("entityCreate").toString());

Result:

{d={ChangeRequestType=AAA, AdditionalInformation=bla, RequestReason=test BP creation, BusinessPartner={BPCategory=2, Description=BLA, CentralData={Name1=NYJKPEFB0818GR4, Name2=NYJKPEFB0818GR4, NameOrg1=LM60Q9ZBBXM4SHXWNJZK, NameOrg2=LM60Q9ZBBXM4SHXWNJZK}, TaxNumbers=[{"TaxNumberCategory":"ABC","TaxNumberProperty":"123"}], IdentificationNumbers=[{"IdentificationType":"ABC","IDNumber":"1234"}], BankDetails=[{"BankdetailsID":"0001","BankNumber":"210","BankAccount":"12345","BankCountry":"DE","BankAccountName":"Hardcoded bank account"}], Addresses=[{"AddressType":"1","PhysicalAddresses":[{"HouseNumber":"40","City":"Berlin","PostalCode":"1333","CountryKey":"DE","Street":"BLA"}]}]}}}

Some " " where removed and some remains.

Any help appreciated, I'm lost and most probably making silly mistake.

Upvotes: 2

Views: 808

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Most likely you are printing a string concatenation, behind the scenes the JSON is probably fine: https://github.com/intuit/karate#print

Otherwise, impossible to tell from what you have provided. Maybe you should follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Upvotes: 1

Related Questions