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:
and achieve this by exposing the sub elements of the application structure using properties with the following code:
The application is being started up in a separate process for each test and then closed afterwards using the following code:
(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
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.MyControland 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