01: Hello Web Test Automation
Welcome to Learning Web Test Automation with short and purposeful exercises, no tech background is required at all.
I usually train web test automation in a format of one-day group training or one-on-one coaching. Most of the attendees are manual software testers and developers, i.e., they understand software, testing, HTML, or even basic programming. Recently, I experimented with training web test automation for two 100% laymen who were never involved with any software development. To put it simply, their knowledge of the web is limited to web browsing.
Furthermore, they did not have the plan or desire to work in software yet. If the content is not interesting, I will lose their attention easily. My usual 8-hour training does not apply to them. Therefore, I came up with a series of bite-sized test automation training. One short session, typically 15–30 minutes, per day. A session consists of
a few minutes of introduction
an easy-to-understand test case (test steps listed)
hands-on working on the test case (under my coaching)
“Test Automation is super practical. The best way to learn and master Test Automation is by doing many exercises, preferably guided high-quality exercises, hands-on.“ — Zhimin Zhan
Bite-sized Learning: Small, Short, and Focused
I designed each session with a focused purpose which will typically take 15–20 minutes to complete.
It starts with a few slides (in Keynote):
My explanation would be short and often complemented by live demonstrations.
Then the two attendees will start to work on the exercise. I will provide coaching support when help is required.
Some might wonder: “Is there really any value in reading your workbook without your personal coaching?”. The answer is YES. A common reason few people learn web test automation well is that there is a lack of high-quality exercises. The new-to-automation testers often fail to complete the real works tests when the test scripts get a bit more complicated than the “hello-world” test. Subsequently, they will give up test automation and get back to manual testing. Upon completing a set of purposely designed exercises, I believe the testers will be armed with the knowledge of dealing with more complicated test scenarios and more confident to attempt the test automation further in their job.
In the upcoming articles, I will post recent sessions with some exercises, which you might be surprised by what two laymen could achieve in such a short time. You can practice these exercises at work/home.
Will I continue publishing the Web Test Automation Workbook on Medium or even a book? I don’t know yet as it will take me quite some effort to turn my verbal coaching into words. But if you are really keen, please leave a message.
Learning Objectives
View Test Automation in a Chrome Browser
Install test automation tool from scratch
Run an automated test
Best Practice
Run a test case and keep the browser open.
You can inspect the page in Chrome, which is very useful for debugging test script failures. For beginners, just remember this concept: after the test execution, I can still use the app in that browser window.
For more check out my other article, My Innovative Solution to Test Automation: Keep the Browser Open after Executing an Individual Test.
Tasks
Task 1. Demo
Usually, on my first coaching session, I start with a live demonstration of test execution. Quite often, after the demo (quick), new-to-automation learners are quite impressed, then I tell them: “You will be able to get all set up and run one test like me, in about, …, 8 minutes”. This would get the attendants excited. They felt happy after achieving that minutes later.
It does not matter which test to run, this is just to get a feel of web test automation execution:
Trigger a run in a test tool (or command line)
A Chrome browser is launch
Drive the application (in the Chrome browser) quickly, ‘using’ the keyboard and mouse.
The chrome browser is closed
Ideally, choosing a test scenario that is related to the audience. When I do on-site training, whenever possible, I will spend ~30 minutes creating one or two real tests, with the help of the staff showing me the manual steps.
Task 2. Set up Test Automation Tool (for execution)
Setting up test automation (from scratch) can be simple and easy (only a few minutes). My daughter did that at the age of 12. Below is an excerpt from my daughter’s article: Set up, Develop Automated UI tests and Run them in a CT server on your First day at work.
We will write Selenium WebDriver tests in Ruby language using the TestWise tool. I know some have questions, see the FAQ section (at the bottom). In the meantime, I want attendants to complete the steps, after all, we have a goal to achieve: running your first automation in 8 minutes or less.
Download the Ruby Edition of TestWise if you are on Windows. macOS and Linux users should install Ruby first, then TestWise Standard Edition (see the instruction here).
TestWise Ruby Edition =
TestWise Standard Edition + Ruby + Testing Libraries + ChromeDriver
Launch TestWise. You will see the following popup window for 10 seconds. Click the “Continue” button. You may use TestWise in this free (and full-featured) mode forever, after 15 test executions, simply restart TestWise, which takes only a few seconds.
You don’t need to purchase a license. You may use TestWise in free mode forever.
TestWise has a sample project that we can use to run our first test.
On the start screen, select Open Sample Project (web app)
.
You will see some folders (on the left), which contain the same set of tests for different languages. Ignore that for now.
Expand the spec
folder, click the test script file 01_login_spec.rb
. The test script content will be opened.
Verify Chrome Browser and Browser Driver
Next, we want to verify the ChromeDriver on your machine. Without it, you cannot drive the browser (for web testing).
TestWise Ruby Edition includes a version of ChromeDriver, in C:\agileway\TestWise6\interpreters\ruby\bin
. (For TestWise standard edition, you need to install your own. This is very simple to do, just download the ChromeDriver and put it in PATH,
view the tutorial screencast). Make sure it matches the version of your Chrome.
To check your browser’s version you can go
Help > About Google Chrome
To check the ChromeDriver version, run> chromedriver --version
from the command line.
If the versions are not matching, download the correct version of ChromeDriver, and save it into C:\agileway\TestWise6\interpreters\ruby\bin
.
Task 3. Run one automated test yourself
In TestWise, right-click a line between a test case (between it "...." do
and end
), and select “Run …” (the …
is the test case name, for the example below, “[1] User failed to sign in due to invalid password”)
A Chrome browser window will launch to run a login test.
FAQ
1. Is this series specific to the Selenium Test Automation framework?
Yes or No. In many ways, all test automation frameworks do the same thing: driving the web apps based on W3C technologies (HTML, CSS, …). So, for learning purposes, most of this series’ content applies to all test automation frameworks/tools. By the way, Selenium WebDriver is W3C’s standard, the only automation framework supported by all browser vendors (Google, Apple, Mozilla, and Microsoft).
All the test scripts are in raw Selenium WebDriver in Ruby language.
2. Scripting Language: Ruby?
Selenium has five official language bindings: Ruby, Java, Python, JavaScript and C#. Learning test automation in Ruby is easiest for beginners (and fun to use for professionals). Once you master one language, scripting in another is easy as the selenium syntax are all similar among all languages.
3. Testing tool: TestWise?
TestWise (former name: iTest2) was demonstrated at the Agile 2009 conference’s AAFTT workshop in Chicago, listed as the first testing tool by Agile testing book author Lisa Crispin, and a finalist in the 2010 Ruby Award. By the way, you may use fully functional TestWise in free mode forever, with a minor constraint (simply re-launch TestWise after exceeding the execution limit).
You can use any programmer editor, such as Visual Studio Code, to do the exercise in this workshop. There is no dependency on TestWise here.
“There’s more than one way to skin a cat.” I will show one way, and you might find my way helpful even with your choice of tool.