1

My aim is to skip Time related column from json comparison. I have referred this https://github.com/lukas-krecan/JsonUnit & it helped me a lot but my problem is I have more than one column to be skipped. And the columns which needed to be skipped are in Json file. I am facing issue in getting those value into variable & passing it to JsonAssert.whenIgnoringPaths()

Below is my json file

{
  "Data": 
  [
    {
      "testCaseId": "TC1139",
      "LogID": "1234",
      "ThinkTime": "",
      "DB": "Oracle",
      "skipColumn":["[*].UpdatedTime","[*].CreatedTime"],
      "input":
      {
        "Get":
        [
          "1593478",
          "02C62C82552D444DBF6B69CD07376368",     
        ],

        "Delivery": "City",
        "Date": "I",
        "Column": "dbTCity"       
      }       
    }
  ]
}

how do i get skipColumn into a variable & pass it to

assertJsonEquals(expected,actual,JsonAssert.whenIgnoringPaths(skipColumn));

Please note, below code works fine.

def skip = ["[].updateTime","[].createdTime"] as String[]

assertJsonEquals(expected,actual,JsonAssert.whenIgnoringPaths(skip));

But when it is read from json file. This is not working

Lukas
  • 13,606
  • 9
  • 31
  • 40
shrusthip
  • 85
  • 1
  • 10

0 Answers0