Friday 3 July 2015

Methods to Create CSV File to Pass Parameter in CodedUI and to integrate in code

Content:

1.      Create Test and Set Data

A.     Create Record and Assertion method

B.      Move Created methods from UIMap.Designer to UIMap.vb file

C.      Create CSV file

D.     Change Property settings for CSV file

E.      Add parameter values

F.       Save the CSV file through Advanced Save option

2.      Pass the input parameter from CSV file to Recorded Method

A.     Create Data source.

B.      Find Text value

C.      Assign the CSV file value to Text value in main method

3.      Pass the Expected value from CSV file to Assertion Method

A.     Declare data as string for assign the CSV file value

B.      Create object for the main class

C.      Call the data through the object

D.     Pass the data to Expected values

1-A : Record and Playback method created for

1, Login as User

2, Check Assertion for Username

3, Logout


1-B : Move Method from UI.Designer file to UI.VB file for editing the Method

Double Click on UIMap.uitest -> Right Click on Method -> Select Move Code to UIMap.cs/vb

1-C : Method for Create CSV file to pass parameter

Right Click on Project -> Add -> New Item

Model Window opened for Add New Item

General -> Text File -> Rename as Sample.csv -> Add
CSV File Got Created under the Project

1-D  : Change the Property Settings for CSV file

Right Click on CSV File -> Properties -> Copy to Output = Copy if newer

1-E,F : Save the CSV File

1, create the Parameter and Pass the value

2, Go to File -> Select Advanced Save Option -> Select Unicode (UTF-8 without Signature) – Code Page 65001 -> OK


2-A : Pass CSV file value through Data Source

1, Declare property for Employee name

2, Create Data source

3, Pass Data from CSV file to Property

2-B : Methods to change the Recorded code to pass the Parameter value

GO To Method SubLoginAdmin :

To Verify the Text Value:
2-C : Assigned the value for Username and Password
3 :  Pass the CSV file parameter value as Expected value in Assertion Method:

1, Create object for the class

2, Call the data through the object
3, Pass the Expected value for EmpName from csv file

No comments:

Post a Comment