Data driven test using parameters from excel

6 posts, 0 answers
  1. Saket
    Saket avatar
    22 posts
    Member since:
    Sep 2011

    Posted 17 Jan 2012 Link to this post


    Hi,
     
    I have written a set of test which get exceuted using webii and VSTS (C# .net). I need to implement he following in code

    1. The test should be repetable : I must be able to execute the same test n number of times (where n indictaes the number of run -can be preset)
    2. Diffrent input for each run: I should be able to access a excel file from which i can have the inputs that are required for running the test e.g data values.

    I went through this link http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/add-a-data-source.aspx#Excel  however wanted to implement the same in code.

    Help appreciated...

    Thanks!!
     
  2. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 17 Jan 2012 Link to this post

    Hi Saket

    You can write Coded Step for that, I hope you Know How to Write Coded Steps

    Go through the Section

    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/coded_steps.aspx
    Also You can access the Data Like that using Code Steps
    // You can reference the column by index

    Pages.Google.QText.Text = (string)Data[0];

    // Or by name

    Pages.Google.QText.Text = (string)Data["Numbers"];


    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/local-data-driven-test.aspx

  3. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 17 Jan 2012 Link to this post

    Hello Saket,

    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 in code, you can follow Nitin's directions. They are exactly right (thanks Nitin).

    @Nitin, I've granted you Telerik Points for assisting.

    Regards,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 18 Jan 2012 Link to this post

    Hello Cody
    Thanks for granting Telerik Points :)

    Saket, I hope this helps

    Thanks
    Nitin

  5. Nawaz
    Nawaz avatar
    1 posts
    Member since:
    Jan 2013

    Posted 15 Mar 2013 Link to this post

    Hello Nithin,

        With your suggested approach. I am able to access the first row of the local data but not the second item.
        Please let me How can I access the second and all rows after using code.
        Help appreciated

    Regards
    Nawaz Ahnmed
  6. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 20 Mar 2013 Link to this post

    Hello Nawaz,

    I am sorry to hear you are experiencing this issue. This is quite strange since once you specify the column all the data in it should be used. I am not able to reproduce such a behavior. Could you please create a sample project lets say towards Google where the issue is reproduced and send it over for further investigation.

    Regards,
    Ivaylo
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top