-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the litmus wiki!
Litmus is an automated testing tool for tizen platform on arm devices.
This tool provides python APIs for controlling devices. (Flash binaries to device/ Power up and down device/ run commands on device/ push and pull files/ Take screenshots) And this also provides test project manager and test project launcher.
Litmus supports ubuntu distro only. (Ubuntu 14.04 and Ubuntu 16.04). If someone wants to use this tool and APIs on other linux distro, please contribute sources and packages, dependencies for that distro.
First, open the /etc/apt/sources.list.d/litmus.list file in your favorite editor. If the file doesn't exist, create it. And add entries for your ubuntu system.
For Ubuntu 14.04
deb http://download.tizen.org/live/Tools/Ubuntu_14.04/ /
For Ubuntu 16.04
deb http://download.tizen.org/live/Tools/Ubuntu_16.04/ /
Update apt cache.
sudo apt-get update
And install a package litmus.
sudo apt-get install litmus
Litmus project manager helps you to manage your test project with command line interface. First, list all of Litmus project on your environment.
litmus ls
Result:
=====list of all litmus projects=====
There's no test project. Let's create a new test project.
litmus mk <new test project name>
Example:
$ litmus mk 3.0-mobile-tm1
Enter the device type (u3/xu3/artik5/artik10/standalone_tm1/standalone_tm2/standalone_tw1/standalone_u3/standalone_xu3/empty): standalone_tm1
Enter descriptions for this project : my first test project for tm1 device
$ litmus ls
=====list of all litmus projects=====
3.0-mobile-tm1 (my first test project for tm1 device : /home/dhsshin/litmus/3.0-mobile-tm1)
You can see that the following project components exist under the project path.
-rwxrwxr-x 1 dhsshin dhsshin 0 10월 21 14:59 __init__.py
drwxrwxr-x 2 dhsshin dhsshin 4096 10월 21 15:05 __pycache__
-rwxrwxr-x 1 dhsshin dhsshin 162 10월 21 14:59 conf_mobile.yaml
-rwxrwxr-x 1 dhsshin dhsshin 263 10월 21 14:59 conf_tv.yaml
-rwxrwxr-x 1 dhsshin dhsshin 172 10월 21 14:59 conf_wearable.yaml
-rwxrwxr-x 1 dhsshin dhsshin 1507 10월 21 14:59 tc_mobile.yaml
-rwxrwxr-x 1 dhsshin dhsshin 723 10월 21 14:59 tc_tv.yaml
-rwxrwxr-x 1 dhsshin dhsshin 1519 10월 21 14:59 tc_wearable.yaml
-rwxrwxr-x 1 dhsshin dhsshin 1545 10월 21 14:59 userscript.py
These are config files and python scripts for your testing. If you run this test project with litmus test launcher then userscript.py is the entry point of this. Please open it.
#!/usr/bin/env python3
import os
from litmus.core.util import load_yaml
from litmus.core.manager import manager
from litmus.helper.helper import tizen_snapshot_downloader as downloader
from litmus.helper.tests import add_test_helper
def main(*args, **kwargs):
# init manager instance
mgr = manager(*args, **kwargs)
# init working directory
mgr.init_workingdir()
# get projectinfo
project_info = load_yaml('conf_mobile.yaml')
username = project_info['username']
password = project_info['password']
binary_urls = project_info['binary_urls']
# get version from parameter
# ex) 20160923.3
try:
version = kwargs['param'][0]
except (IndexError, TypeError):
version = None
# download binaries from snapshot download server
filenames = []
for url in binary_urls:
filenames.extend(downloader(url=url,
username=username,
password=password,
version=version))
# get an available device for testing.
dut = mgr.acquire_dut('standalone_tm1', max_retry_times=180)
# flash binaries to device.
dut.flash(filenames)
# turn on dut.
dut.on()
# run helper functions for testing.
if not os.path.exists('result'):
os.mkdir('result')
testcases = load_yaml('tc_mobile.yaml')
add_test_helper(dut, testcases)
dut.run_tests()
# turn off dut.
dut.off()
# release a device
mgr.release_dut(dut)