Test converted to NUnit not working

2 posts, 0 answers
  1. ching ping
    ching ping avatar
    3 posts
    Member since:
    Sep 2010

    Posted 22 Oct 2010 Link to this post


    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'
    // RadComboBoxItem(''): selecting item 'Suz'
    // 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'
    // RadComboBoxItem(''): selecting item 'Png'
    // 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.

  2. Cody
    Cody avatar
    3354 posts

    Posted 27 Oct 2010 Link to this post

    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:


    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,
    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
Back to Top