Friday, August 20, 2010

Unable to pass date value dd/mm/yyyy through csv file data binding in the webtest.

Hi,

I am using CSV file for data binding in my Webtest.
I have to pass the date value in this format dd/mm/yyyy, through csv file.
I am using excelsheet and then i am saving this file into .CSV format.
When i am adding this file as a data source,all the data rows displayed correctly.
But the date values displayed in the format m/dd/yyyy,which is not acceptable by the application.
How i can change CSV file date format from m/dd/yyyy to dd/mm/yyyy?
---------------------------------------------------------------------
If I may offer a suggestion to determine where the problem lies...

Instead of using a CSV file for the Date of Birth, create a Context Parameter called DOB and give it a value of 15/05/1987. Use the context parameter in place of the data bound parameter to see if it is translating it the same way (with Date & Time) or as you expect it to (dd/mm/yyyy).

If it work this way, you may need to force a format of the data from the CSV file. I would suggest that you look at the UKVSTS Web Test Plugin (http://www.codeplex.com/UKVSTS/Wiki/View.aspx?title=UKVSTS%20Web%20Test%20Plug%20In&referringTitle=Home). This might help.

Good luck.
----------------------------------------------------------------
Hi,

Thanks for your reply.

I have tried following options:

1. ctl00$ContentPlaceHolder1$ClientDetailControl$TextBoxDateOfBirth= <%= DateTime.Now.ToString ("15/05/1987") %> ,I have used same thing which has given in the UKVSTS.script is passing.

But when i tried to pass date values through .csv in this script variable again i was getting date and time.I have used dd/mm/yyyy format in the .csv.

2.ctl00$ContentPlaceHolder1$ClientDetailControl$TextBoxDateOfBirth=

<%= DateTime.Now.ToString ("{{DataSource1.DateValue#csv.DOB2}}") %>

getting same error.

I have used script parameter not context parameter...can you explain how i can create context parameter?
================================================================
I believe that you have misinterpreted the examples provided for the plugin by using the DateTime.Now.ToString function. I believe that what you should be doing is this:

<%= String.Format("{0:dd/MM/yyyy}", DateTime.Parse({{DataSource1.DateValue#csv.DOB2}}))) %>

(Note: I may be missing a paren or curly brace somewhere)

Good luck.

======================================================
Thanks Lewis,

It is working fine.

Thanks,

Bhawana

Unix/Linux Commands

  Flow control Syntax break Exit a loop. continue Exit the current iteration of the loop and proceed with the next iteration. Ctrl+C Key com...