Telerik Forums
Testing Framework Forum
9 answers
666 views
HI,

I am currently writing a test case to open the browser and select a database in the application. When I run the test first time it put the vale in the textboxes and then select the database.

But runnig the test second time the value selected in previous run is there and my test fails. Is there a way where the test is run every time from the start irrespective what has been run previously. I guess there should be some way to cleanup the test which is ran previosly. 

Thanks
Amar
//Use ClassInitialize to run code before running the first test in the class
      [ClassInitialize()]
      public static void MyClassInitialize(TestContext testContext)
      {
      }
 
      /// <summary>
      /// Use TestInitialize to run code before running each test
      /// Initializes WebAii manager to be used by the test case.
      /// If a WebAii configuration section exists, settings will be
      /// loaded from path. Otherwise, will create a default settings
      /// object with system defaults.
      ///
      /// Note: We are passing in a delegate to the VisualStudio
      /// testContext.WriteLine() method in addition to the Visual Studio
      /// TestLogs directory as our log location. This way any logging
      /// done from WebAii (i.e. Manager.Log.WriteLine()) is
      /// automatically logged to the VisualStudio test log and
      /// the WebAii log file is placed in the same location as VS logs.
      ///
      /// If you do not care about unifying the log, then you can simply
      /// initialize the test by calling Initialize() with path parameters;
      /// that will cause the log location to be picked up from the config
      /// file if path exists or will use the default system settings (C:\WebAiiLog\)
      /// You can also use Initialize(LogLocation) to set a specific log
      /// location for this test.
      /// </summary>
      [TestInitialize()]
      public void MyTestInitialize()
      {
          #region WebAii Initialization
 
           
 
          // Pass in 'true' to recycle the browser between test methods
          Initialize(false, this.TestContext.TestLogsDir, new TestContextWriteLine(this.TestContext.WriteLine));
 
          // Set the current test method. This is needed for WebAii to discover
          // its custom TestAttributes set on methods and classes.
          // This method should always exist in [TestInitialize()] method.
           SetTestMethod(this, (string)TestContext.Properties["TestName"]);
 
          _telerikBrowser = new TelerikBrowser();
          _app = _telerikBrowser.App;
          _telerikButton = new TelerikButton(_app);
          _telerikTextBox = new TelerikTextBox(_app);
          _telerikTextBlock = new TelerikTextBlock(_app);
          #endregion
 
          //
          // Place any additional initialization here
          //
 
 
      }
 
      // Use TestCleanup to run code after each test has run
      [TestCleanup()]
      public void MyTestCleanup()
      {
 
          //
          // Place any additional cleanup here
          //
 
          #region WebAii CleanUp
 
          // Shuts down WebAii manager and closes all browsers currently running
          // after each test. This call is ignored if recycleBrowser is set
          this.CleanUp();
 
          #endregion
      }
 
      //Use ClassCleanup to run code after all tests in a class have run
      [ClassCleanup()]
      public static void MyClassCleanup()
      {
          // This will shut down all browsers if
          // recycleBrowser is turned on. Else
          // will do nothing.
 
          ShutDown();
      }
 
      #endregion
 
      /// <summary>
      /// Method to add the different values for selecting the PDB by selexting different control in TelerikCommon
      /// </summary>
      [TestMethod]
      public void AddNewPdbSelector_ValidPDB_MethodSuccessful()
      {
          String PDB = "Athene1_DB";          
           System.Threading.Thread.Sleep(4000);
           
          //click the plussy plus sign
          _telerikButton.ClickButton(ControlsDefinition.PdbAddButton);
 
          //refresh
          _app.RefreshVisualTrees();
          //populate controls
          _telerikTextBox.PutValueToTextBox(ControlsDefinition.PdbHostNameAssociatedLabelText, "AB-M4500", true);
          _telerikTextBox.PutValueToTextBox(ControlsDefinition.PdbInstanceNameAssociatedLabelText, " ", true);
          _telerikTextBox.PutValueToTextBox(ControlsDefinition.PdbInstancePortAssociatedLabelText, "0", true);
          _telerikTextBox.PutValueToTextBox(ControlsDefinition.PdbNameAssociatedLabelText, "Athene1_DB", true);
          // log a message
 
          //click the button
          _telerikButton.ClickButton(ControlsDefinition.PdbCommitButton, 4000);
 
          //refresh
          _app.RefreshVisualTrees();         
 
 
      }
?
Boyan Boev
Telerik team
 answered on 16 Sep 2014
3 answers
247 views
Is there any current support for Html Input Type "tel"?  In terms of accessing and invoking javascript on an element of type HtmlInputTel which Control should I attempt to use, or will 'InputTel's be not accessible?   Example of Html Code below:

<div id="rowPhone" class="formRow" style="">
    <label class="inlineBlock inputLabel" for="myAccount_phone">Primary Phone:(/label>
    <input id="myAccount_phone" class="inlineBlock error" type="tel" aria-describedby="errorContainer_phone" data-bind="value: Phone" name="phone" aria-invalid="true">
    <div id="ui-id-24" class="error fieldErrorContainer" aria-atomic="true" role="alert" style="width: 140px; text-align: left; position: relative; top: 0px; left: 103.85px; height: auto;"></div>

Is this something that is in the works for future Telerik development?  Thanks
Boyan Boev
Telerik team
 answered on 16 Sep 2014
2 answers
94 views
Hi,

I am trying to identify a href link which doesnt contain any unique property,i have used  htmlhyperlink,htmlcontrol but i am unable do so.

Kindly help me out ASAP

Thanks
Nalin
Boyan Boev
Telerik team
 answered on 16 Sep 2014
2 answers
88 views
How test SilverlightApplication in headless browser? And is it possible to do so?

Thanks in advance.
Vitaliy
Top achievements
Rank 1
 answered on 15 Sep 2014
2 answers
207 views
Hello, I'm wondering whether it is possible to write tests for my web silverlight application using headless web browsers and telerik test framework.
1) I know that telerik test framework is BrowserType.AspNetHost but I am unsure whether it is possible in this mode to test the silverlight application?
2) And I do not quite understand why you need to specify the path to the source code 'settings.WebAppPhysicalPath = @ "D:\...\Web"; '?
3) Also, I have seen SilverlightApplicationPath but I can not understand in what cases it is applied?
4) My test application written in Asp.net MVC and it is tightly associated with silverlight, using BrowserType.InternetExplorerr can achieve the desired but will it all work correctly in BrowserType.AspNetHost, I did not get because in the first case, we specify a full url and secondly the relative path to the project, or am I doing something wrong? And if the tests will be run on a separate server and will not have access to the project files?

Thanks in advance.
Vitaliy
Top achievements
Rank 1
 answered on 15 Sep 2014
3 answers
228 views
First, per this post, I know what I'm asking is not possible; however, I'm hoping to obtain clarification on a couple of things:

1. Clearly understanding that manipulation / interrogation of a web page, rendered within a System.Windows.Controls.WebBrowser control is not possible, do any of the Telerik products provide a comparable Wpf control that would allow this?  (I'm trying to keep within the Telerik eco system for as much of my test automation as possible)

2. Regarding supported browsers (BrowserType enumeration), the majority of the enumerations are self explanatory, but what is an example (high level) of a supported "NativeApp"

My scenario is attempting to implement E2E UI Automation for a WpfApplication which authenticates and stores user credentials and aggregates various Web Applications (toolsets) into a common UI executable. 

Thanks in advance,

Mike
Cody
Telerik team
 answered on 13 Sep 2014
6 answers
181 views
HI, 

I am new to TTF, and I am learning to build the framework within our company. I am trying to open the silverlight web page but getting errors.
I am using the method under to open the webpage:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ArtOfTest.WebAii.TestTemplates;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
using System.Diagnostics;
using System.IO;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.TestAttributes;
using ArtOfTest.WebAii.Win32.Dialogs;
using ArtOfTest.WebAii.Controls.HtmlControls;



namespace WebPortalTests
{
    [TestClass]
    public class CreateCharts :BaseTest
    {
        public SilverlightApp OpenApplication()
        {
            Manager.Settings.Web.EnableSilverlight=true;
            Manager.LaunchNewBrowser();
            ActiveBrowser.Window.Maximize();
            ActiveBrowser.NavigateTo("http://Some web page");
            SilverlightApp app = ActiveBrowser.SilverlightApps();
            return app;
        }

    }
}

Can you please tell me if I am using the right API method to open the webpage? IF yes what is going wrong in the method?

Ivaylo
Telerik team
 answered on 12 Sep 2014
3 answers
117 views
Hi,

I have a working (Telerik Testing Framewokr) TTF 2014.2 on my PC1, using VS2012. By this I mean that the Samples/Testing Framework/QuickStarts_VSTS_CS solution builds and runs.

When I recently installed TTF on another PC (PC2 say), it indicated it was 2014.3. It also has VS2012. The QuickStarts_VSTS_CS builds fine but all tests fails to run with error :

> Initialization method QuickStarts_VSTS_CS.Advanced.MyTestInitialize threw exception. System.Configuration.ConfigurationErrorsException: System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for WebAii.Settings: Could not load file or assembly 'ArtOfTest.WebAii' or one of its dependencies. The system cannot find the file specified. (C:\Users\kwee.tan\AppData\Local\Temp\TestResults\kwee.tan_WIL30598D 2014-09-06 17_18_05\Out\QuickStarts_VSTS_CS.DLL.config line 4) ---> System.IO.FileNotFoundException: Could not load file or assembly 'ArtOfTest.WebAii' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
> To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
> Note: There is some performance penalty associated with assembly bind failure logging.
> To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
> .
>    at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
>    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
>    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
>    at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
>    at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, ref Boolean isRootDeclaredHere)
>  --- End of inner exception stack trace ---
>    at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, ref Boolean isRootDeclaredHere)
>    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, ref Object result, ref Object resultRuntimeObject)
>    at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
>    at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
>    at System.Configuration.ConfigurationManager.GetSection(String sectionName)
>    at ArtOfTest.WebAii.TestTemplates.BaseTest.GetSettings()
>    at ArtOfTest.WebAii.TestTemplates.BaseTest.Initialize(String logLocation, TestContextWriteLine vsWriteLineDelegate)
>    at QuickStarts_VSTS_CS.Advanced.MyTestInitialize() in Advanced.cs: line 93


If I remove the app.config file in the project, the tests can run. So, I suspect something in the settings is different between TTF 2014.2 and 2014.3.

Look forward to hearing your explanation and solution for this.

Thanks,
Cody
Telerik team
 answered on 10 Sep 2014
3 answers
94 views
i am not able get the required date from kendo calender using selectDay method please suggest me method or property to get the required date with example but i am able to identify the calender and other properties like SelectedDate,NavigateToFuture all are working fine but i am not able to get the required date please help me in this
Boyan Boev
Telerik team
 answered on 09 Sep 2014
11 answers
121 views
Hi!

Is there any possibility to run tests on IE x64 or any other x64 browser using latest Telerik Test Framework?
Boyan Boev
Telerik team
 answered on 08 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?