Contributions
Re: WaitWindow in connected applications is not working!!
Hi , I have noticed that WaitWindow method is working fine after including Connect.RunTest at the beginning of my code. public void Test3() { Connect.RunTest("DummyLogName", "Project Name", "Path of TC project suite .pjs file"); Console.WriteLine(DateTime.Now.ToString() + " :: Test started"); var TestObject; string WndClass = "*"; string WndCaption = "Unavailable Window"; int WaitTimeInMilliSeconds = 40000; TestObject = Sys["Process"]("IceDesktop")["WaitWindow"](WndClass, WndCaption, -1, WaitTimeInMilliSeconds); if (TestObject["Exists"]) { Console.WriteLine(DateTime.Now.ToString() + " :: Window found"); } else { Console.WriteLine(DateTime.Now.ToString() + " :: Window not found"); } Connect.StopTest() } This basically launches TestComplete in "Running-mode" and the WaitWindow method waits for the window for 40 seconds. I am not sure why this 'WaitWindow' method is not working when RunTest method is not included in my code!! After reading some online material I understand that we should include this 'RunTest' method in "Connected" applications. But how is it going to work in 'SelfTesting' applications?? I donot want to link my code in visual studio with any .pjs files. Is it possible?? Please suggest how to proceed. Thanks, Bharat1KViews1like0CommentsRe: WaitWindow in connected applications is not working!!
Hi Tanya, Thanks for looking into this. We are using TestComplete 10.0.531.7 I will check this with TestComplete 10.30.1145 and get back to you. And sorry, I am not trying to handle a hanging/frozen application. But it is very similar. I have to wait for the application to fetch data from different systems and show that data in a seperate window. This is a bit time consuming activity and I dont want to give fixed wait time to delay the script. So I tried to use the WaitWindow method with some good amount of wait time as below. TestObject = Sys["Process"]("ProcessName")["WaitWindow"]("*", "Window Caption", -1, 60000); This above line works fine in TestComplete 10.0.531.7 but not in the Visual Studio! Actually in Visual Studio, the system searches for that window for a maximum of 3 seconds and then returns a stub object if the window is not available. If the window is available within that 3 seconds it is returning the window object. This means that the WaitWindow is working but waits for only 3 seconds or so!! But anyway, I have slightly modified my code to achieve what I was trying to do. This works fine but I think it is not quite right!! Console.WriteLine(DateTime.Now.ToString() + " :: Test started"); var TestObject; string WndClass = "*"; string WndCaption = "Information"; int WaitTimeInMilliSeconds = 60000; int i = 0; while (true) { i = i + 1; TestObject = Sys["Process"]("IceDesktop")["WaitWindow"](WndClass, WndCaption, -1, 1000); if (TestObject["Exists"]) { Console.WriteLine(DateTime.Now.ToString() + " :: Window found"); break; } if (i >= WaitTimeInMilliSeconds/1000) { break; } } if (TestObject["Exists"]) { //do what is required to do on that window } else { Console.WriteLine(DateTime.Now.ToString() + " :: Window not found"); } Thanks, Bharat1KViews0likes0CommentsWaitWindow in connected applications is not working!!
Hello, 'WaitWindow' method is not working visual studio 2013 C# code. In the below code, I was expecting the system to wait for 40 seconds before saying that the window is not found. But it took only6 seconds to execute the test! I have tried to execute very similar C# script in TestComplete 10 and it works fine. I am new to connected applications. Please let me know if I am missing something very obvious! //=============================================== // C# Code in Visual Studio //=============================================== using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using AutomatedQA.TestComplete; using AutomatedQA.script; using System.Threading; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SmartAutomation { [TestClass] public class AutomatedTest : Connect { [TestMethod] public void Test3() { Console.WriteLine(DateTime.Now.ToString() + " :: Test started"); var TestObject; string WndClass = "*"; string WndCaption = "Unavailable Window"; int WaitTimeInMilliSeconds = 40000; TestObject = Sys["Process"]("IceDesktop")["WaitWindow"](WndClass, WndCaption, -1, WaitTimeInMilliSeconds); if (TestObject["Exists"]) { Console.WriteLine(DateTime.Now.ToString() + " :: Window found"); } else { Console.WriteLine(DateTime.Now.ToString() + " :: Window not found"); } } } } //=============================================== //Output in Visual Studio 2013 //=============================================== Test Name: Test3 Test Outcome: Passed Result StandardOutput: 17/06/2014 15:14:10 :: Test started 17/06/2014 15:14:15 :: Window not found //=============================================== //C# script in TestComplete 10 //=============================================== function Test() { Log.Message("Test started"); var TestObject; var WndClass = "*"; var WndCaption = "Unavailable Window"; var WaitTimeInMilliSeconds = 40000; TestObject = Sys["Process"]("IceDesktop")["WaitWindow"](WndClass, WndCaption, -1, WaitTimeInMilliSeconds); if (TestObject["Exists"]) { Log.Message("Window found"); } else { Log.Message("Window is not found"); } } //=============================================== //Output in TestComplete 10 //=============================================== Test started 15:22:57 Normal Window is not found 15:23:37 Normal Refer to the attached doc for more screenshots. Cheers, Bharat2KViews0likes3Comments