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

Problem in using the external data

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Meher
Top achievements
Rank 1
Meher asked on 05 Mar 2014, 04:04 AM
Hi

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

Thanks
Meher

2 Answers, 1 is accepted

Sort by
0
Daniel Djambov
Telerik team
answered on 10 Mar 2014, 09:35 AM
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.

Regards,
Daniel Djambov
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Meher
Top achievements
Rank 1
answered on 10 Mar 2014, 08:05 PM
Hi Daniel,

Thanks, that worked for me.

Regards
Meher
Tags
General Discussions
Asked by
Meher
Top achievements
Rank 1
Answers by
Daniel Djambov
Telerik team
Meher
Top achievements
Rank 1
Share this question
or