Unexplained delay after launching WPF application

3 posts, 0 answers
  1. Enrique
    Enrique avatar
    2 posts
    Member since:
    Jul 2011

    Posted 13 Feb Link to this post

    I have the following problem with Telerik Testing Framework (TTF): there is a ~20 sec delay between launching my WPF application and the execution of the first step in my test.
    Interestingly enough, there is no delay when connecting to my WPF application (after manually launching it), or when running the test in Test Studio 2016 (this version does not have the ‘Convert to Unit Test’ feature, so I cannot compare my code against the code in Test Studio that launches the application).
    Here is the code in question:
    // Launch the application
    WpfApplication wpfApp = Manager.Current.LaunchNewApplication(@"filepath");
     // Click the File menu button
    wpfApp.MainWindow.Find.ByTextContent("File").User.Click();

    I run my tests in C# Visual Studio 2015. I have tried to use ‘Settings.ClientReadyTimeout’ and ‘Settings.ExecuteCommandTimeout,’ but these do not seem to have an effect on this.
    I am sure there is something silly that I am missing, as I am new at test automation. I hope that someone can shed some light on this issue and point me in the right direction.

    Thanks,

    -Enrique

  2. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    971 posts

    Posted 16 Feb Link to this post

    Hi Enrique,

    Thank you for sharing detailed description. 

    As of the shared details there are only assumptions I could share on the topic. It seems to be something specific for the application and it will be quite difficult to identify it without having a sample application - would it be possible to prepare a sample app and test to provide for the investigation? 

    Meanwhile you could double check that second step and its target element's find expression - if it is too generic and looks for the element in the whole DOM tree it might be slowing down the execution. Would it be possible to replace the step with any other and/or modify the element's find expression? What will be the results of these actions? 

    If you would need further assistance on the topic please let me know if the TTF version you are using is 2018.1 and the licensed Test Studio that you have dates back in 2016?

    Thanks in advance. 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Enrique
    Enrique avatar
    2 posts
    Member since:
    Jul 2011

    Posted 19 Feb in reply to Elena Tsvetkova Link to this post

    Hi Elena,

    Thanks for your reply. I agree with your assessment that it might be something with our application; however, I found a workaround by launching the application using 'System.Diagnostics.Process.Start' and then connecting to it with 'Manager.ConnectToApplication' after waiting for 5 sec.

                // Launch WPF app
                System.Diagnostics.Process.Start("wpf app filepath");

                // Wait for WPF app to be ready
                System.Threading.Thread.Sleep(5000);

                // Connect to WPF app
                var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "WPF App");
                WpfApplication wpfApp = Manager.ConnectToApplication(runningApp.FirstOrDefault());

    This workaround reduces my wait time from ~20 to 5 sec, and this is good enough for me now.

    Again, thank you for your help.

    -Enrique

Back to Top