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

Performance testing the combo box

1 Answer 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
DeveloperDame
Top achievements
Rank 1
DeveloperDame asked on 26 Jul 2013, 03:39 PM

Hi all,

I'm currently using the framework to create performance tests for a WPF application. I need to record the time between when I click on a combo box and when the combo box is actually present. 

I can't see an event that I can attach too that would tell me the combobox was down, you can see if it is down but no event.  

Here's what I mean:

IList<ComboBox> allByType = wpfWindow.Find.AllByType<ComboBox>();
IEnumerable<ComboBox> comboBoxs = allByType.Where(x => x.Text.Contains("Test"));
ComboBox comboBox = comboBoxs.First();
_stopWatch = Stopwatch.StartNew();
  
comboBox.OpenDropDown(true);
//Check to see if drop down is present or fire event
Console.WriteLine("Total dropdown loading time (ms): " + _stopWatch.Elapsed.TotalMilliseconds);


Thanks,

Sara

1 Answer, 1 is accepted

Sort by
0
Velin Koychev
Telerik team
answered on 29 Jul 2013, 03:24 PM
Hello Sara,

If you want to be sure that the ComboBoxItems are actually present, you can add additional code to verify that one of them actually exist in the DOM and is visible, before you stop the Stopwatch. 

I have attached a demo application with a sample ComboBox. I have used the following code to measure the time elapsed:

WpfApplication wpfApp = Manager.LaunchNewApplication(@"C:\Users\koychev\Documents\Visual Studio 2012\Projects\ComboBoxDemo\ComboBoxDemo\bin\Debug\ComboBoxDemo.exe");
ComboBox comboBox =  wpfApp.MainWindow.Find.ByName<ComboBox>("ComboBox1");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
comboBox.OpenDropDown(true);
TextBlock listItem = wpfApp.MainWindow.Find.ByExpression(new XamlFindExpression ("TextContent=Coffie", "XamlTag=textblock")).As<TextBlock>();
listItem.Wait.ForVisible(30000);
stopwatch.Stop();
Log.WriteLine("Time elapsed: " + stopwatch.Elapsed.ToString());

If this approach doesn't work for you, could you please elaborate more what timing resolution do you need. 

Looking forward to hearing from you.

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