Exception while launching WPF application

2 posts, 0 answers
  1. imran
    imran avatar
    8 posts
    Member since:
    Feb 2018

    Posted 07 Mar 2018 Link to this post

    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!!!







  2. Elena
    Elena avatar
    1222 posts

    Posted 08 Mar 2018 Link to this post

    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! 

    Elena Tsvetkova
    Progress Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top