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

RadControls doesn't work

4 Answers 130 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gianluca Mariani
Top achievements
Rank 2
Gianluca Mariani asked on 10 Jan 2013, 11:39 PM
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:

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();
 
            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

4 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 11 Jan 2013, 11:30 AM
Hi Gianluca,

It seems the ID you are using is not correct. Please use "ctl00_ContentPlaceHolder1_RadComboBox1" instead of "RadComboBox1" (see the attached screen shot).

Let me know if this helps.

Kind regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Gianluca Mariani
Top achievements
Rank 2
answered on 11 Jan 2013, 12:29 PM
Hi Boev,
yesterday I try also with the ID suggested from you but doesn't work. Are you perhaps tried that code with taht id?. Also I really don't understand the code that I provided si taken directly from your example installed with the free product, and if I compile and try them, they don't go, why?
0
Gianluca Mariani
Top achievements
Rank 2
answered on 11 Jan 2013, 06:38 PM
Hi Boev,
I confirm, also with id ctl00_ContentPlaceHolder1_RadComboBox1 it doesn't work
0
Boyan Boev
Telerik team
answered on 15 Jan 2013, 03:57 PM
Hello Gianluca,

The code is absolutely correct and should work without any problems. I recorded a short video as a demonstration.

In order to help you best please provide some more detailed information about your scenario.

1. Which test runner are you using to run the test (e.g. NUnit, MS Test Runner). 

2. Please send me the test results so we can investigate why is test failing. If you are using NUnit send me please the content of the "Errors and Failures" tab (see attached screen shot).

3. A Jing video of the behavior may also help us diagnose your issue. 

Note that if you have a 64-bit machine, be sure to use the 32-bit version of NUnit (nunit-x86.exe) and not the 64-bit version (nunit.exe).

Please follow this article to Get Started with Telerik Testing Framework. Also please check out this article in order to get more information about NUnit. 

Thank you for your cooperation.

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