How to format JSON in a string parameter?


I am still new to Katalon and I am trying to convert a mutation that I tested using GraphiQL interactive UI into a test case.

I am failing on inputting the JSON property as a string:

Here is my local query:

mutation diagnosisSet($patientId: ID!) {
  diagnosisSet(patientId: $patientId, cancerTypeName: "name", description: "some description", diagnosisStatus: "{\"histology\":\"\",\"tnm\":\"\",\"additionalDiagnoses\":[{\"title\":\"Relapse\",\"description\":\"Test without recordedOn\"}]}") 
  { id, description, patientId, diagnosisStatus } 

and here is the same in katalon:

// Test with no date on child recordOn field
response = WS.sendRequest(findTestObject('tachi/mutation/diagnosisSet', [('env_url') : GlobalVariable.env_url, ('token') : token
	, ('patient_id') : patient_id, ('name') : "Some unique name", ('description') : "Simple Test", ('event_date') : null
	, ('diagnosis_status') : '{"histology":"","tnm":"","additionalDiagnoses":[{"title":"Relapse","description":"Test without recordedOn"}]}']))

This code fails with:

2020-03-03 11:16:26.046 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/Tachi/WithOnePatient/TestDiagnosisMutations FAILED.
java.lang.IllegalArgumentException: Text must not be null or empty

Any pointer welcome.

Hi @eric.rajkovic

Please post the entire log, it’d help to see if the problem is actually elsewhere.

Will try to get more details - I am getting another unrelated error today, which I need to handle before to get back to my specific mutation use case.

1 Like