Telerik Forums
Testing Framework Forum
1 answer
166 views

Script is not executed when ‘Nunit’ item is added to ‘Unit Test Project’

Please find below steps

  1. 1. I have created new project by selecting C# template i.e( Unit Test Project)
  2. 2. Deleted by default added ‘Class1.cs’ file
  3. 3. Installed Nunit in system
  4. 4. Added the new item to the project  i.e Nunit  (Visual C# Items->Test->TelerikTestingFramework2012.2->Web->Nunit)
  5. 5. Tried to add ‘NUnit Extension. dll’ file but didn’t find dll file link provided in ‘Telerik User guide’
  6. 6. Hence downloaded ‘NUnit Extension. dll’ from other sites and placed in ‘C:\Program Files (x86)\NUnit 2.6\bin\addins’ folder
  7. 7. But in ‘NUnit’ , Tools—‘Addins’, I didn’t find any addin
  8. 8. Right click on the sample script and clicked on ‘Run Test’

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'

Velin Koychev
Telerik team
 answered on 26 Jun 2013
3 answers
119 views
Is it possible, to create or edit a template for code beinf files(c#),

I would like to set an standard using to a Shared HelperClass in new Code-Behind-Files (sth. like using Shared_Class);
 So i dont have to write it manually in new code-behind files of a test.

Boyan Boev
Telerik team
 answered on 26 Jun 2013
1 answer
137 views
Totally confused.  I can't find anything on the start menu for Testing Framework, don't see anything in Visual Studio 2010.  It says its installed.  Don't understand the Turn Features On/Off.  I check it and am not sure if they are on or off.  I assume those are the only states and can't see anything after each of 2 checks.
When I go to Support to submit a test ticket, it says my 30days must be up (I just downloaded it today).  Support also doesn't know about me, but I am registered as LKingsbury@NetRate.com and my user number is DG801576.
Any idea what I should do from here?
Rodney
Telerik team
 answered on 25 Jun 2013
4 answers
211 views
Hi. I'm having trouble triggering jquery events to satisfy our required field validators.
The following code works fine in IE9 but not in any other browser.
I get a validation error even though there is text in the textbox (screenshot attached, if it helps)
           
//Get the mandatory field: family name
var familyName = Client.Browser.Find.ByAttributes<HtmlInputText>("id=FamilyName");
 
//Enter some text
Client.Browser.Actions.SetText(familyName, "Chrome and Firefox problems");
 
//Trigger a bunch of jquery events that indicate the control has changed
familyName.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);
Boyan Boev
Telerik team
 answered on 25 Jun 2013
7 answers
98 views
With the latest build of the framework it can be difficult to get Chrome working. The trick I've figured out is that the framework does not like when chrome gets installed with admin privileges, because it is checking a specific path for the chrome exe. When chrome is installed with admin privileges it is in program files instead of  appdata. Normally uninstalling chrome and reinstalling it, saying no to the UAC prompt when it appears works. However, in the event that it does not one can just copy the Google folder from program files to appdata local, and then uninstall chrome and everything will work.

Similarly since I run Firefox Aurora on my system the framework also has problems with that for similar reasons. While the extension installs just fine, and likely works just fine, the framework is checking a specific path for FF and since aurora does not install into that path it creates an issue.

Both of these issues are likely fixable by the end user through the use of junctions or symlinks, but really there should just be a way to configure where the framework is looking for each browser on a machine specific basis.
Cody
Telerik team
 answered on 24 Jun 2013
3 answers
55 views
I'm trying to create web tests in Test Studio for a page which subsequently opens a new popup and opens a silverlight application inside an IFrame within that popup.

When I am recording tests in Test Studio I seem to end up with lots of duplicate root level elements, with say one individual element underneath each. This seems to cause particular problems with the IFrame holding the silverlight application and I found if I set UseQuery to false and cleared out the BaseURL and Query fields in the properties they generally combine back into one root element, which is fine. Although I seem to have to do this for every single new step I record, which is slightly annoying!

As soon as I run the tests on a different machine, additional steps are creating different root elements again and as the URL and title bar were different for that machine it seemed impossible to combine them all back into a common base at this point. 

I just want it to always ignore things like the title bar, URL and query strings as these will obviously be different for each test run and each machine that the tests are worked on or run on. But all I seem to end up with is a mess of elements in this tree.

Could somebody point me in the right direction as to how to manage this element tree correctly? Because of all the duplicates it's very hard to tell what element belongs to which version of the base page or IFrame and so tests steps consistently fail and I'm not sure why. To me it seems strange that there are all these properties mapped to the machine the tests are being recorded/run on, I have bound data for things like the IP address to browse to etc. so I would expect to be able to continue writing tests or running them on any machine and it would act the same way.

Any help would be appreciated!

Thanks.
Boyan Boev
Telerik team
 answered on 21 Jun 2013
10 answers
166 views
I've started another thread on some issues I'm having, but I just wanted to check whether the Testing Framework works on 64-bit Windows 7, and if anybody has been able to get tests to run reliably.

Paul Schofield
Cody
Telerik team
 answered on 20 Jun 2013
1 answer
119 views
when ever I am trying to add 'Connector.dll'  references to the project following error is displayed
" A references to 'C:\Program Files (X86)\Telerik\Test Studio\Bin\ArtOfTest.Connector_64.dll could not be loaded, please make sure that the file is accessible, and that it is valid assembly or COM component."

Even I tried to add a normal 'ArtOfTest.Connector.dll' and I faced the same error.
Please help me on this.
my system configuration: Windows 7    (64- Bit Operating System)
Velin Koychev
Telerik team
 answered on 20 Jun 2013
3 answers
159 views
I have a test case that works fine when run manually, but doesn't work when the exact same steps are performed using WebAii.  I'd like to step through the code and see what's going on, but of course, the code of interest isn't running in the debugger.  I've tried attaching to the IE process, but nothing happens. 

Thanks

Late Edit:  I should add that the problem seems to be that test case involves a jquery dialog (not a separate window, but a hidden div that behaves as a dialog).  If that dialog is opened manually, it works.  If opened by WebAii, even though the behavior is correct, and the subsequent changes to fields is correct, they are somehow not registered when the page posts back.
Cody
Telerik team
 answered on 17 Jun 2013
1 answer
62 views
I am still relatively new to using the Telerik Testing Framework and am still figuring some things out, but this one has puzzled me for almost a day now. I am running a scenario, using MSTest as the unit test framework and IE 8, to log a user in and then log out. Simple, right? Well, I can get the user logged in without issue, but after the browser navigates to the page after successful log in I will get an error trying to call the RadToolBar FindItemByText() method. I can access the "Log Off" button I am looking for if I use a more direct approach as displayed in my code example, but I really like the features that the RadControl wrappers provide. What I find the most confusing about this, is if I find the RadToolBar element (common control on the Master page for the project) and perform a FindItemByText() method prior to logging in it works without getting the error.

Thanks for any help!

The following is my code and then the details of the error captured by VS2012 debugger.

string userName = TestContext.DataRow["Username"].ToString();
 
ActiveBrowser.NavigateTo("~/User/LogInPage.aspx");
 
HtmlFindExpression untbExpr = new HtmlFindExpression("id=?RadTextBoxUserName_wrapper");
ActiveBrowser.WaitForElement(untbExpr, 30000, false);
RadTextBox usernameTb = ActiveBrowser.Find.ByExpression<RadTextBox>(untbExpr);
usernameTb.Clear();
usernameTb.TypeText(userName);
 
HtmlFindExpression lbExpr = new HtmlFindExpression("id=?RadButtonLogin_input");
ActiveBrowser.WaitForElement(lbExpr, 30000, false);
RadButton loginButton = ActiveBrowser.Find.ByExpression<RadButton>(lbExpr);
loginButton.MouseClick();      //Navigates to ~/Default.aspx but authenticated.
 
//Throws error
HtmlFindExpression expr = new HtmlFindExpression("id=?RadToolBarMain");
ActiveBrowser.WaitForElement(expr, 30000, false);
RadToolBar tb = ActiveBrowser.Find.ByExpression<RadToolBar>(expr);
RadToolBarItem lob = tb.FindItemByText("Log Off");
 
//WORKS!!!
//HtmlFindExpression loButton = new HtmlFindExpression("title=^Log Off", "class=rtbWrap");
//ActiveBrowser.WaitForElement(loButton, 30000, false);
//HtmlAnchor lob = ActiveBrowser.Find.ByExpression<HtmlAnchor>(loButton);
//lob.MouseHover();

ArtOfTest.WebAii.Exceptions.ExecuteCommandException was unhandled by user code
  HResult=-2146233088
  Message=ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [$find(\'ctl00_RadToolBarMain\')._extractItemFromDomElement(document.getElementsByTagName(\'li\')[4]).get_text()] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'$find(\'ctl00_RadToolBarMain\')._extractItemFromDomElement(document.getElementsByTagName(\'li\')[4]).get_text()',ClientId:'Client_ba0bd6af-47e6-4b89-90cf-184e1a3a05df',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [$find(\'ctl00_RadToolBarMain\')._extractItemFromDomElement(document.getElementsByTagName(\'li\')[4]).get_text()] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

  Source=ArtOfTest.WebAii
  StackTrace:
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
       at ArtOfTest.WebAii.Core.Actions.InvokeScript(String script)
       at ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions.InvokeScript(String script)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName, T defaultValue)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName)
       at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.CallMethod[T](String methodCall)
       at Telerik.WebAii.Controls.Html.RadToolBarItem.get_Text()
       at Telerik.WebAii.Controls.Html.RadToolBar.<>c__DisplayClass1.<FindItemByText>b__0(RadToolBarItem item)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustomInternal[TControl](Predicate`1 predicate, Element e)
       at ArtOfTest.WebAii.Core.Find.ByCustom[TControl](Predicate`1 predicate)
       at Telerik.WebAii.Controls.Html.RadToolBar.FindItem(Predicate`1 predicate)
       at Telerik.WebAii.Controls.Html.RadToolBar.FindItemByText(String itemText)
       at ALPS.Test.GuiTests.User.LoginPageTests.UsersCanSuccessfullyLogIn() in c:\DOTNETDevelopment\Test\Automation\ALPS.Test.GuiTests\User\LoginPageTests.cs:line 102
  InnerException:
Rodney
Telerik team
 answered on 17 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?