Forum Discussion
I am not using any groovy scripts and not interested in writing any at this point.
All we need to do is use an Excel spreadsheet as a Datasource. We have operational JSON and
several fields are set to variables to be populated with the values in the Excel spreadsheet.
My question is HOW do I enter a NULL into the Excel spreadsheet so SoapUI NG Pro inserts that
value into my JSON without quotes?
My JSON has "field": "${DataSource#fieldvalue}",
My desired outcome after the DataSource is read in and populates my JSON is:
"field": NULL,
How to I enter the NULL into the Excel spreadsheet so this works? I have tried many variations and nothing works.
I have this REST Service call ‘Spreadsheet into Composition’ that I feed with an Excel spreadsheet DataSource2. I added the Groovy Script ‘Convert NULLS’ inline. Below is the Groovy Script.
“Convert NULLS – Groovy Script”
def dataSource2GlobalPartnerSBCId = context.expand( '${#TestCase#DataSource2#GlobalPartnerSBCId}' )
def globalPartnerSBCId = context.expand( '${#TestCase#GlobalPartnerSBCId}' )
def nullValue
if ("null" == dataSource2GlobalPartnerSBCId || !dataSource2GlobalPartnerSBCId) {
context.testCase.setPropertyValue ('globalPartnerSBCId', nullValue)
}
log.info context.testCase.getPropertyValue('globalPartnerSBCId')
Can you tell me why the field ‘'globalPartnerSBCId'’ in my JSON is not getting set properly to NULL?
JSON: the excel spreadsheet has a value = NULL.
{"SBCCommunicationDetails": [{
"CompassionSBCId": "C0028902042",
"GlobalPartnerSBCId": "NULL",
"SourceSystem": "SDL",
Related Content
- 5 years agompartyka
- 8 years agoJBARRETT5S
- 2 years agovericomms