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

Thread.sleep alternative for Coded Steps in Telerik Test Studio

6 Answers 224 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mamta
Top achievements
Rank 1
mamta asked on 23 Nov 2014, 07:25 PM
Thread.sleep alternative for Coded Steps in Telerik Test Studio:

I don't want to use Thread.sleep as it fails the test cases at some time, what should be used to replace it.
As an example, I have windows to find which doesn't have captions so I am not able to find the windows through wait for window.
The only option that I have is to find the windows through last window caption and that works only if I put thread.sleep before it.

Please let me know if there is any other alternative to it.

Required help on urgent basis, any help would be appreciated.


Thanks
Mamta

6 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 25 Nov 2014, 04:12 PM
Hello Mamta,

What type of application are you trying to automate, WPF or Web/Silverlight? Please share with us the code you are currently using. Screen shots of these windows you are trying to connect to would also be useful.

I have to admit, based on your description of the problem, I fail to understand how you're getting this to work at all. Normally Test Studio can only connect to windows that have a title/caption. Without a caption I'm not aware of any method of connecting to the window to automate it.


Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mamta
Top achievements
Rank 1
answered on 17 Dec 2014, 10:18 AM
Hello Telerik Admin,

Could you please reply on it as I need it urgently for my project and also I am using licensed Telerik tool.

Thanks
Mamta
0
Cody
Telerik team
answered on 17 Dec 2014, 10:59 AM
Hello Mamta,

I already did back on November 25th. I never got a response to the additional questions I asked. Here is my last response repeated, of which I need your answers:

What type of application are you trying to automate, WPF or Web/Silverlight? Please share with us the code you are currently using. Screen shots of these windows you are trying to connect to would also be useful.

I have to admit, based on your description of the problem, I fail to understand how you're getting this to work at all. Normally Test Studio can only connect to windows that have a title/caption. Without a caption I'm not aware of any method of connecting to the window to automate it.



Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mamta
Top achievements
Rank 1
answered on 18 Dec 2014, 06:06 AM
Hello Cody,

I am trying to automate a WPF App. and there are couple of windows in my app that doesn't have title. So what I am doing is , I am finding the entire list of WPF windows and then looking for the last window and its caption. This way I am able to get the window which is not having title as well.

Below is a sample of code  where in I am finding a window Gast Details with the below code

 var windowslist1 = wpfApp.Windows.ToList();
 var lastcaption1 = windowslist1.Last().Window.Caption;
  var GastDetails = wpfApp.WaitForWindow(lastcaption1.ToString(), 20000);

Thread.Sleep(2000);
GastDetails.Find.ByName<Button>(AppSettings.Default.GastDetailsCheckinButton).User.Click();

So to perform any action on Gast Details window, I have to put Sleep before that then only its able to do so. Otherwise the command fails as its not able to load gast details by that time.
But the problem is the screen loading time varies at different environments so the testing which is passing at my end sometimes fails at other machines but when I increase the sleep time, it passes.


Attached the screenshots as well:
  

0
Mamta
Top achievements
Rank 1
answered on 21 Dec 2014, 05:59 PM
Hello Cody,

Please reply now as I have mentioned the details that you asked, need help urgently.

Thanks
Mamta
0
Cody
Telerik team
answered on 23 Dec 2014, 12:18 AM
Hi Mamta,

The two screen shots are identical. I do see a title of "Gastsuche" on the window. As far as Test Studio is concerned window title = window caption.

If the test script is trying to click on the button before it exists, you can add a line of code to wait for it to exist before clicking on it like this:

AppSettings.Default.GastDetailsCheckinButton.Wait.ForExists(2000);

Use this in place of the Thread.Sleep(2000);

P.S. Public forum posts have a guaranteed response time of 72 business hours, not 24 business hours. We do not work weekends, thus we do not count weekends.


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