I tried to read ip (10.10.10.10) from the CSV file the value displays incorrect (10.101)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to read ip (10.10.10.10) from the CSV file the value displays incorrect (10.101)
I am trying to automate the Desktop application reading the data from CSV file in which there i am trying to fetch the ip from CSV file but the value is returned as below mentioned.
Input Value: 10.10.10.10
Expected Value: 10.10.10.10
Actual Value Fetched: 10.101
when I tried with the below workaround solution it works fine.,
Input Value: a10.10.10.10
Actual Value Fetched: a10.10.10.10
I would like to know if there is a way to fetch the ip value from CSV without appending the string.
Regards
Vijay Bhaskar U
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you creating the CSV using Excel?
I seem to recall Excel cell formatting affecting how values are read in by external sources such as TestComplete.
Try formatting the cells as text before saving the CSV. Adding the "a" and it coming out right does suggest that the added "a" causes the content to be treated as text so passed through correctly.
(Or try creating it in notepad instead)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tool is generating the CSV file, which is used as the input source for the Automation. I will be using those values as the input to the application which is read from CSV using DDT CSV Driver.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What tool?
(You really need to give specific information if you want useful answers!)
And try manually creating a CSV yourself (using notepad) and feed it that and see what happens. At least then that will tell you if the problem is the formatting of the CSV by "the tool" (whatever it is) or TestComplete when it reads it in.
All my tests (scripted) are data driven using data read in from an Excel spreadsheet (I don't use the DDT object, I have my own IDE extension modules which effectively form a test framework). I just tried feeding a textbox 10.10.10.10 from my Excel input sheet and it worked perfectly. The Excel cell format is "General" but the 10.10.10.10 being preceeded by "P:" (part of my framework, the "P:" indicates a parameter. It's not part of the actual data it feeds the TextBox) would likely cause Excel to treat it as Text and so not try and apply any crazy number formatting to it (which it would without the "P:").
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just created the CSV manually and tried it gives the same output.
please find the code and CSV file attached
function csv()
{
var FileName = "C:\\Users\\XXX\\Desktop\\testing.csv"
var output= DDT["CSVDriver"](FileName)
while (!output["EOF"]()){
Log["Message"](output["Value"]("test"))
}
DDT["CloseDriver"](output["Name"])
}
Regards
Vijay Bhaskar U
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I click or download that, it comes through as an Excel 2003 .xls file?
What did you create it with? If you created it with Excel, but saved it as a CSV ..... don't. Create it using NotePad.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The text driver is scanning the rows and determining that that column contains numbers and is reading them as numbers. You could try prefacing all entries with an alphabetic character (ie, "x10.10.10.10") and then strip off the 'x' later). Or you could try setting up a Schema.ini file in the same directory to specify the column as text:
[testing.csv]
Col1=test Text
See Using CSV Files as Data Storages for more info.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Think Joseph has cleared this up then. (Thanks Joseph)
It's down to how the TC driver is interpreting it. Sorted.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Joseph, Solution provided by you was already identified and mentioned in my first comment.
Do let me know if i add Schema.ini with that fix without modifying?? If yes, do let me know how to create Schema.ini and use it.
I would like to get the solution which doesnot involve any modification in the csv file since its autogenerated and will be using those csv as the intermediate input.
Regards
Vijay Bhaskar U
