In this video, Meaghan Lewis shares principles to use in order to create tests that are reusable and maintainable. Meaghan extracts variables from the test to make it cleaner and easier to read.
- [Instructor] This chapter is all about…design principles and how to create tests…that are reusable and maintainable over time.…Having clean and readable test…is one good way to make that happen.…Whenever possible try to minimize the lines of code…per test class and to not repeat steps…over and over.…If after writing a test there are some lines…that are repetitive, this is an indication…that they can be extracted…into reusable variables and methods.…Let's take a deeper look…at the test that we have been working on…in this course, and see if there's anything…that would be good to extract.…
First I notice that there is a lot of string input…when sending keys to the elements on lines 14,…17, 20,…and 28.…It is a good idea to extract their strings…into variables that they can be easily reused…in the future and changed later if needed.…I'll do that now starting with the user name.…At the top of my class…I'm going to define a global variable called username,…and what I'm going to do is copy…the string input that we send the username field…
Find out how to set up the test-writing framework, WebDriver, and Selenium Grid, which allows you to distribute the testing load and run tests against a remote server. Learn best practices to write effective tests using variables and functions, and to organize tests into suites that can scale over time. Instructor Meaghan Lewis—a QA engineer at GitHub—also explains the test pyramid paradigm, which details an ideal way to balance unit, integration, and UI testing.
- Setting up Selenium WebDriver
- Using the Selenium grid to distribute the testing load
- Setting up a hub and nodes
- Writing clean test code
- Organizing a test suite