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

10 posts, 0 answers
  1. Chunks
    Chunks avatar
    17 posts
    Member since:
    Nov 2011

    Posted 31 Oct 2013 Link to this post

    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!
  2. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 01 Nov 2013 Link to this post

    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?
  3. Chunks
    Chunks avatar
    17 posts
    Member since:
    Nov 2011

    Posted 01 Nov 2013 Link to this post

    Hi Daniel,

    Option 2
  4. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 04 Nov 2013 Link to this post

    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.
  5. Mario
    Admin
    Mario avatar
    8 posts

    Posted 05 Nov 2013 Link to this post

    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
  6. Chunks
    Chunks avatar
    17 posts
    Member since:
    Nov 2011

    Posted 07 Nov 2013 Link to this post

    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
  7. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 08 Nov 2013 Link to this post

    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?
  8. Mario
    Admin
    Mario avatar
    8 posts

    Posted 12 Nov 2013 Link to this post

    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
  9. vishnu
    vishnu avatar
    3 posts
    Member since:
    Aug 2011

    Posted 25 Nov 2014 in reply to Daniel Link to this post

    Can you please help me how to add coded step for reading or writing data from Excel? Thanks.
  10. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 28 Nov 2014 Link to this post

    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
     
Back to Top