>If all fields If everything is correct, the user should be created.
>If any of the fields are incorrect, the user should not be created.
In the first case, a message will inform the user that the user has been created:’User has been created ‘
In the second case, the error message will indicate the error.
I can test based on the displayed information. That is, if the correct message is displayed, the first The first test passed.
Or I can test based on changes in the database. That is, if the database has a new user with input data, the first test passes.
Or I can assert these two conditions, the database should be changed and the corresponding message should be displayed.
According to behavior-driven development, what is the concept of testing this behavior according to a conceptually appropriate method?
According to practical programmers, what is the actual way to test this behavior?
In your case, I will make sure that a success message appears afterwards, and then I will (if possible) Look for data on the screen indicating that the application knows the object. For example, if you add a comment to a blog post, you should fill in the post, click the “Accept” button, view the “Posted Message” success message, and then mark you on the page The content is treated as a new post.
You should use unit and sometimes controller tests to back up user-driven BDD tests to ensure that everything behind the scenes works properly.
I I tend to use RSpec and verify that things have been added to the database, the method is returning expected results, etc. But I also use Cucumber to make sure that the user sees what the user expects to see (but I don’t really let Cucumber care about what is in the DB .
I hope this helps. If you don’t use Cucumber, I highly recommend it for BDD testing with RSpec. You should check out this book (available in electronic PDF format) – I’ll start from there, It is helpful to my test practice:
http://www.pragprog.com/titles/achbd/the-rspec-book
I use Steak for acceptance testing on a Ruby on Rails application. Imagine that I want to test the functionality of a form.
>If all fields are correct, users should be created.
>If any of the fields are incorrect, the user should not be created.
In the first case, a message will inform the user that the user has been created:’User has been created’
In the second case, the error message will indicate the error.
I can test based on the displayed information. That is, if the correct message is displayed, the first test passes.
Or I can test based on changes in the database. That is, if the database has a new user with input data, the first test passes.
Or I can assert these two conditions , The database should be changed and the corresponding message should be displayed.
According to behavior-driven development, what is the concept of testing this behavior according to a conceptually appropriate method?
According to the practical programmer, What is the actual way to test this behavior?
My BDD practice involves And use Cucumber. I try my best to keep what the user sees. That is, any When and Then statements should reflect user input or user visual effects.
In your case, I will make sure that the success message appears afterwards, and then I will (if possible) look for data on the screen indicating that the application knows the object. For example, if you add a comment to a blog post, you should fill in the post and click the “Accept” button , Check the “Posted Message” success message, and treat your content as a new post on the page.
You should use unit and sometimes controller tests to back up user-driven BDD tests to ensure behind the scenes All of the content works fine.
I tend to use RSpec and verify that things have been added to the database, the method is returning expected results, etc. But I also use Cucumber to make sure that the user sees what the user expects to see (But I don’t really let Cucumber care about what’s in the DB.
I hope this helps. If you don’t use Cucumber, I highly recommend it for BDD testing with RSpec. You should check it out This book (available in electronic PDF format)-I started there, and it helped my testing practice:
http://www.pragprog.com/titles/achbd/the -rspec-book