Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CSV file for input - Specific letter being dropped from data

Status
Not open for further replies.

rjoubert

Programmer
Oct 2, 2003
1,843
US
I am using VB.NET 2010 and Coded UI Tests. I am using CSV files for input to my test methods. For one particular field in my CSV file, I am passing a string of letters and numbers. For some odd reason, the code is dropping the capital S from this field when it pulls in the value. I have not tested every possible combination of a preceeding number/letter and the capital S, but it only seems to be happening when it is preceeded by a 1 (one). I have tested every other letter in place of the S, and there are no issue with the other letters. The code is only converting the field value to a string.

Does anyone have any ideas?

Thanks...
 


hi,

Can you post the string that is being parsed incorrectly?

What method are you using to parse?

Please post the relevent code.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Here is an example of the string: 19991S12345

With Coded UI Tests, you just select the CSV file through the Data Connection wizard (when setting the Data Connection String property of the test method).

The only thing I do is pass in the values from my CSV file to some custom methods/functions. So I would pass this in:

Code:
TestContext.DataRow("MyFieldName").ToString

There is nothing in my custom methods/functions that manipulate the value. When I debug, before I even go into any custom methods/functions, I print the value of the code above to the immediate window, and the S is gone.

A colleague of mine was thinking it could be some weird escape character.
 

So this this the ONLY STRING in the row, nothing else to parse and no other rows?

Or are there many rows and other items to parse in the row?

I am particularly interested in the data in this COLUMN that preceeds this row.

Exactly what row is this example from?



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Here is the entire CSV file...the offending value is the VIN field.

TestNumber,TransactionCode,VehicleType,TitleNumber,VIN,VehicleYear,VehicleMake,DateEntered,TitleSearchString,FlagAsJunk
1,TL_JUNK_FLAG,PASSENGER,,19991S12345,,,,,1
 
When I parse this string using the COMMA delimiter I get...
[tt]
1
TL_JUNK_FLAG
PASSENGER
[highlight]
19991S12345
[/highlight]




1
[/tt]
So does YOUR parse result in
[tt]
1
TL_JUNK_FLAG
PASSENGER
[highlight]
1999112345
[/highlight]




1
[/tt]
or does it SPLIT that VIN value?



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I am getting back one string, with the S dropped out...
1999112345
 
If you import into Excel, does the "S" stay or does it get dropped there, too?

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
The S stays there when I import into Excel. The only way we've found to get around this is to make it a lowercase s in the data file and do a .ToUpper on the value. So don't worry about putting too much time and effort into this. I was just hoping someone would know something off the top of their head that would explain this odd behavior. Thank you both for your efforts.
 
I figured out the issue, in case anyone else ever runs into the same problem. You have to create a schema.ini file to force every column to be treated as text. I found out it was actually treating one of my columns as currency. Maybe it considered the capital S to be a dollar sign.

More info on the schema.ini...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top