Issue using Excel and variables in name mapping
I am using variables in name mapping objects to pull data from an Excel sheet and then verify with Property Checkpoints.
It is working fine for the first 3 rows in my sheet. But on the fourth row I am getting an error for the address. The previous 3 addresses worked fine. The local variable was updated and checkpoint passed. Also the first four checkpoints for this fourth row of data worked fine, it just fails on the address.
I cannot figure out why this fourth one is failing. Any ideas? Lots of info/screenshots below that will hopefully help.
Name Mapping object using variable:
Project level variable:
Excel sheet with address data:
function ReadManifestData()
{
// Get the sheet of the Excel file
var excelFile = Excel.Open(Project.ConfigPath + "Datasheet.xlsx");
var excelSheet = excelFile.SheetByTitle("ViewData");
// Read data from the Excel file
var RowIndex = KeywordTests.CheckManifestScreen.Variables.RowIndex_KW;
var Order_Num = excelSheet.Cell("A", RowIndex).Value;
var HIN_Num = excelSheet.Cell("B", RowIndex).Value;
var TrackNum = excelSheet.Cell("C", RowIndex).Value;
var Forecasted = excelSheet.Cell("D", RowIndex).Value;
var Street_Addr = excelSheet.Cell("E", RowIndex).Value;
var ServiceLevel = excelSheet.Cell("F", RowIndex).Value;
var Commit_Time = excelSheet.Cell("G", RowIndex).Value;
var Cons_Name = excelSheet.Cell("H", RowIndex).Value;
var Floor_Num = excelSheet.Cell("I", RowIndex).Value;
var Postal_Code = excelSheet.Cell("J", RowIndex).Value;
var City_Name = excelSheet.Cell("K", RowIndex).Value;
var State_Name = excelSheet.Cell("L", RowIndex).Value;
var Country_Code = excelSheet.Cell("M", RowIndex).Value;
var Urbanization = excelSheet.Cell("N", RowIndex).Value;
Project.Variables.Order_Num_KW = Order_Num;
Project.Variables.HIN_Num_KW = HIN_Num;
Project.Variables.TrackNum_KW = TrackNum;
Project.Variables.Forecasted_KW = Forecasted;
Project.Variables.StreetAddr_KW = Street_Addr;
Project.Variables.ServiceLevel_KW = ServiceLevel;
Project.Variables.Commit_Time_KW = Commit_Time;
Project.Variables.ConsName_KW = Cons_Name;
Project.Variables.Floor_Num_KW = Floor_Num;
Project.Variables.Postal_Code_KW = Postal_Code;
Project.Variables.City_Name_KW = City_Name;
Project.Variables.State_Name_KW = State_Name;
Project.Variables.Country_Code_KW = Country_Code;
Project.Variables.Urbanization_KW = Urbanization;
}
Keyword test:
Log:
All, thank you for your responses. I finally uncovered the issue. The issue was some of the data the mock API is returning had spaces in the address field (which was truncated by table so not noticeable when looking at the UI). The data from the UI was copied into the spreadsheet so it didn't have the space. I still don't know why TC didn't log the ER/AR and show that they didn't match but when I updated the mock data to not have spaces, everything worked.