This is a migrated thread and some comments may be shown as answers.

How to read data from a file using framework and Visual Studio

9 Answers 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chunks
Top achievements
Rank 1
Chunks asked on 31 Oct 2013, 10:09 PM
HI All,

I am working on creating data driven tests , need to read entries from an excel file. How should I proceed? Please advise

Thanks!

9 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 2
answered on 01 Nov 2013, 08:05 PM
Are you asking how to actually open and read from the Excel file (coded step) to create data driven tests, or if the Excel file is binded to a test how to use the column values for data driven tests?
0
Chunks
Top achievements
Rank 1
answered on 01 Nov 2013, 10:34 PM
Hi Daniel,

Option 2
0
Daniel
Top achievements
Rank 2
answered on 04 Nov 2013, 01:20 PM
If you have already bound the Excel file, here is how you would attach those columns to input values: http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/attach-columns-to-input-values.aspx

or for verifications: http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/attach-columns-to-verifications.aspx

If you are working in a coded step, you can still access the bound data by using the following format "Data["Col1"].ToString()" where "Col1" is the name of the column in the Excel file.

If you are looking for something more specific please let me know.

*EDIT*

I know the links show more of Test Studio than the VS plugin, however just look at the Element explorer portion and properties of the step.  Process is the same.
0
Mario
Telerik team
answered on 05 Nov 2013, 10:14 PM
Hi Chunks,

The documentation pages linked by Daniel should answer your questions with regards to data driving tests in Test Studio, thanks for providing those in your last response Daniel.

If either of you have any additional questions please let me know.

Regards,
Mario
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Chunks
Top achievements
Rank 1
answered on 07 Nov 2013, 09:33 PM
Hi Daniel & Mario,

Thank you, for the assistance, I am going through the links , but I am having some issues binding an excel file to a test, could you suggest an approach?

ps : I am using telrik framework , nunit , and VS 2012
Thank you in advance,
Chunks
0
Daniel
Top achievements
Rank 2
answered on 08 Nov 2013, 01:25 PM
The following article shows you how to add a datasource (using both Test Studio and the VS plugin): http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/add-a-data-source.aspx

The following article shows you the how to bind a test to a datasource (using both Test Studio and the VS plugin): http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/bind-test-to-data-source.aspx

Do these help out?  If not, please provide some more details where you are getting tripped up at?
0
Mario
Telerik team
answered on 12 Nov 2013, 08:36 PM
Hi Chunks,

If you are using the free Telerik Testing Framework and Visual Studio, you will need to follow their directions for creating a data driven test.

If you are using Test Studio and want to implement data driven testing, you can follow Daniel's directions from his last two posts.

Regards,
Mario
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
vishnu
Top achievements
Rank 1
answered on 25 Nov 2014, 10:51 AM
Can you please help me how to add coded step for reading or writing data from Excel? Thanks.
0
Ivaylo
Telerik team
answered on 28 Nov 2014, 07:15 AM
Hello Vishnu,

Here is an article on how you can read from excel file. Please check here on writing in excel.

Note: Ensure you Add an Assembly Reference to Microsoft.Office.Interop.Excel. You can download a version of that file on Microsoft's website that matches your version of MS Office.


Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Chunks
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 2
Chunks
Top achievements
Rank 1
Mario
Telerik team
vishnu
Top achievements
Rank 1
Ivaylo
Telerik team
Share this question
or