How do I Start Test Automation on Day 1 of Onboarding a Software Project?
Making a good impression, End-to-End (via UI) Test Automation can be real, useful, and proven quickly.
I switched my day work from Programming (a 10X Java contractor) to Automated Testing in 2010. Since then, I have worked on many software projects as a test automation engineer.
From my experience, many software teams only have a vague idea about test automation, as only a few have witnessed a successful one. The management commonly hires a test automation engineer because the existing manual testing was highly stressful, and they hoped for relief.
Day 1 here I mean the first day that I got the resources (computer, accounts, access permissions, …) to do the work.
Onboarding a software project, a new team member needs a starting time (e.g. online training). People usually don’t expect a newbie to get real work done in the first week or two, which is plenty of time for good test automation engineers to set up a proper continuous testing process. For me, 1 day is enough. My Day 1 work (with viewable achievement) usually made a great impression at the start.
I use all free, popular and open frameworks: raw Selenium WebDriver (the dominating web automation framework, only one conform W3C standard) and RSpec (v3.8.0 has over 200 million downloads). Developed in TestWise IDE (with free mode) and run in international award-winning BuildWise CT server (free and open-source).
∘ 1. Learn about the simple and typical test case
∘ 2. Write a few automated tests
∘ 3. Show it to the colleague
∘ 4. Set up a BuildWise CT server and run all automated tests there
∘ Can these really be done within one day?
∘ FAQ (3)
1. Learn about the simple and typical test case
Usually, you know what kind of application already (from the interview) you are going to test. Typically, a web app. Spend ~30 minutes to understand the purpose of the app. This will help you understand the business steps shown in the app.
Before asking my colleagues to show me some business scenarios, I would read (such as Confluence and manual test cases) and observe to have a fair idea first. The first impression is important, as those poor manual testers or business analysts were usually quite stressed.
Generally speaking, no matter how complex a system is, there is a core workflow. After understanding that, you will get the big picture. For example, lodging a claim is the core business workflow. Yes, there are many claim types (property, car, …) and many further operations (review, reject, approve …). Don’t worry about others yet, just focus on the simplest (and quickest) core workflow. In fact, many business analysts do that daily.
The main business flow of the WhenWise booking app, which has 559 selenium tests. But this is one of several key tests, developed and run in TestWise IDE.
2. Write a few automated tests
That’s the easy part. The process and knowledge of developing automated tests for websites are exactly the same. I have been developing tests exactly the same way since 2011 (if relaxing the framework, including Watir, 2006).
I would start with a few simple and generic test cases first, such as
sign in (OK and Fail), sign out
sign up
user change profile
sign in different roles (e.g. applicant, manager) and perform permission checks
Below is the full test script of two user login test cases.
load File.dirname(__FILE__) + "/../test_helper.rb"
describe "User Authentication" do
include TestHelper
before(:all) do
@driver = Selenium::WebDriver.for(browser_type, browser_options)
driver.get(site_url)
end
after(:all) do
driver.quit unless debugging?
end
it "User can sign in OK" do
sign_in("agileway", "testwise")
expect(page_text).to include("Signed in!")
sign_off
end
it "User can sign in failed" do
sign_in("agileway", "badpass")
expect(page_text).to include("Invalid email or password")
end
end
The above test cases are just the Entrée, as I have done the above for many websites (virtually identical), so it is really a walk in the park (probably take me 1 hour for about 7–9 simple test scenarios, including the automation setup: Ruby, Selenium, TestWise). By doing that, I got to verify any test automation environment setup issues, such as whether ChromeDriver matches the Chrome browser, any weird Chrome installation location …, etc.
Then I quickly move on to an automated test for the main workflow. In the early years, I usually need some help from a business analyst or manual tester to show me the steps.
In 2009, I figured out a better way. I ask one colleague to record a video of navigating the app’s main business flow (in the browser). Many video conference tools, such as Microsoft Teams (scheduling a meeting with yourself), Skype and Zoom. It is easy to use, and most IT people know how to do this already.
There are many benefits to getting the screencast video:
Time-Saving and less interruption to others.
Suitable for remote working as well (which is quite important nowadays)
You don’t need to go back to bother others
You can watch the parts repeatedly
Occasionally, there are demo videos exist already
(another one, which I will reveal in a moment)
After verifying the test case is working, do spend time refactoring all test cases based on the Maintainable Automated Test Design. To make the test script appealing to non-tech manual testers and business analysts.
Below is an automated test script for a typical CRM Field Service workflow.
load File.dirname(__FILE__) + "/../test_helper.rb"
describe "CRM Invoice a completed Work Order" do
include TestHelper
before(:all) do
@driver = Selenium::WebDriver.for(browser_type, browser_options)
@driver.navigate.to(site_url)
driver.manage().window().move_to(200, 0)
driver.manage().window().resize_to(1080, 720)
reset
sign_in("pool@biz.com")
# Receptionlist create an appointment for tomorrow
visit("/calendar")
calendar_page = CalendarPage.new(browser)
try_for(4, 2) { calendar_page.click_next }
calendar_page = CalendarPage.new(browser)
calendar_page.click_time_slot(5)
calendar_new_modal_page = CalendarNewModalPage.new(browser)
calendar_new_modal_page.select_client("Tom Cruise")
calendar_new_modal_page.click_create
calendar_page.click_event_with_title("Tom Cruise - Comprehensive service")
calendar_booking_modal_page = CalendarBookingModalPage.new(driver)
calendar_booking_modal_page.click_new_work_order
calendar_booking_modal_page.enter_instruction("New Customer")
calendar_booking_modal_page.click_create_work_order
calendar_booking_modal_page.click_close_icon
end
after(:all) do
@driver.quit unless debugging?
end
it "Receptionlist invoice a completed work order by the technician" do
visit "/work_orders"
# Start another Chrome browser, login as a technician
driver2 = Selenium::WebDriver.for(browser_type, browser_options(:showcase => true))
driver2.manage().window().resize_to(768, 720)
driver2.manage().window().move_to(0, 0)
driver2.get(site_url + "/a/uniq-access-token-15") # Trevor
resource_dashboard_page = ResourceDashboardPage.new(driver2)
driver2.find_elements(:class, "tomorrow_work_order")[0].click
work_order_page = WorkOrderPage.new(driver2)
work_order_page.click_client_name
client_summary_modal_page = ClientSummaryModalPage.new(driver2)
client_summary_modal_page.click_close
work_order_page = WorkOrderPage.new(driver2)
work_order_page.click_client_address_icon
map_modal_page = MapModalPage.new(driver2)
map_modal_page.click_close
work_order_page.click_start
work_order_page.click_add_change_fees
determine_fee_modal_page = DetermineFeeModalPage.new(driver2)
determine_fee_modal_page.clear_billing_code
determine_fee_modal_page.enter_billing_code("p1")
determine_fee_modal_page.select_qty(3, 2)
determine_fee_modal_page.click_add(3)
determine_fee_modal_page.select_overall_discount_percentage("20%")
determine_fee_modal_page.click_save
# complete the work and create a work order
work_order_page.click_complete
expect(work_order_page.status).to eq("completed")
driver2.quit # close the technician window
# back to main window (Receptionlist)
driver.navigate.refresh
driver.find_element(:id, "completed-work-orders").find_elements(:class, "work_order").first.click
work_order_page = WorkOrderPage.new(driver)
work_order_page.click_generate_invoice
generate_invoice_modal_page = GenerateInvoiceModalPage.new(driver)
generate_invoice_modal_page.click_generate_invoice
invoice_page = InvoicePage.new(driver)
expect(invoice_page.total_amount).to eq("A$132.80")
invoice_page.click_work_order_link
work_order_page = WorkOrderPage.new(driver)
expect(work_order_page.status).to eq("closed")
end
end
A business analyst (without coding knowledge, but familiar with business logic) can largely understand the above automated test script.
3. Show it to the colleague
Testing is about feedback. Once I completed one main test case, I recorded the execution into a screencast video. One interesting comparison shows up. For example, in one project, the length of a business analyst’s video was 12 minutes, while the same steps captured in test automation execution were only 3.5 minutes. That’s a saving of 70%.
Every single time, the business analyst or manual tester (whoever sent me the original manual video) was deeply impressed. Usually, they would come and view it live. Then, TestWise’s feature “Keep the Browser Open after Executing an Individual Test” would be very helpful. After the test execution completes (invoked from TestWise), the business analyst could take over the control to verify or navigate in the Chrome browser. If they found some issues or room for enhancements, I could get it done on the spot, using TestWise’s “Attach test execution to the existing browser” feature.
This business analyst or manual tester would be impressed by:
Speed (execution)
Speed (how long does it take me to create this test)
Readability of test script (at least not fear of it)
Easy to run (see this article for examples)
10 out of 10, they would tell others. This will make the wide adoption of automation easier, such as “generating test data” and using automation in showcases.
4. Set up a BuildWise CT server and run all automated tests there
After Step 2, I might receive more scenarios to automate. But I will do another important thing first: setting up a BuildWise CT server.
Again, exactly the same for all companies, since 2014 (I made BuildWise v1.0 publicly available in 2017, but I did use BuildWise beta a few years successfully before that). I installed BuildWise on my local machine (this way, much easier, politically).
I put the test scripts in a Git repository (local) and created its parent Git repository on a shared network drive (preparing for later, as some will want to run the test script themselves).
Set up a build project on BuildWise to run all the test cases (~10). With a click of a button, I get a test report like the one below.
If there were good infrastructure support, I would set up several build agents to run these tests in parallel.
Can these really be done within one day?
Yes, technically, ~ 4 hours. In fact, my daughter did that too after Uni, on her first intern job. Read her article, “Set up, Develop Automated UI tests and Run them in a CT server on your First day at work”.
Please note, the above is pretty much universal, at least to me, I achieved that on every client project (excluding non-technical factors), regardless of the coding language the target web app was developed in.
FAQ (3)
Only available for paid subscribers.
Keep reading with a 7-day free trial
Subscribe to AgileWay’s Test Automation & Continuous Testing Blog to keep reading this post and get 7 days of free access to the full post archives.