Closed ejfrancis closed 7 years ago
This is interesting: I added another test below that initial POST test that fails, and now they both work fine
@ejfrancis thanks for reporting this, actually for POST, PUT etc - the 'request' keyword has to be used as the payload is mandatory. I just added an error message to make it more clear.
... and if the intent was to have an 'empty' body, you can always do:
Given request ''
When method post
Then status 201
Can you confirm that things look ok with the latest released version 0.1.4 ?
@ptrthomas yup that works fine, thanks for the clarification
or send json with body: {}, it worked for me
@ptrthomas for POST, PUT etc - the 'request' keyword has to be used as the payload is mandatory. Can you please provide an example as i am facing the same issue
@palakjainq I think the comments above answers your question so read them again. else, please use stack overflow: https://stackoverflow.com/questions/tagged/karate
@ptrthomas
Even on using 'request' keyword as payload , i am getting null pointer exception for below request:
[ { "id":
{ "partyId":'
{ "partyId": '
{ "partyId": '
Feature: test criteria of View Enforced Sale Limits API
Background:
@MerchantLevel Scenario Outline: Set 1 Day Enforced Sale - merchant
def date = CommonUtility.getCurrentDate("YYYY-MM-DD")
set reqJson[0].id.partyId = '
set reqJson[0].saleLimit =
set reqJson[0].saleStartDateTime = date
set reqJson[0].saleEndDateTime = date
set reqJson[1].id.partyId = '
set reqJson[1].saleLimit =
set reqJson[1].saleStartDateTime = date
set reqJson[1].saleEndDateTime = date
set reqJson[2].id.partyId = '
set reqJson[2].saleLimit =
set reqJson[2].saleStartDateTime = date
set reqJson[2].saleEndDateTime = date
Given path 'merchantEnforcedLimits'
And path '
com.intuit.karate.exception.KarateException: testcriteria_enforcedsalelimit.feature:30 - status code was: 500, expected: 200, response time: 974, url: http://localhost:8080/merchantEnforcedLimits/000000000000330?userid=yesgate, response: {"timestamp":"2020-01-09T06:51:47.314+0000","status":500,"error":"Internal Server Error","message":"No message available","trace":"java.lang.NullPointerException\r\n\tat com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:324)\r\n\tat com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1066)\r\n\tat com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1045)\r\n\tat com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:248)\r\n\tat com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:130)\r\n\tat com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:360)\r\n\tat com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)\r\n\tat com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:341)\r\n\tat com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)\r\n\tat com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)\r\n\tat com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:256)\r\n\tat javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:116)\r\n\tat com.worldpay.wpt.yesgate.commons.ReplicationHelper.entityToXMLConverter(ReplicationHelper.java:70)\r\n\tat com.worldpay.wpt.yesgate.commons.ReplicationHelper.saveReplicationEntity(ReplicationHelper.java:57)\r\n\tat com.worldpay.wpt.yesgate.services.EnforcedLimitsService.updateAuditEvents(EnforcedLimitsService.java:163)\r\n\tat com.worldpay.wpt.yesgate.services.EnforcedLimitsService.upsertEnforcedLimitsList(EnforcedLimitsService.java:145)\r\n\tat com.worldpay.wpt.yesgate.controller.EnforcedLimitsController.updateEnforcedLimitForMerchant(EnforcedLimitsController.java:105)\r\n\tat com.worldpay.wpt.yesgate.controller.EnforcedLimitsController$$FastClassBySpringCGLIB$$be3da62e.invoke(
I'm able to make PATCH requests to the endpoint via PostMan just fine.Even with karate ,sometimes the above script works and other times experience null pointer exception
@palakjainq sorry I'm not going to read all of this. please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
This works fine
But when I change the method to post
I get this NullPointerException
I'm able to make POST requests to the endpoint via PostMan just fine