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

Problem in Data driven Testing

1 Answer 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 13 Oct 2010, 11:12 AM
Hi,
I am using webaii framework visual studio 2010.I am not using webUI .

Scenario: We have a login screen where we need to pass different username and password from Excel.Below is my code:
 [DeploymentItem("Spaxassignment\\kumarEditagain.xlsx"), DataSource("System.Data.Odbc", "Dsn=Excel Files;dbq=|DataDirectory|\\kumarEditagain.xlsx;defaultdir=C:\\Program Files\\Telerik\\WebAii Testing Framework 2010.2;driverid=1046;maxbuffersize=2048;pagetimeout=5", "Sheet1$", DataAccessMethod.Sequential), TestMethod]
        public void ApplicationTab()
        {           
            Settings mySettings = new Settings(BrowserType.InternetExplorer, @"D:\Spax\Log\");
                   Manager myManager = new Manager(mySettings);
                      myManager.Start();
            myManager.LaunchNewBrowser();
            myManager.ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.Cookies);
            myManager.ActiveBrowser.NavigateTo("http://10.10.208.110/Cockpik/login.aspx");
            HtmlForm form = myManager.ActiveBrowser.Find.ByName<HtmlForm>("form1");
            HtmlInputText usernamefield = form.Find.ById<HtmlInputText>("txtUsername");
            HtmlInputPassword passwordField = form.Find.ById<HtmlInputPassword>("txtPassword");
            HtmlInputSubmit submit = form.Find.ById<HtmlInputSubmit>("Button1");
            string Username = TestContext.DataRow["Username"].ToString();
            string Password = TestContext.DataRow["Password"].ToString();
            usernamefield.Text = Username;
            passwordField.Text = Password;
            submit.Click();
}

By executing the above code   browser opens for every set of username and password because for each iteration a new manager instance is creating and navigating to the site.
My requirement is for the first time browser should open and for the remaining Iterations the same browser should be used. 
Please Let me know the solution.

Thanks
Kumar

 

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 13 Oct 2010, 11:35 PM
Hello Kumar,

Right after creating the mySettings object but before creating the myManager object, add this line of code:

mySettings.RecycleBrowser = true;

Sincerely yours,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Kumar
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or