Negative testing with NModel?

Dec 12, 2008 at 9:11 AM

I would appreciate some help with how to go about negative testing using NModel, or actually what is the way to do it with MBT methodology?

For instance:
There is a text-box where a user enters some data and then clicks the 'submit' button. In the specs the submit button should be grayed-out and not enabled until the entered data is correct. In the model this is easy to do through the enabling condition for the 'submit' action. But now all the generated test-cases don't try to click 'submit' when the data is wrong.

I would like to get such a generated test-case that tries to click 'submit' even if the entered data is wrong and that the test is marked as failed if the IUT actually enables the 'submit' action.

Thanks in advance for any help.

Dec 12, 2008 at 11:16 AM

At least currently you have to build such things explicitly into your spec, i.e. when submit is greyed out and you still send an erroneous submit, then you should either end up in the same state or perhaps in an error state from where you can return with a "back" action. The reason why such behaviour is not built in is due to ambiguities related to what should be considered to be the correct the response from the system when an unspecified input is sent to it. Thus specifying how your system should behave in case of some invalid input is currently up to the user.

Dec 12, 2008 at 4:34 PM
Thank you. In that case I'll try to check handling of such issues using features.

Thanks again.