Ask a Question

Expected value: [null]; Actual value: []

Occasional Contributor

Expected value: [null]; Actual value: []

My xpath assertion is failing with: Expected value: [null]; Actual value: []


The Expected value is blank (coming from Excel) and I have other Expected values that are blank and do not return this fail.


Any idea how to fix this?



Community Hero

Hey @lydeeea,

This is definitely xpath, not jsonpath, right? Reason i ask is that null is a jsonpath primitive datatype, whereas it'a not for xpath.

If definitely xpath, then im moving onto the next point.

Youre sourcing your data from .xls / .xlsx and im guessing without further info and considering youre saying that you have equivalent tests that dont fail with this issue youre seeing, then logic suggests the issue is likely being caused by the Excels datatype function on the cells.

Have a look at the datatype of the cells that source your working tests and compare with the datatypes of the cells sourcing the data for your failing tests. Its likely youve got inconsistent datatypes causing the behavior youre seeing.

HOWEVER! There is an additional complication. There is a known Excel defect where changing the datatype of a cell AFTER text has already populated the cell with data doesnt actually change the datatype properly.

So! I would suggest either 2 options to try and fix this issue.

Recreate the spreadsheet, HOWEVER, if you copy the content from the existing spreadsheet youll also copy the problematic datatype from the existing spreadsheet....essentially causing the same problematic behaviour youre seeing. So either recreate the spreadsheet by hand, but before typing or copying in any content, change the datatype for all the cells BEFORE copying/typing in any data. You could, if youre going to recreate the spreadsheet, change the datatypes of the spreadsheet first, then copy the data from the original spreadsheet, paste the data into a notepad file (which will strip out any formatting/datatype settings/markup) and then paste from the notepad into the new spreadsheet.....this will make sure youre not copying and pasting the incorrect datatypes.

OR.....this is what id do. I NEVER use spreadsheets for ReadyAPI! ....the problem with Excel formatting along with other complications is why ive learned to NEVER bother with them. I always use .csv files, which dont support control characters/datatypes/markup, but do have the advantage you can edit the files in Excel.

Id recreate the spreadsheets as .csv's. Im guessing thatll fix the problem.

Sorry for the lengthy email!


if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Showing results for 
Search instead for 
Did you mean: