Is it possible to access more than 255 columns of Datasource (Excel) using Coded UI, currently I am using VSTS 2013 and found that Coded UI is not able to access more than 255 columns from the DataSource. Is there a way to overcome this limitation? I don't want to split my test case in two parts, also I have to use Excel as DataSource.
One possibility is to include delimited fields within the Excel cells. I normally use CSV ("comma" separated values) for the data source file but the conversion to and from an Excel spreadsheet is easy. A simple example with pipe (
|) delimited field within the CSV would be:
Here five CSV (Excell) cells are separated by commas. Two of them have pip delimited sub-fields. Giving nine fields in total.
To use the above fields you might do something like:
string SFC = TestContext.DataRow["SFC1|SFC2|SFC3"].ToString().Split('|'); string SFD = TestContext.DataRow["SFD-3"].ToString().Split('|'); string ValueOfFieldA = TestContext.DataRow["SFD-3"].ToString(); string ValueOfSFC2 = SFC; string ValueOfSFD3 = SFD;
Using a field name like
SFC1|SFC2|SFC3 may be useful for documentation, but naming all the subfields may be excessive. Having a shorter field name such as
SFD-3 gives the hint that three fields are expected.
Note that the array indexing in
SFD should probably be preceded by a check that the elements actually exist.