data binding fetch/point a specific row to the application value

6 posts, 0 answers
  1. Veera
    Veera avatar
    25 posts
    Member since:
    Jul 2010

    Posted 09 Dec 2010 Link to this post

    Hi
    After loading the excel (input data) using data binding,  my intention is to get the specifc row item in the data binded excel multiple times.
    here is the business scenario.

    Login as user1 and perform some actions /test
    Login as user2 and perform some actions /test
    Login as user1 and perform some verifications.

    all my users are stored in the excel file which is data binded.
    to be specific "how to fetch/point a desired row to the application value."

    Thanks,
    Veera
  2. Nikolai
    Admin
    Nikolai avatar
    85 posts

    Posted 10 Dec 2010 Link to this post

    Hi Veeraraghavan,

    You can access all the loaded data using the ExecutionContext property of the test:

    [CodedStep(@"Get Data")]
            public void WebAiiTest1_CodedStep()
            {
                var row = this.ExecutionContext.ActiveDataRows[1];
                var dataString = row["Col1"];
            }

    You can traverse the Data Set and find the user data you are looking for.
    CodedStep(@"Set Text'")]
            public void WebAiiTest1_CodedStep()
            {
                var row = this.ExecutionContext.ActiveDataRows[1];
                var dataString = row["Col1"];
            }
    [CodedStep(@"Get Data")]
    public void WebAiiTest1_CodedStep()
    {
        var row = this.ExecutionContext.ActiveDataRows[1];
        var dataString = row["Col1"];
    }
    [CodedStep(@"Get Data")]
    public void WebAiiTest1_CodedStep()
    {
        var row = this.ExecutionContext.ActiveDataRows[1];
        var dataString = row["Col1"];
    }

    Hope this helps.

    Regards,
    Nikolai
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  3. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 10 Dec 2010 Link to this post

    Hello Veeraraghavan,

    There is another approach that would avoid having to go to code and looking up records in the datasource. If you structure your tests the right way you can data bind everything and achieve your test cases:

    1. Create two main login tests, MainTestA & MainTestB. These tests only login in the user. Databind these tests to your excel spreadsheet
    2. Create two subtests. SubTestA performs the actions and assume the user is already logged in. SubTestB performs the verifications and assume the user is already logged in. These tests can either use the same excel file as the main test, or you can databind them to separate excel files. If you use a different excel file the subtest will execute all the rows in the excel file before returning to the main test.
    3. Modify MainTestA to call SubTestA via Test-as-step feature. After calling the subtest add steps to logout the user.
    4. Modify MainTestB to call SubTestB via Test-as-step feature.After calling the subtest add steps to logout the user.
    5. Create a test list - EndToEndTestListA. Add MainTestA and MainTestB to it.

    Now when you run EndToEndTestListA it will execute in this manner:
    1. MainTestA will begin execution. It will run for all the rows in the login excel file. For each row it will call SubTestA to perform the same actions for each user. If SubTestA has a separate data file it will run all the rows in that datafile before returning to MainTestA.
    2. When MainTestA is done executing MainTestB will begin executing. It will run in the same manner as MainTestA except it will call SubTestB instead of SubTestA

    Will this approach work for you?

    All the best,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  4. Veera
    Veera avatar
    25 posts
    Member since:
    Jul 2010

    Posted 10 Dec 2010 Link to this post

    Hi Nikolai,
    I think this should help us... I will try this and let you know.  Thanks!!!

    On the other note: is there anyways update the same databound excel with values retrieved from the application or mark it pass or fail certain dataverification test. It would be of great help if we can do that on the fly with the code!

    This is also need for us..

    Thanks.
    Veera
  5. Veera
    Veera avatar
    25 posts
    Member since:
    Jul 2010

    Posted 10 Dec 2010 Link to this post

    Hi Cody,
    Yes I almost go an idea from this approach. Hope this will also help us in certain scenarios thanks!

    Cheers,
    Veera
  6. Veera
    Veera avatar
    25 posts
    Member since:
    Jul 2010

    Posted 26 Jan 2011 Link to this post

    Hi Cody,
    We created a custom function to read /write the values to the excel. So we do not want to depend on iteration... anyways thanks for the info!!
    Also Mark this as closed/answered!!!

    Thanks,
    Veera



Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!