Meaghan Lewis does some refactoring in order to clean up the test and make it more readable and also to have reusable methods that can be used in other tests in the future.
- [Instructor] Let's focus on cleaning up the steps…in the test to make them more readable.…Readability of a test is important…so that it is clear what the test is doing.…I'm going to focus on extracting similar functionality…and behavior into methods.…The first set of steps that I'll focus on…are from lines 19 to 34.…All of those steps focus on submitting the form.…There are many steps here but I can go ahead…and condense those steps down into one single method…which can submit the form.…
To do that, I'll start by copying lines 19…to 34…and then I can cut those lines.…And then after the main method of my test,…I will declare a new method by typing…public static void submitForm,…which is the name of the method.…And this method will take…WebDriver driver as the parameter.…
In the body of this method,…I will paste those lines from above that submit the form.…Now going back up to the test,…on line 19 I can call submitForm,…passing in the driver as a parameter…in order to call those lines that will submit the form.…Next, I'll copy these two lines, lines 21 and 22,…
- Using browser drivers and WebDriver
- Inspecting elements
- Selecting a locator
- Combining multiple CSS attributes
- Using common components
- Implicit and explicit waits
- Automating workflows
- Testing behaviors
- Using page objects
- Connecting to GitHub
- Running on the grid
- Using cloud-based testing tools
Skill Level Intermediate
1. Review Fundamentals
2. Succeeding with WebDriver
3. Using Advanced Locators
4. Interacting with Components
5. Synchronization Issues
6. Putting It All Together
7. Project Integration
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.