Tuesday, April 3, 2012

SpecsFor.Mvc, an independent library for automated acceptance tests

http://trycatchfail.com/blog/post/Using-SpecsForMvc-Introduction.aspx

public class when_a_new_user_registers_with_invalid_data : SpecsFor<MvcWebApp>
{
    protected override void Given()
    {
        SUT.NavigateTo<AccountController>(c => c.Register());
    }

    protected override void When()
    {
        SUT.FindFormFor<RegisterModel>()
            .Field(m => m.Email).SetValueTo("notanemail")
            //.Field(m => m.UserName).SetValueTo("Test User") --Omit a required field.
            .Field(m => m.Password).SetValueTo("P@ssword!")
            .Field(m => m.ConfirmPassword).SetValueTo("SomethingElse")
            .Submit();
    }
    
    //...snip...
}

No comments:

Post a Comment