Good morning,
I'm a newbie of this product. I try to mke same very simple test and they don't work :-(
My code is that:
The SampleWebAiiTest and SimpleTest goes without a problem but the ComboBoxTest doesn't. It never find the combo and so the combo object is null :-(
Why this things happen? I suppose a browser problem but with Explorer, Firefox and Chrome the problem still remain the same.
Any ideas?
Gianluca
I'm a newbie of this product. I try to mke same very simple test and they don't work :-(
My code is that:
using
System;
using
ArtOfTest.WebAii.Controls.HtmlControls;
using
ArtOfTest.WebAii.Core;
using
ArtOfTest.WebAii.TestTemplates;
using
NUnit.Framework;
using
Telerik.WebAii.Controls.Html;
using
Assert = ArtOfTest.Common.UnitTesting.Assert;
namespace
TelerikTestingFW
{
/// <summary>
/// Summary description for FirstStep
/// </summary>
[TestFixture]
public
class
FirstStep : BaseTest
{
#region [Setup / TearDown]
/// <summary>
/// Initialization for each test.
/// </summary>
[SetUp]
public
void
MyTestInitialize()
{
#region WebAii Initialization
// Initializes WebAii manager to be used by the test case.
// If a WebAii configuration section exists, settings will be
// loaded from it. Otherwise, will create a default settings
// object with system defaults.
//
// Note: We are passing in a delegate to the NUnit's TestContext.Out.
// WriteLine() method. This way any logging
// done from WebAii (i.e. Manager.Log.WriteLine()) is
// automatically logged to same output as NUnit.
//
// If you do not care about unifying the log, then you can simply
// initialize the test by calling Initialize() with no parameters;
// that will cause the log location to be picked up from the config
// file if it exists or will use the default system settings.
// You can also use Initialize(LogLocation) to set a specific log
// location for this test.
// Pass in 'true' to recycle the browser between test methods
Initialize(
false
,
new
TestContextWriteLine(Console.Out.WriteLine));
// If you need to override any other settings coming from the
// config section or you don't have a config section, you can
// comment the 'Initialize' line above and instead use the
// following:
/*
// This will get a new Settings object. If a configuration
// section exists, then settings from that section will be
// loaded
Settings settings = GetSettings();
// Override the settings you want. For example:
settings.DefaultBrowser = BrowserType.FireFox;
// Now call Initialize again with your updated settings object
Initialize(settings, new TestContextWriteLine(Core.TestContext.Out.WriteLine));
*/
#endregion
//
// Place any additional initialization here
//
}
/// <summary>
/// Clean up after each test.
/// </summary>
[TearDown]
public
void
MyTestCleanUp()
{
//
// Place any additional cleanup here
//
#region WebAii CleanUp
// Shuts down WebAii manager and closes all browsers currently running
this
.CleanUp();
#endregion
}
/// <summary>
/// Called after all tests in this class are executed.
/// </summary>
[TestFixtureTearDown]
public
void
FixtureCleanup()
{
// This will shut down all browsers if
// recycleBrowser is turned on. Else
// will do nothing.
ShutDown();
}
#endregion
[Test]
public
void
SampleWebAiiTest()
{
// Launch a browser instance
Manager.LaunchNewBrowser(BrowserType.Chrome);
// 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:
}
[Test]
[Description(
"My simple demo"
)]
public
void
SimpleTest()
{
// Launch an instance of the browser
Manager.LaunchNewBrowser();
// Navigate to google.com
ActiveBrowser.NavigateTo(
"http://www.google.com"
);
// verify the title is actually Google.
Assert.AreEqual(
"Google"
, ActiveBrowser.Find.ByTagIndex(
"title"
, 0).InnerText);
}
[Test]
public
void
ComboBoxText()
{
Manager.LaunchNewBrowser();
ActiveBrowser.NavigateTo(
"http://demos.telerik.com/aspnet-ajax//ComboBox/Examples/Functionality/KeyboardSupport/DefaultCS.aspx"
);
RadComboBox combo = Find.ById<RadComboBox>(
"RadComboBox1"
);
Assert.AreEqual(
"New York"
, combo.Text);
Assert.AreEqual(
true
, combo.Text.Contains(
"New"
));
Assert.AreEqual(
false
, combo.Text.Contains(
"Test"
));
}
}
}
The SampleWebAiiTest and SimpleTest goes without a problem but the ComboBoxTest doesn't. It never find the combo and so the combo object is null :-(
Why this things happen? I suppose a browser problem but with Explorer, Firefox and Chrome the problem still remain the same.
Any ideas?
Gianluca