Complete Test with Verification
Explore how to create automated web tests using Ruby with Selenium WebDriver and the RSpec framework. Understand test structures like describe and it blocks, utilize before and after hooks, and implement verification checks to confirm expected page elements and user actions.
Web test drivers, such as Watir and Selenium WebDriver, drive browsers. However, to use them effectively for testing, we need to put them in a test framework that defines test structures and provides assertions (performing checks in test scripts after driving the application to a certain point).
In the context of web testing, typical checks are as follows:
Verify that specific texts are present
Verify the page title
Verify a link is present
Verify a web control is present or hidden
Basics of RSpec
RSpec is a popular test framework in Ruby. We can perform a standard gem installation to get it on our system.