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

Problem with ComboBox in WPF

1 Answer 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 10 Jun 2011, 09:05 PM
I have a small test using Test Framework. Here's the sample code:

[Test]
public void TestTextBox()
{
    WpfApplication wpfApp = Manager.LaunchNewApplication(@"C:\Projects\myapp.exe");
    var loginWindow = wpfApp.GetWindow("Login");
    loginWindow.Find.ByName<TextBox>("usernameTextBox").Text = "user1";
    loginWindow.Find.ByName<PasswordBox>("passwordTextBox").Password = "pass1";
    loginWindow.Find.ByName<ComboBox>("environmentComboBox").SelectItemByText(false, "DEV");
    loginWindow.Find.ByName<Button>("connectButton").Click(MouseClickType.LeftClick, false, false, 0, 0, OffsetReference.AbsoluteCenter, ActionPointUnitType.Pixel);
}

On following line:
loginWindow.Find.ByName<ComboBox>("environmentComboBox")
I get the following error:

System.InvalidCastException : Unable to cast object of type 'ArtOfTest.WebAii.Wpf.WpfWindow' to type 'ArtOfTest.WebAii.Silverlight.SilverlightApp'.
   at ArtOfTest.WebAii.Silverlight.UI.ComboBox.get_Items()
   at ArtOfTest.WebAii.Silverlight.UI.ComboBox.RefreshItemsForSelection()
   at ArtOfTest.WebAii.Silverlight.UI.ComboBox.SelectItemByText(Boolean simulateRealUser, String text)
   at TelerikTestFramework.TelerikNUnitTest1.TestTextBox() in TelerikNUnitTest1.cs: line 135

What may be the problem?

The other question is about the maturity of Telerik Testing Framework for WPF. I only see two classes in Wpf namespace and all controls are returned from Silverlight namespace. Even though the framework looks great and clean, but I'm reluctant to recommend Telerik's framework if it's not prepared to test WPF apps.

Thanks

1 Answer, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 17 Jun 2011, 12:17 PM
Hello Ali,
     the problem is that you're trying to use the WebAii Silverlight API instead of the WPF API. I'm not sure how ti happend - my guess is that you created a TelerikTestingFramework web test (screenshot 1) and then you added the WPF extension with a "using" statement. Try creating a new test item but make sure it's a Wpf test.

Let me know if you're still unable to resove this.

Greetings,
Stoich
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ali
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Share this question
or