Problem in using the external data

3 posts, 0 answers
  1. Meher
    Meher avatar
    6 posts
    Member since:
    Mar 2014

    Posted 04 Mar 2014 Link to this post


    I am using Test studio plug in Visual studio 2010 and I am facing below problems

    1. When I converted test to C# code using MSTest framework, I am unable to sync it with the test. i.e. when I add new step it is not being synced in C# code
    2. I am unable to use the Data object in generated C# code. I have data in excel and made data binding.
    3. In the test when use the coded step
    ​ [CodedStep(@"Enter text 'Meher' in 'TxtEnquiryFormNameText'")]
    public void WebTest1_CodedStep1()
    // Pages.x2003FREIGHTERDROPDECKFor.TxtEnquiryFormNameText.Text = Data["Name"].ToString();

    string Name = GetExtractedValue(Data["Name"].ToString()).ToString();
    Actions.SetText(Pages.x2003FREIGHTERDROPDECKFor.TxtEnquiryFormNameText, Name);

    I am facing error and the log reads as below

    Failure Information: ~~~~~~~~~~~~~~~Exception thrown executing coded step: '[WebTest1_CodedStep1] : Enter text 'Meher' in 'TxtEnquiryFormNameText''.InnerException:System.ArgumentException: The extracted variable 'Name' does not exist in the store. Make sure there is an extract step that has executed before executing this step. at ArtOfTest.Common.Design.Extensibility.ExtractionDataStore.GetValue(String name) at
    ArtOfTest.WebAii.Design.BaseWebAiiTest.TestData.get_Item(String column) at Test_Automation_framework.WebTest1.WebTest1_CodedStep1() in c:\users\msrirangam\documents\visual studio 2010\Projects\Test Automation framework\Test Automation framework\WebTest1.tstest.cs:line 84-----------------------

    Please help

  2. Daniel Djambov
    Daniel Djambov avatar
    74 posts

    Posted 10 Mar 2014 Link to this post

    Hi Meher,

    Here are the answers to your questions:
    1. Unfortunately there is currently no option to synch between the .tstest and the generated unit test. Generation is performed one time, so if you make changes to the .tstest test you have to generate a new unit test to have the changes included in the newly generated MS unit test

    2. This is correct - you are unable to use the Data object in the generated unit test - the generated test extends the class BaseTest, which does not support Data object - it is available in BaseWebAiiTest, which is not available in the unit test. However you can still use and work with the data from the external file, but not through the Data[] object, but from TestContext.DataRow[]

    3. The answer is the same as from point 2 - you don't have GetExtractedValue method in the unit test, but you can use instead a simple assign to a variable from the data source:
    string Name = TextContent.DataRow["Name"].ToString();

    The above suggestions should make your code work fine - please try it and let me know if you face any other issues.

    Daniel Djambov
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Meher
    Meher avatar
    6 posts
    Member since:
    Mar 2014

    Posted 10 Mar 2014 in reply to Daniel Djambov Link to this post

    Hi Daniel,

    Thanks, that worked for me.

Back to Top