Testing non-ajax forms

Last post 09-03-2009 5:16 PM by farmas. 5 replies.

Sort Posts:

  • Testing non-ajax forms

    08-30-2009, 9:18 AM

    I have seen that LTAF is great to test Ajax forms, but can we also test non-Ajax forms with it?

    I tried to do that, but I cannot find the url of the second form (I need to know it in order to test if the test is successful or not)

    Thank you!

    Filed under:
  • Re: Testing non-ajax forms

    08-31-2009, 12:52 AM
  • Re: Testing non-ajax forms

    08-31-2009, 7:45 AM

    Thank you for your response, but none of these links provide a yes or a no to the question.

    Have you tried to test non-ajax forms?

  • Re: Testing non-ajax forms

    08-31-2009, 10:11 PM
    • Participant
      1,108 point Participant
    • farmas
    • Member since 08-05-2002, 12:19 PM
    • Redmond, WA
    • Posts 246
    • AspNetTeam

    Hello !


    Yes, testing non-Ajax forms is supported. We use LTAF to test regular webforms, MVC and other sites that have no javascript at all. Could you explain a little bit more what scenario is not working for you?

    - Federico

  • Re: Testing non-ajax forms

    09-03-2009, 5:02 PM

    Frederico, let's imagine an Ajax form that calculates your age and the following test:

    [WebTestMethod]

    public void Can_Calculate_Age()

    {

    // Arrange

    HtmlPage page = new HtmlPage("/AgeCalculator");

     

    // Act

    page.Elements.Find("currentYear").SetText("2010");

    page.Elements.Find("yearOfBirth").SetText("1932");

    page.Elements.Find("submitButton").Click();

     

    // Assert

    var resultsElement = page.Elements.Find("results");

    resultsElement.WaitForInnerText("Your age is approximately: 78", ajaxRequestTimeoutSeconds);

    }

    As you can see, this test verifies that the result (in this case, presented in a div) is "Your age is approximately: 78".

    What if this form is non-Ajax?

    How do you wait for the result page to load and how do you find the url of that page?


    By they way, is there any tools native to Visual Studio 2008 that is similar?

    Can we record user experience with LTAF or that native tool I imagine as it is the case with the selenium plug-in for Firefox?


    Thank you for taking the trouble to answer this questions!

  • Re: Testing non-ajax forms

    09-03-2009, 5:16 PM
    Answer
    • Participant
      1,108 point Participant
    • farmas
    • Member since 08-05-2002, 12:19 PM
    • Redmond, WA
    • Posts 246
    • AspNetTeam

    Oh, I see. There is an overload of the Click method that you want to use to wait until the postback is completed.

    page.Elements.Find("submitButton").Click(WaitFor.Postback);

    It's called "postback" simply because it is a more natural term for ASP.NET developers, but it's really wait until a new page is loaded to continue. Does that work for you?

    Regarding tools, unfortunately we don't have a test recorder like Selenium. LTAF is mantained by the ASP.NET QA team (we are not full time devs of LTAF :P) and we haven't seen the need to create one yet.

    Thanks for your interest in LTAF, let me know if you have any more questions or suggestions on how we can improve the framework.

    - Federico

Page 1 of 1 (6 items)