Skip to content

Regression - JSON null matching (1.5.2 -2.0.x) #2820

@ChristianAA

Description

@ChristianAA

Description

  • In Karate 1.5.2 the assertion And match x.x == null succeeded when the response contained a real JSON null.
  • In Karate 2.0.X the same assertion fails
  • A workaround that passes is And match x.x == '#notpresent'.

Steps to Reproduce

Steps

  1. Create a feature with the minimal scenario below.
  2. Run the feature against Karate 1.5.2 and then against Karate 2.0.X.

Minimal reproduction

Feature: null matching regression demo

  Scenario: match real null values
	* def response = { status: 'ERROR_CREATING', user: null, settings: null }
	Then match response.status == 'ERROR_CREATING'
	And match response.user == null
	And match response.settings == null

Expected Behavior

The following worked in 1.5.2:

Then match response.user == null
And match response.settings == null

Actual Behavior

Error message:

Then match response.user == null
  match failed: EQUALS
  $ | actual path does not exist (STRING:NULL)
  '#notpresent'
  null

Karate Version

2.0.6

Java Version

25

Operating System

Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions