- What kinds of tests can we do in general?
User Acceptance Test
Integration Test
Unit Test
Stress Test
Profiling
- To implement Behaviour Driven Development:
- Which gems did we use?
capybara / rspec
- What does each of those gems do?
capybara
-> User Acceptance Testrspec
-> Unit Test
- What is the command to setup the BDD testing environment?
rails generate rspec:install
- Where do we put the spec files?
spec/features
- What is the naming convention of the testing files?
- It should end with
spec.rb
- What are the reserved keywords used in capybara?
- How to visit a path?
visit root_path
- How to fill the information to input text field?
fill_in 'Name', :with => 'Harry'
- How to click a submit button?
click_button 'Submit'
- How to check the resulting page to have certain text?
expect(page).to have_content 'Whatever'
- How to check the existence of CSS in the resulting page?
expect(page).to have_content 'container'
- Now, implement one test case in your own project.
Answers:
to run it:
or just
rspec
It is inside the home folder in the "spec" folder > "features".
filename_spec.rb
click_button