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

Exception while launching WPF application

1 Answer 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
imran
Top achievements
Rank 1
imran asked on 07 Mar 2018, 01:14 PM

Hi I am using Telerik Testing Framework and while launching a WPF application I am encountering an exception

Test Name: TestMethod1
Test FullName: TestStudioProject1.UnitTest1.TestMethod1
Test Source: C:\Imran\Code\Emdat\Inscribe-CUIT-automation\CodedUITest_TelerikEditor\TestStudioProject1\UnitTest1.cs : line 23
Test Outcome: Failed
Test Duration: 0:00:07.5626828

Result StackTrace:
at ArtOfTest.Common.Win32.Connector.InjectCode(IntPtr handle, String assemblyAndClass, String pipename, String pid, Boolean waitForDocument, Int32 waitForDocumentTimeout, String navigateUrl)
   at ArtOfTest.WebAii.Wpf.WpfWindow.ConnectToWindow(IntPtr handle, String pipename, String pid)
   at ArtOfTest.WebAii.Wpf.WpfApplication.get_MainWindow()
   at ArtOfTest.WebAii.Core.Manager.LaunchNewApplication(ProcessStartInfo pinfo)
   at ArtOfTest.WebAii.Core.Manager.LaunchNewApplication(String path, String[] args)
   at TestStudioProject1.UnitTest1.TestMethod1() in C:\Imran\Code\Emdat\Inscribe-CUIT-automation\CodedUITest_TelerikEditor\TestStudioProject1\UnitTest1.cs:line 25
Result Message:
Test method TestStudioProject1.UnitTest1.TestMethod1 threw exception: 
System.NullReferenceException: Object reference not set to an instance of an object.

 

The code is

public void TestMethod1()
        {
            Manager manager = new Manager(true);
            WpfApplication wpfApplication = manager.LaunchNewApplication(@"C:\TelerikWpfApp2\TelerikWpfApp1\bin\Debug\TelerikWpfApp1.exe");
            var richtextbox = wpfApplication.MainWindow.Find.ByAutomationId<ArtOfTest.WebAii.Controls.Xaml.Wpf.RichTextBox>("radRichTextBox");
        }

 

Let me know am I missing anything here!!!

 

Thanks,

Imran

 

 

 

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 08 Mar 2018, 09:44 AM
Hello Imran,

Thank you for reaching us out. 

Could you please let me know some further details for the environment you are running the unit test on - Windows OS version, Visual Studio version, etc? Which of the shared lines of code is line 25 in your solution? Are you executing the test explicitly as administrator? 

I am looking forward to hearing back from you. Thanks in advance! 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
imran
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or