Set up and Develop Appium WinApp RSpec Test Scripts with TestWise IDE

A step by step guide (with video) to create a test project for a Appium WinAppDriver+RSpec test script for classic Windows Apps in TestWise IDE.

Courtney Zhan
5 min readNov 12, 2023


The video below uses an Appium + WinAppDriver script to:

  • Launch the TestWise IDE.
  • Create a new Appium WinAppDriver + RSpec test project in TestWise IDE.
  • Script an Appium script to drive the Windows Notepad program.
  • Execute the newly created Appium test.

All ~70 seconds. (fully automated, no human intervention)

The automation script: Appium 2 + WinAppDrver, developed and run in TestWise IDE.

This article shows how you do it step by step.


1. Install Appium Server and it is up running

  • Install Node.js
  • Install Appium 2
    npm install -g appium
  • Install Appium WinAppDriver
    appium driver install windows
  • Start Appium Server
Sample output for Appium Server Startup

Run all these commands in a command window. To know more about Appium and setting it up for Windows, see this article.

2. Install Ruby and Test libraries

  • Install Ruby
    Check out this guide in my other article.
  • Install Ruby Appium and Test libraries
    gem install — no-document appium_lib rspec

1. Verify Test Execution Setup

I have a habit of immediately verifying the operation. Execute the following commands in a terminal.

> cd 
> git clone

If you don’t use Git (for version control), I highly encourage learning it, and it is quite easy to use. Check out 10-Minute Guide to Git Version Control for Testers.

You will find a set of folders and files under ~/buildwise-samples . In the same terminal window, run the two commands (one by one)

> cd buildwise-samples\e2e-rspec-appium-windows\spec
> rspec notepad_spec.rb

You shall see a Notepad window launch and some text typing in it.

2. Install TestWise IDE

Since the Appium RSpec test scripts are Ruby files, you may use any programmer editor, such as Visual Studio Code or Ruby-specific IDEs, such as RubyMine.

TestWise IDE is a Next-Gen Functional Testing IDE designed for E2E testing. I learned Test Automation with TestWise(Disclaimer: My father created TestWise). You may use TestWise in free mode with just minor constraints (relaunch the app after 15 test executions).

You may choose any tool to develop Appium test scripts (in plain text). That’s the beauty of being open-source and in a well-known language.

If you are not using TestWise, I encourage you to explore the test project structure that TestWise uses. It is simple and embraces the Maintainable Automated Test Design, which has been well-proven in many successful test automation projects. You can take advantage of the proven structure and supporting files (e.g. helper and page classes) even using a different testing tool.

3. Create a Test Project and your first Selenium RSpec test script in TestWise IDE.

TestWise uses the concept of ‘Project’ to confine the test scripts and supporting files.

1. Click menu ‘File’ > “New Project”.

Fill in the following information:

Project name: <any text>
Location: <an empty folder>
Automation Driver: Appium
Test Script Syntax: RSpec
App Executable: <the path to a program executable>

2. Click the “OK” button to create the test project.

Here is how the test project’s skeleton looks like in TestWise.

A brief explanation of the folder and files:

  • spec Folder:
    Contains test script files in the format of XXX_spec.rb
  • pages Folder:
    Contains the page classes (see Page Object Model), the abstract_page.rb is already created.
  • test_helper.rb
    Shared test helper (see Maintainable Automated Test Design)
  • Rakefile & buildwise.rake
    For integrating with the BuildWise CT Server.
  • agileway_utils.rb
    For integrating with the TestWise IDE.
  • XXX.tpr File
    TestWise project file.

4. Create your first Appium WinAppDriver RSpec test in TestWise IDE.

Now, let’s create a raw Appium WinAppDriver RSpec test script quickly in TestWise.

3. Run the empty test script

Click new_spec.rb (in the PROJECT EXPLORER pane on the left) to open in an editor.

Right-click any line in the test case it "Test Case Name" do and select “Run “Test Case Name”” to run this individual test case.

You shall see a Notepad window launch.

This means that the test setup is fine.

4. Write Appium test statements in TestWise.

Here, I won’t explain Appium script syntax, for that, check out my father’s book “Practical Desktop App Test Automation with Appium”.

If you are already familiar with Selenium WebDriver and TestWise, you understand immediately. Below is an example.

driver.find_element(:name, "Untitled — Notepad").send_keys("Cool")

For this exercise, this Appium script does the following.

  • Launch Notepad
  • Typing some text
  • Click File -> Save menu
  • Enter a file name in the pop-up “Save as” dialog.
    Please note, this is another window. Native app test automation differs from web test automation, which we mostly just interacts with one application: browser.
  • Close Notepad

Test Script

Automation Framework: Appium 2 (v2.1.3, WinAppDriver: 2.12.1)
Test Syntax Framework : RSpec

load File.dirname(__FILE__) + "/../test_helper.rb"

describe "06 Create a new Appium WinApp RSpec project" do
include TestHelper

before(:all) do
# close_all_testwise

custom_caps = {}
@driver = $driver = if Appium::VERSION.to_i >= 12
# Appium Lib Version => Appium Version, 12 for Appium 2
else, true).start_driver
sleep 0.5 # add a sleep for app window to show up
FileUtils.rm("C:\\temp\\foo.txt") if File.exists?("C:\\temp\\foo.txt")
@main_window =, testwise_version + " - AgileWay")

before(:each) do
sleep 0.5
@main_window.send_keys([:control, :shift, "n"])
sleep 0.25

after(:each) do
sleep 0.1
@main_window.send_keys([:control, :shift, "x"]) # close project

after(:all) do
sleep 0.1
driver.quit unless debugging?

it "06 New Appium WinApp RSpec project" do
new_project_dir = tmp_dir("t6")
FileUtils.rm_rf(new_project_dir) if Dir.exist?(new_project_dir)
puts("will create a new project in this dir: #{new_project_dir}")

new_project_dialog =

sleep 0.5

sleep 0.5
editor_text = get_current_editor_text()
expect(editor_text).to include("Appium::Driver")

goto_line("18, 15")
main_window.send_keys([:control, "i"])
main_window.send_keys("Edit in NotePad")

main_window.send_keys([:control, :shift, "c"], :backspace)
sleep 0.25

#main_window.send_keys("driver.find_element(:id, \"username\").send_keys(\"agileway\")", :enter)
main_window.send_keys("driver.find_element(:name, \"Untitled - Notepad\").send_keys(\"TestWise is Cool\")", :enter)
main_window.send_keys("main_win = ")
main_window.send_keys("driver.find_element(:name, \"*Untitled - Notepad\")", :enter)
main_window.send_keys("main_win.send_keys([:control, \"s\"])", :enter);
main_window.send_keys("sleep 1", :enter)

main_window.send_keys("save_as_win = driver.find_element(:name, \"Save As\")", :enter)
main_window.send_keys("save_as_win.send_keys(\"C:\\\\temp\\\\foo.txt\")", :enter)
main_window.send_keys("save_as_win.find_element(:name, \"Save\").click", :enter)

main_window.send_keys("main_win.send_keys([:alt, :f4])", :enter)

sleep 1


sleep 10

run_results = ""
try_for(9, 3) {
run_results = get_current_run_panel_csv
puts run_results.inspect
expect(run_results).to include("OK")

Run this script and you will see Notepad open, type “TestWise is Cool”, then save — just like the video above.