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

Test converted to NUnit not working

1 Answer 66 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.
ching ping
Top achievements
Rank 1
ching ping asked on 22 Oct 2010, 07:37 AM
Hi,

I'm having problem when i tried to convert my recorded test to NUnit. The test is running fine when i run it from aii file. However, when i converted the test into NUnit, the test failed. My test is selecting item from the drop down and check whether some text appear in the label. There are 3 items in the drop down list and the label will change accordingly when different item is selected from the drop down list. For exmaple, i can  choose country(singapore, malaysia, indonesia) from the drop down list and i'll see the country that has been chosen in the label. I need to create a test which when i select the country from the drop down, check whether the label contain some correct country name. The test passed in for the 1st time and always failed in the 2nd iteration. The error i get is the actual string doesn't match with the expected string, where the actual string is always the first string i choose.

Here is the codes of my test
// Click 'LblSiteSelectedLink'
Pages.FactoryPlanningSystem.LblSiteSelectedLink.Click(false);
 
// RadComboBoxItem(''): selecting item 'Suz'
Pages.FactoryPlanningSystem_0.SuzListItem.Select();
 
// Wait for 'TextContent' 'Contains' 'Suzhou' on 'LblSiteLargeSpan'
HtmlSpan LblSiteLargeSpan = Pages.FactoryPlanningSystem.LblSiteLargeSpan;
Wait.For<HtmlSpan>(c => c.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "Suzhou"), LblSiteLargeSpan, 10000);
 
// Click 'LblSiteSelectedLink'
Pages.FactoryPlanningSystem.LblSiteSelectedLink.Click(false);
 
// RadComboBoxItem(''): selecting item 'Png'
Pages.FactoryPlanningSystem_0.PngListItem.Select();
 
// Wait for 'TextContent' 'Contains' 'Png' on 'LblSiteLargeSpan'
Wait.For<HtmlSpan>(c => c.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "Penang"), LblSiteLargeSpan, 10000);

The test will always fail at this step with the error meesage that i attached. Theactual string will always be Suzhou.

Pls help.

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 27 Oct 2010, 05:55 PM
Hi ching ping,

There was no error message attached. However given your description, I assume the failing step is your "// Wait for 'TextContent' 'Contains' 'Suzhou' on 'LblSiteLargeSpan'" test step, correct? I suspect what's really happening is that the .Select() in the previous line of code is not actually selecting the item. Please try opening the combobox first with code something like this:

Pages.FactoryPlanningSystem_0.myRadComboBox.ShowDropDown();

Please note the RadComboBox was changed after build 2010.2.1007. If you upgrade to this build or later, the ShowDropDown should no longer be needed.

Sincerely yours,
Cody
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
ching ping
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or