Testo-lang: simple automation for complex tests

Automating End-to-End tests has never been easier

mouse_click_on_button_with_text "Save"
type_on_the_keyboard "Hello world"
wait_for_the_text_to_appear "Complete"
mouse click "Save"
type "Hello world"
wait "Complete"

OK, I’m listening

machine my_super_vm {
ram: 2Gb
cpus: 2
iso: "ubuntu_server.iso"
disk main: {
size: 5Gb
}
}
test my_super_test {
my_super_vm {
start
wait "Language"
press Enter
wait "Install Ubuntu Server"
press Enter
wait "Choose the language"
press Enter
# And so on
...
}
}
machine my_super_vm {
ram: 2Gb
cpus: 2
disk main: {
source: "prepared_vm.qcow2"
}
}
machine my_win_vm {
ram: 2Gb
cpus: 2
disk main: {
source: "my_windows_10.qcow2"
}
}
test my_installer_test {
my_win_vm {
# Power on the virtual machine
start
# Wait for the Desktop to show up
wait "Recycle Bin"
mouse dclick "my_super_installer"
wait "Welcome"
mouse click "Next"
wait "Destination folder"
mouse click "Next"
wait "Complete" timeout 10m
mouse click "Finish"
}
}

What is that “wait” of yours and how does it work?

Wait actions are not everything you might need

test my_super_test  {
my_super_vm {
exec bash "echo Hello world from bash"
exec python """
print("Hello from python")
"""
}
}
test copy_demo {
my_super_vm {
copyto "/file/on/host" "/file/on/guest"
copyfrom "/file/on/guest" "/file/on/host"
}
}

But why bother with the whole new language?

test run_installator {
my_super_vm {
copyto "/path/on/host.msi" "C:\\setup.msi"
mouse dclick "setup"
...
}
}

Wow, cool. What else can Testo do?

# Network to link up virtual machines
network net1 {
mode: "internal"
}
# Network for the Internet access
network internet {
mode: "nat"
}
machine my_super_client {
...
nic server_side: {
attached_to: "net1"
}
nic internet: {
attached_to: "internet"
}
}
machine my_super_server {
...
nic client_side: {
attached_to: "net1"
}
}
flash my_super_flash {
fs: ntfs
size: 2048Mb
# The folder on the Host to copy
folder: "/path/on/host"
}
test install_os {
...
}
test install_guest_additions: install_os {
...
}
test install_app: install_guest_additions {
...
}
test test_feature_1: install_app {
...
}
test test_feature_2: install_app {
...
}

A simple, yet quite real example

machine my_vm {
cpus: 2
ram: 4Gb
disk main: {
source: "${QEMU_DISK_DIR}/win10.qcow2"
}
}
flash my_super_flash {
fs: "ntfs"
size: 16Mb
folder: "./dist"
}
test launch_my_simple_app {
my_vm {
...
}
}
start
wait "Recycle Bin" timeout 10m
plug flash my_super_flash
mouse click "USB Drive (E:)"
mouse click "Open folder to view files"
mouse dclick "MySuperApp"
wait "Hello world"
test launch_my_simple_app {
my_vm {
start
wait "Recycle Bin" timeout 10m
plug flash my_super_flash
mouse click "USB Drive (E:)"
mouse click "Open folder to view files"
mouse dclick "MySuperApp"
wait "hello world"
unplug flash my_super_flash
}
}
sudo testo run my_script.testo --param QEMU_DISK_DIR /var/lib/libvirt/qemu/images

Conclusions

Head developer of Testo Framework

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store