Set up Running Automated UI tests on your First day at work
Get started with web test automation quickly
If you start a new job in automated testing, you probably want to show your team an example of running a real automated test as quick as possible. I mean, in a matter of hours.
Table of Contents
· Installing Testing Tool: TestWise
· Verify Chrome Browser and Browser Driver
· Run the first test
· Create your first test project
Installing Testing Tool: TestWise
TestWise is a functional testing IDE that supports free, open-source test automation frameworks such as Selenium WebDriver, the most popular one that conforms to the W3C WebDriver standard. TestWise is the only software you will need to create and run tests for now.
Download the Ruby Edition of TestWise if you are on Windows. macOS and Linux users should install Ruby first, then TestWise Standard Edition (I will cover the use of Standard edition in another article).
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, simple restart TestWise, which takes only a few seconds.
Verify Chrome Browser and Browser Driver
Next, we want to verify the ChromeDriver for Chrome, otherwise you may not bel able drive the browser (for web testing).
TestWise Ruby Edition includes a version of ChromeDriver, in
C:\agileway\TestWise6\interpreters\ruby\bin . Make sure it matches the version of your Chrome.
To check your browser’s version you can go
Help > About Google Chrome
If the versions are not matching, download the correct version of ChromeDriver, and save it into
Run the first test
TestWise has a sample project that we can use to run our first test.
On the start screen, select
Open Sample Project (web app). There are several folders that use different frameworks but these are all the same tests on a demo website.
spec folder, click the test script file
01_login_spec.rb . The test script content will be opened.
Right-click a line under the test case name (
it “…” ) and select “Run …” to run the test case, or using the blue triangle button on the toolbar.
Here we can see that it successfully opens Chrome and drives the browser. Great! This means we can begin writing our own tests.
Create your first test project
Close the sample project (
File > Close Project) and create a new one (
File > New Project).
Fill in the pop up with appropriate details for your project. I will do an example on courtneyzhan.com.
When you create a new project, a project skeleton will be created. Write your first test in
new_spec.rb (feel free to rename this file later). And you can start writing your tests here!
Here is one simple test to verify that the navigation scroller scrolls correctly to the Contact section.
it "Scroll to Contacts" do
elem = driver.find_element(:xpath, "//ul[@id='js-scroll-nav']//li//a[text()='Contact']")
elem.click expect(page_text).to include("CONTACT ME")
sleep 0.5 # wait for JS scroll
contact_elems = driver.find_elements(:xpath, "//address/div")
current_url = driver.current_url
Run your test like in the animated gif above and congrats! You’ve written a test on your first day already!
Of course, it doesn’t stop here. Edit it, refactor it and write some more.
Recommend the following resources: