Telerik Forums
Testing Framework Forum
9 answers
148 views
Hi

I'm running two tests that on their own succeed without any issues, however when I run them both together I get a null pointer exception in the Telerik framework code.

The tests both use a custom build framework that uses the following structure:

MyWindow.MyPanel.MySubPanel.MyControl


and achieve this by exposing the sub elements of the application structure using properties with the following code:

public class MyPanel : CustomPanelWrapper
{
    private CustomPanelWrapper subPanel;
 
    public CustomPanelWrapper MySubPanel
    {
        get
        {
            return subPanel ?? (subPanel = this.Find.ByAutomationId<CustomPanelWrapper>("MySubPanel");
        }
    }
}
 
public class CustomPanelWrapper : FrameworkElement
{
    ....
}

The application is being started up in a separate process for each test and then closed afterwards using the following code:

public class MyTestRunner
{
   private TelerikWpfTestRunner telerikTestRunner;
    
   public void StartTest()
   {
        var appProcess = new Process();
        appProcess.StartInfo.FileName = <filePath>;
        appProcess.StartInfo.WorkingDirectory= <App Directory>;
 
        appProcess.Start();
 
        telerikTestRunner = new TelerikWpfTestRunner(appProcess, <logPath>);
    }
 
    public void StopTest()
    {
        telerikTestRunner.CleanUp();
        telerikTestRunner.Dispose();
    }
}
 
public class TelerikWpfTestRunner :  BaseWpfTest
{
   public TelerikWpfTestRunner (Process appProcess, string logPath)
   {
       Initialize(logPath);
 
       Application = Manager.ConnectToApplication(appProcess);
       Manager.ActiveApplication.MainWindow.RefreshVisualTrees();
       Manager.ActiveApplication.QuitOnDetach = true;
       Application.WaitForWindow(<MainWindow>);
   }
}

(I've omitted some code for clarity that just deals with catching null values in our code)

The exception occurs when I try to do anything with the elements themselves (i.e. User.Click(), Refresh()) and I get the following error when trying to set a value in a comboBox:

[Error]

Object reference not set to an instance of an object.

[StackTrace]

at ArtOfTest.WebAii.Messaging.Process.PipeCommunication.WriteCommandToPipe(PipeCommand command, PipeStream pipe, Boolean waitForDrain)
   at ArtOfTest.WebAii.Messaging.Process.BrowserRemoted.ProcessBrowserRequest(BrowserCommand command, String requestId)
   at ArtOfTest.WebAii.Wpf.WpfProxy.ExecuteSLCommand(SilverlightCommand cmd)
   at ArtOfTest.WebAii.Wpf.WpfProxy.SetProperty(AutomationProperty property, IAutomationPeer peer, Object value)
   at ArtOfTest.WebAii.Silverlight.AutomationObject`1.SetProperty(AutomationProperty property, Object value)
   at ArtOfTest.WebAii.Controls.Xaml.Wpf.ComboBox.set_IsDropDownOpen(Boolean value)
   at ArtOfTest.WebAii.Controls.Xaml.XamlControlHelper.OpenComboBoxDropDown(IComboBox combo, Boolean simulateRealUser)
   at ArtOfTest.WebAii.Controls.Xaml.Wpf.ComboBox.OpenDropDown(Boolean simulateRealUser)
   ....(rest of our code)


I get the same error popup when also dealing with other controls on the second test only and when I run that test in isolation again the test passes with no exceptions.

Any ideas why this is happening?

I've tried adding some wait code in between tests to make sure the last test exits before the next one starts but this doesn't seem to do the trick.

Also both tests run one after the other and we are using MSTest as our test runner with Resharper 7.1 and Visual Studio 2012.

Thanks

Robin
Plamen
Telerik team
 answered on 03 Dec 2012
7 answers
396 views
Hi All,

We have recently faced an issue when trying to automate  the following scenario on page with IFrame:
1. Initially we are on page in edit mode ( in IFrame some editable content is shown)
2. Click on link on which sets preview mode on page  (in IFrame the preview of content is shown)
3. After doing some validation on page we switch back to edit mode by clicking on appropriate link
And receive the following JavaScript error in browser: Exception in ProcessCommand: TypeError: can't access dead object.

We use next hardware:
 OS: Win 7 x32/64
 Browser: Firefox 16.0.2
 TTF: 2012.2.1002

Thanks in advance!
Plamen
Telerik team
 answered on 03 Dec 2012
1 answer
120 views
Hi ,

The situation is that I want to test login screen by using data driven method combined with Telerik Testing Framwork(WebAii).

Firstly, I can get all row data from excel file correctly. However, after i tried to use WebAii to work with data driven, in the first row of data fetched from Excel file,  everything works fine but in the second row, all parameter from WebAii are turned into null. Please see my code below:

[TestClass]
public class Login : RadControlsBaseTest
{
     [TestMethod()]
     public void SettingUpBrowser()
     {
         SetUpBrowser(capiPage);
         ActiveBrowser.WaitUntilReady();
     }
 
        [TestMethod()]
        [DeploymentItem("Data\\Login.xlsx""Data")]
        [DataSource("LoginDataSource")]
        public void LoginTest()
        {
              if (TestContext.DataRow != null)
            {
                string Username = TestContext.DataRow["Username"].ToString();
                string Password = TestContext.DataRow["Password"].ToString();
                string ExpectedResult = TestContext.DataRow["Expected Result"].ToString();
                string ErrorText = TestContext.DataRow["Error Text"].ToString();
 
                Login(capiPage, Username, Password);
                ActiveBrowser.WaitUntilReady();
                if (ExpectedResult.Equals("Fail"))
                {
                          //compare error text
                }
                else if (ExpectedResult.Equals("Pass"))
                {
                         //can navigate to main screen
                }
             }
        }
 
        protected void SetUpBrowser(PageControls page)
        {
            if(Manager.ActiveBrowser == null)
                Manager.LaunchNewBrowser();
            ActiveBrowser.ClearCache(BrowserCacheType.Cookies);
            ActiveBrowser.ClearCache(BrowserCacheType.TempFilesCache);
            ActiveBrowser.NavigateTo("/" + page.pageURL);
        }
 
        protected void Login(PageControls page, string username, string password)
        {
            //waiting for page to redirect to the login page
            Manager.ActiveBrowser.WaitUntilReady();
 
            if (Manager.ActiveBrowser.ContainsText("Login.aspx") == true)
            {
                HtmlInputText txtUserName = Find.ById<HtmlInputText>("loginControls_txtUserName");
                AttributeUtils.chkNotNull(txtUserName, "loginControls_txtUserName");
 
                HtmlInputPassword txtPwd = Find.ById<HtmlInputPassword>("loginControls_txtPassword");
                AttributeUtils.chkNotNull(txtPwd, "loginControls_txtPassword");
 
                HtmlInputSubmit btnLogin = Find.ById<HtmlInputSubmit>("loginControls_btnLogin");
                AttributeUtils.chkNotNull(btnLogin, "loginControls_btnLogin");
 
                txtUserName.Text = username;
                txtPwd.Text = password;
                btnLogin.Click();
            }
        }
}

Note: 1. class RadControlsBaseTest inherits from class BaseTest. 
         2. class RadControlsBaseTest contains function which has attribute [TestInitialize()], [TestCleanup()], ...

From the code, the following WebAii parameters are turned to be null -> ActiveBrowser, Find, Manager.

Could you please advise?

Thanks in advance.
Cody
Telerik team
 answered on 30 Nov 2012
5 answers
69 views
Hello Telerik,

Is there any possibility in Telerik Testing Framework to determine where the user clicks in the application? I found very interesting even - .PreMouseClick. And I am curious about is it possible to use for my need?

What I have done:
1. Execute the .AttachWrappedWindow() method from the .ContentWindow property;
2. Add event to the .PreMouseClick.

Unfortunately, when I click in the application under test somewhere, this event is not fired. What I am doing wrong?

I look forward to hearing from you.

Kind Regards,
Stanislav Hordiyenko
Cody
Telerik team
 answered on 27 Nov 2012
7 answers
231 views
Hi,

I am using Telerik 2011.1.

When my tests run for more than 30 min, WebAii fails due to executionTimeout
exceeded. It seems to ignore the app.config setting for executionTimeout that I have
increased.

To reproduce the problem ( in reverse ), I used the
Samples/QuickStarts_VSTS_CS project and picked a passing testcase,
eg SimpleWin32UI.

Then I updated the app.config WebAii.Settings so that executionTimeout=0 ( or 1).
The testcase still runs and passes, and does not produce testcase timeout.
                                             
This shows that WebAii.Settings/executionTimeout is not being used.

Where should the executionTimeout value be set so that it can be effective?

Thanks,
Mostafa
Top achievements
Rank 2
 answered on 27 Nov 2012
1 answer
93 views
Hi. I have latest version of Telerik testing framework and Firefox. And I have issue.
Firefox can't find element using such code:
el=  MyManager.ActiveBrowser.Find.ByContent(element);

IE works fine. What details do you need from me to understand why it doesn't work?
P.S. tried to give him direct Xpass and it doesn't work too. Application is written in ASP .Net and AJAX using Telerik controls.
Plamen
Telerik team
 answered on 27 Nov 2012
1 answer
65 views
Hi,
I have a two test methods as following codes, the TestMethodChrome doesn't work as expected, the cookie couldn't be set, but the same codes work well on FireFox and IE(e.g TestMethodFireFox).  I used Telerik.Testing.Framework.2012.2.1022 for testing.  is it a bug in this build of testing framework?

Thanks
Jet
[TestClass]
   public class MyTest:BaseTest
   {
       [TestMethod]
       public void TestMethodChrome()
       {
           base.Initialize();
           Manager.LaunchNewBrowser(BrowserType.Chrome);
           ActiveBrowser.Cookies.SetCookie(new System.Net.Cookie("mycookie", "myvalue", "/", "www.google.com"));
           ActiveBrowser.NavigateTo("http://www.google.com");
       }
       [TestMethod]
       public void TestMethodFireFox()
       {
           base.Initialize();
           Manager.LaunchNewBrowser(BrowserType.FireFox);
           ActiveBrowser.Cookies.SetCookie(new System.Net.Cookie("mycookie", "myvalue", "/", "www.google.com"));
           ActiveBrowser.NavigateTo("http://www.google.com");
       }
   }
Plamen
Telerik team
 answered on 27 Nov 2012
5 answers
118 views

Hi
I can set the cookie with domain "ctrip.com" when testing in FireFox, but couldn't set the value with domain which likes ".ctrip.com".

//the following codes works well

Cookie cookie = new Cookie();
cookie.Domain = "ctrip.com";
cookie.Name = cookieName;
cookie.Value = cookieValue;
 cookie.Path = "/";
cookie.Expires = DateTime.Now.AddHours(2);
 
Manager.ActiveBrowser.Cookies.SetCookie(cookie);

//the following codes doesn't work, after executing the codes, I couln't find the cooke.

Cookie cookie = new Cookie();
cookie.Domain = ".ctrip.com";
cookie.Name = cookieName;
cookie.Value = cookieValue;
 cookie.Path = "/";
cookie.Expires = DateTime.Now.AddHours(2);
 
Manager.ActiveBrowser.Cookies.SetCookie(cookie);

Thanks in advance.

Boyan Boev
Telerik team
 answered on 27 Nov 2012
3 answers
127 views

When using webaii for automating my test cases,I have stumped across a case where in a security pop up appears, I am unable to override using either code/ Firefox browser settings.
How can I handle this firefox dialog?

Attached is the screenshot, but it's Chinese not english, below is the dialog content in english

Dialog Caption: Security Warning

Dialog Text:  "Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party. Are you sure you want to continue sending this information?"
Buttons:  One is "Continue", another one is "Cancel"

Thanks in advance.
Jet

Boyan Boev
Telerik team
 answered on 27 Nov 2012
10 answers
124 views

Hello.

I have html code:

<input id="j_idt9:revertBtn" class="button-primary" type="submit" value="Revert" onclick="jsf.util.chain(this,event,"if(!confirm('Do you really want to revert these changes?'))return false;","RichFaces.ajax(\"j_idt9:revertBtn\",event,{\"incId\":\"1\"} )");return false;" name="j_idt9:revertBtn" disabled="">
 and code to handle pop-up:

Manager.DialogMonitor.AddDialog(AlertDialog.CreateAlertDialog(ActiveBrowser, DialogButton.OK));
Manager.DialogMonitor.Start();
Find.ById<HtmlInputSubmit>("j_idt9:revertBtn").Click();

In initialization phase i have:

Settings settings = GetSettings(); 

settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Initialize(settings);

pop-up has Ok and Cancel buttons.

but when i execute test, pop-up appeared and then nothing happened.

Hm.. I noticed that pop-up "blinking" with this code.

PS. i try this link but have same issue.

PS2. I execute on IE9 and FF14.0.1 Win7 x64 but project compiled in x86

Plamen
Telerik team
 answered on 26 Nov 2012
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?