I accept acceptance tests with a steak in a Ruby on Rails application. Imagine that I want to test the functionality of a form.
- It must create a user if all fields are correct.
- You should not create a user if any of the fields is incorrect.
In the first case, the message will indicate that the user is created: "User created"
In the second case, error messages will indicate errors.
I can base my tests on the information displayed. That is, the first test passes if the correct message is displayed.
Or I can base my tests on database changes. That is, the first test passes if there is a new user in the database that contains the entered data.
Or I can argue for both conditions, the database should change, and the corresponding message should be displayed.
What is a conceptually adequate way to test this behavior against behavior-driven development?
What is the practical way to test this behavior, according to the pragmatic programmer?
source
share