Ask a Question

How to assert the Json schema complaince As I have file only not the URL.

SOLVED
harish3314
Occasional Contributor

How to assert the Json schema complaince As I have file only not the URL.

Hello,

I want to assert the json schema present in a file but in assertions I can only can Json schema URL which I currently don't have.Please let me know if there is any way to assert for Json schema

1 ACCEPTED SOLUTION

Accepted Solutions
aaronpliu
Frequent Contributor

Re: How to assert the Json schema complaince As I have file only not the URL.

Hi harish3314,

 

Add json schema assertion in your REST step and then points to your local Json file.

If you want to add all Json Schema via groovy scripts, then you can try

def addSchemaAssertion(testCase){
    testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class).each{teststep ->
def url = org.apache.xmlbeans.XmlObject.Factory.parse("<swaggerUrl>YourJsonFilePath</swaggerUrl>")
def assertionName = teststep.addAssertion("Swagger Compliance Assertion")
assertionName.setName("Swagger Compliance Assertion")
assertionName.setConfiguration(url)

}
}

 

Regards,

/Aaron

View solution in original post

3 REPLIES 3
aaronpliu
Frequent Contributor

Re: How to assert the Json schema complaince As I have file only not the URL.

Hi harish3314,

 

Add json schema assertion in your REST step and then points to your local Json file.

If you want to add all Json Schema via groovy scripts, then you can try

def addSchemaAssertion(testCase){
    testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class).each{teststep ->
def url = org.apache.xmlbeans.XmlObject.Factory.parse("<swaggerUrl>YourJsonFilePath</swaggerUrl>")
def assertionName = teststep.addAssertion("Swagger Compliance Assertion")
assertionName.setName("Swagger Compliance Assertion")
assertionName.setConfiguration(url)

}
}

 

Regards,

/Aaron

Olga_T
Moderator

Re: How to assert the Json schema complaince As I have file only not the URL.

Hi all,

 

@harish3314, have you had a chance to check the instructions that @aaronpliu provided? Does it work for you?

 


Olga Terentieva
SmartBear Assistant Community Manager

harish3314
Occasional Contributor

Re: How to assert the Json schema complaince As I have file only not the URL.

Yea It worked fine for me

cancel
Showing results for 
Search instead for 
Did you mean: