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 |
Script is not executed when ‘Nunit’ item is added to ‘Unit Test Project’
Please find below steps
9. Script is not at all executing and not even browser is invoked
Sample Script:
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 ArtOfTest.WebAii.Win32.Dialogs;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
using NUnit.Framework;
using Core = NUnit.Core;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Sampe1
{
/// <summary>
/// Summary description for TelerikNUnitTest1
/// </summary>
[TestFixture]
public class TelerikNUnitTest1 : BaseTest
{
#region [Setup / TearDown]
/// <summary>
/// Initialization for each test.
/// </summary>
[SetUp]
public void MyTestInitialize()
{
#region WebAii Initialization
Initialize(false, new TestContextWriteLine(Console.Out.WriteLine));
#endregion
}
[TearDown]
public void MyTestCleanUp()
{
#region WebAii CleanUp
// Shuts down WebAii manager and closes all browsers currently running
this.CleanUp();
#endregion
}
[TestFixtureTearDown]
public void FixtureCleanup()
{
ShutDown();
}
#endregion
[Test]
public void SampleWebAiiTest()
{
// Launch a browser instance
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
// Navigate the active browser to www.wikipedia.org
ActiveBrowser.NavigateTo("http://www.wikipedia.org/");
// Find the wikipedia search box and set it to "Telerik Test Studio";
Find.ById<HtmlInputSearch>("searchInput").Text = "Telerik Test Studio";
// Click the search arrow button
Find.ByName<HtmlInputSubmit>("go").Click();
// Validate that search contains 'Telerik Test Studio'
// Assert.IsTrue(ActiveBrowser.ContainsText("Telerik Test Studio"));
//Read more here:
//http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/intermediate-topics/element-identification/finding-page-elements.aspx
}
}
}
Please guide me how to run script using Nunit(Telerik Test Framework) in 'Unit Test Project'
//Get the mandatory field: family namevar familyName = Client.Browser.Find.ByAttributes<HtmlInputText>("id=FamilyName");//Enter some textClient.Browser.Actions.SetText(familyName, "Chrome and Firefox problems");//Trigger a bunch of jquery events that indicate the control has changedfamilyName.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnChange);familyName.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.keydown);familyName.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.keyup);familyName.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.keypress);familyName.AsjQueryControl().InvokejQueryEvent(jQueryControl.jQueryControlEvents.change);