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

NUnit -Data Driven Using Excel

1 Answer 269 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vidya
Top achievements
Rank 1
Vidya asked on 01 Jul 2013, 09:57 AM

I am using ‘Telerik Test Framework’(NUnit Template) with VSTS 2012.

Please help me how to do parameterization using Excel in ‘NUnit’ template. If you provide me step by step guide or Video will be great help.


My Sample Code look like this:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using ArtOfTest.WebAii.Controls.HtmlControls;

using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;

using ArtOfTest.WebAii.Core;

using ArtOfTest.WebAii.ObjectModel;

using ArtOfTest.WebAii.TestAttributes;

using ArtOfTest.WebAii.TestTemplates;

using NUnit.Framework;

using Core = NUnit.Core;

namespace UnitTestProject1{

[TestFixture]

Public class TelerikNUnitTest1 : BaseTest

{

[Test]

Public void testmethod1()

{

Manager.LaunchNewBrowser(BrowserType.InternetExplorer);

 ActiveBrowser.NavigateTo("http://www.Anaqal.com");

 Find.ByXPath<HtmlInputText>("//input[@type='text' and contains(@name, 'EmailAddressTextBox')]").Text = "admin@ana.com";

Find.ById<HtmlInputPassword>("ctl00_ctl00_PageContentPlaceHolder_PageContentPlaceHolder_PasswordTextBox").Text = "Admin1";

}

}

}

I wants to parameterized ‘Email Address’ and ‘Password’ field with multiple data

My Excel sheet contains data like this

EmailAddress Password
Test1@ana.com Pwd123
Test2@ana.com pwd456



1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 01 Jul 2013, 10:34 AM
Hi Vidya,

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 you need first to 
Bind the test to an external data source and then write the code in a coded step:

// You can reference the column by index
Pages.Google.QText.Text = (string)Data[0];

// Or by name
Pages.Google.QText.Text = (string)Data["Numbers"];

Hope this helps.

Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Vidya
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or