Giter Club home page Giter Club logo

fmbt's Introduction

The fMBT (free Model-Based Testing) tool automatically generates and
executes tests. It is suitable for testing anything from individual
C++ classes to GUI applications and distributed systems containing a
range of different devices. fMBT provides a model editor, test
generator, adapters for various purposes and tools for analysing logs.


Building & installing
---------------------

Quick start for Docker users:

    Build an image including commandline and GUI utilities:

    docker build . -t fmbt-gui:latest -f Dockerfile.fmbt-gui

    See Dockerfile.fmbt-gui on running fmbt3-editor from the image.

Quick start for Debian 11 / Ubuntu 22.04 and later users:

    ### Note: use fmbt3-editor instead of fmbt-editor.
    sudo apt install -y autoconf automake build-essential debhelper flex gawk git-core gnuplot graphviz imagemagick libboost-dev libboost-regex-dev libedit-dev libglib2.0-dev libmagickcore-dev libpng16-16 libtool libxml2-dev python2 python2-dev python3-pexpect python3-distutils python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets tesseract-ocr
    ./autogen.sh && ./configure && make -j 4 && sudo make install
    cd utils3 && sudo make install

Quick start for Debian 10 / Ubuntu 20.04 users:

    ### Note: use fmbt3-editor instead of fmbt-editor.
    sudo apt install -y autoconf automake build-essential debhelper flex gawk git-core gnuplot graphviz imagemagick libboost-dev libboost-regex-dev libedit-dev libglib2.0-dev libmagickcore-dev libpng16-16 libtool libxml2-dev python python-dbus python-dev python3-pexpect python3-distutils python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets tesseract-ocr
    ./autogen.sh && ./configure && make -j 4 && sudo make install
    cd utils3 && sudo python3 setup.py install

Quick start for Debian 9 / Ubuntu 18.04 and earlier users:

    sudo apt-get install build-essential libglib2.0-dev libboost-regex-dev libedit-dev libmagickcore-dev python-dev python-pexpect python-dbus python-gobject gawk libtool autoconf automake debhelper libboost-dev flex libpng16-16 libxml2-dev graphviz imagemagick gnuplot python-pyside tesseract-ocr

Quick start for Fedora users:

    yum install  glibc-devel glib2-devel boost-devel libedit-devel gcc-c++ pexpect dbus-python libtool dh-autoreconf flex libpng12 libxml2-devel graphviz ImageMagick ImageMagick-devel gnuplot python-devel python-pyside tesseract

Quick start for Arch users (assuming base and base-devel to be installed):

    pacman -S libedit imagemagick libxml2 boost python2 python gnuplot graphviz gts leptonica tesseract tesseract-data python-pexpect python-dbus boost libtool flex imagemagick python2-pexpect python2-pyside python-pyside-common python2-shiboken

    You will also need X (xorg-server) in order to use fmbt-editor and
    fmbt-scripter.

./autogen.sh # run only if you cloned sources from git
./configure  # add parameter PYTHON=python2 when building on Arch Linux
make
sudo make install

Known issue with Fedora and Arch Linux: By default "make install"
installs Python libraries into directories that are not in the default
PYTHONPATH. Add them to the path:
    export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages:/usr/local/lib64/python2.7/site-packages

Windows users:

See README-windows.txt for building fMBT for Windows.


Binary downloads
----------------

See artifacts built in gitlab CI/CD pipelines.

https://gitlab.com/fmbt/fmbt_ci/pipelines


Getting started
---------------

1. Create a model and a test configuration:

   fmbt-editor helloworld.aal helloworld.conf

2. Run the first test:

   fmbt -l first.log helloworld.conf

3. See what it executed:

   fmbt-log first.log


Documentation
-------------

doc/aal_python.txt
        AAL/Python language reference documentation.

doc/configuration.txt
        Test configuration reference documentation.

https://github.com/01org/fMBT/wiki/GUI-testing
        GUI testing interfaces for Android,
        Tizen, VNC, Windows and X11.


Examples
--------

examples/filesystemtest
        Test a filesystem: mkdir, rmdir, access.

examples/c++-unittest
        Test a C++ class.

examples/javascript-unittest
        Test a JavaScript API in a browser.

examples/python-unittest
        Test a Python class.

https://github.com/askervin/fmbt-mplayertest
        Test MPlayer's pause, continue, next song, prev song, add
        song, and reset playlist.

https://github.com/askervin/fmbt-androidtest
        Test the phone application on Android: make calls, put calls
        on hold, swap calls, hang up calls from the phone application
        and homescreen menu.


fMBT self-tests
---------------

make check
        Run tests against the source tree as it is.

test/git-HEAD/run.sh
        Run tests against the latest commit in the current git branch.

fmbt's People

Contributors

acozzette avatar aleksihakli avatar askervin avatar bart0sh avatar cosminniculae avatar dweineha avatar jukkalau avatar jukkasc avatar mlq avatar pablovirolainen avatar rseymour avatar shadeimi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fmbt's Issues

unlock method didn't work

Hello, my .py script contains following code:

import fmbttizen, time
d = fmbttizen.Device()
d.enableVisualLog("device.html")
d.pressHome()
time.sleep(1)
d.refreshScreenshot()
if d.verifyBitmap("lock.png"):
d.swipeBitmap("lock.png", "east")
time.sleep(1)
d.pressHome()

My lock.png is a static central part of my lockscreen.png. When I run this script, my device is turn on and off (after 5 secpnds) then nothing happens, script was finished. It looks like this script don't have anough time to unlock the screen, because if I tap Back button to prevent tuning screen of - it works (but without any animation). How can I solve this?

tizen - ability to measure loading time

hello,
is there any ability to measure time of loading an application as example? As I understand, from help(wait) method, I can set pollDelay time, what is the minimal value of this parameter? In my script, test spent 9 seconds for d.waitBitmap() method, but an app have loading time around 2 seconds. Is that possible for me to create a method, that will capture screenshots every ~0.5 seconds, check them for bitmap and return a number or a time, when this bitmap was found first time?

using model as an adapter only ?

i have a model with 63 actions with adapter blocks, i understand that to use the aal file as an model only , i just need to leave the apdater out in the conf file, still it took about 12 minutes to generate the testcase with converage perm(1) .

my question is :
can i still use the adapter in the model with genereated offline testcase in the log file, or i have to write testcase executor code to read the offline testcase and exect it like in the fllowing(this is a simple case, i some case it may become complicated and I ended up with lot duplicate code -- one in model adapter block and one in offfline testcase executor ):

##########################################
# Generate and run the test.

# This is an "offline" test: test.conf does not define an
# adapter. fmbt only generates and simulates the test run. Yet nothing
# is actually executed, simulated test steps are logged.
#
# We use fmbt-log to pick up the generated test from the log. Then we
# call the corresponding test step (shell function) for each step:

fmbt test.conf | fmbt-log -f '$as' | while read teststep; do

    if eval "$teststep"; then
        echo "pass"
    else
        echo "fail"
    fi

done

fmbttizen: user should be able to define how to launch Python on device

Python may not be in PATH, or there may be several Python versions installed on Tizen mobile/IVI. User should be able to choose which Python is used for running the fMBT Tizen agent on the device.

For instance,

import fmbttizen
dut = fmbttizen.Device(python="/opt/python/bin/python")

Typing non-ascii characters doesn't work

It seems that typing non-ascii characters like 'ö' and 'ä' is not working at least with the X11 and Windows platforms. For example:

import fmbtx11
screen = fmbtx11.Screen()
screen.type(u'aäa')

Simulates only the two a-characters and skips the ä-character. Are there plans to add support for typing arbitrary unicode characters?

fmbt-editor not found

Following the archlinux guide on the README.txt, using ./configure PYTHON=python2, i got at the end of the process:

21:47 $ fmbt-editor
Traceback (most recent call last):
File "/usr/local/bin/fmbt-editor", line 66, in
import fmbt_config
ImportError: No module named fmbt_config

fmbt on Tizen Emulator and commercial devices

Hi, is it possible to run fmbt tests on Tizen emulator? (unfortunately I can't check that cuz emulator don't working on the virtual machine) or mb there are any possibilities to connect emulator from local pc to the vm?
And the second question is - will it be possible to run on devices without root access?

adapter questions

questions 1:
The adapter stack section in the adapter documents , are they corresponding to the adapter section in configuration documents? like:

adapter_remote <---> remote(<command>)

adapter_mapper <----> mapper(<filename>)

adapter_dlopen <---> lib(<adaptername,[filename])

question 2:
What is the difference between remote_python and remote_pyaal?
from my understanding remote_python is just an translation part without the aal protocol implementation, and remote_aal is adapter_remote(as in the adapter stack section in the adapters docs) that bridge the adapter process(the aal/python file) and the fmbt process, is this correct?

quesion 3:
what is the difference between aal_remote and remote in the configuration file?

fmbt script and cron

hello,
I'm trying to run my script with cron.
here is my cron task:
*/1 * * * * /usr/bin/python /home/adminuser/Desktop/htdocs/tizenTest.py > /home/adminuser/Desktop/htdocs/test.txt

this task works well with simple python script like print "test" and script tizenTest.py works well from terminal.

but when I run it with cron I got a problem, here is my cron sudo strace -f -p pidof cron``:

[pid  2414] close(1021)                 = -1 EBADF (Bad file descriptor)
[pid  2414] close(1022)                 = -1 EBADF (Bad file descriptor)
[pid  2414] close(1023)                 = -1 EBADF (Bad file descriptor)
[pid  2414] execve("/usr/bin/sdb", ["sdb", "-s", "sh: 1: sdb: not found", "push", "/usr/local/lib/python2.7/dist-pa"..., "/tmp/fmbttizen-agent.py"], [/* 6 vars */]) = -1 ENOENT (No such file or directory)
[pid  2414] execve("/bin/sdb", ["sdb", "-s", "sh: 1: sdb: not found", "push", "/usr/local/lib/python2.7/dist-pa"..., "/tmp/fmbttizen-agent.py"], [/* 6 vars */]) = -1 ENOENT (No such file or directory)
[pid  2414] stat64("/usr/lib/python2.7/subprocess.py", {st_mode=S_IFREG|0644, st_size=59070, ...}) = 0
[pid  2414] open("/usr/lib/python2.7/subprocess.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2414] fstat64(3, {st_mode=S_IFREG|0644, st_size=59070, ...}) = 0
[pid  2414] fstat64(3, {st_mode=S_IFREG|0644, st_size=59070, ...}) = 0
[pid  2414] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2414] read(3, "# subprocess - Subprocesses with"..., 8192) = 8192
[pid  2414] read(3, "e that the subprocess module is\n"..., 4096) = 4096
[pid  2414] read(3, " stdout=PIPE, close_fds=True)\n(c"..., 4096) = 4096
[pid  2414] read(3, "  \"\"\"Run command with arguments."..., 4096) = 4096
[pid  2414] read(3, "         result.extend(bs_buf)\n\n"..., 4096) = 4096
[pid  2414] read(3, "s.fdopen(errread, 'rb', bufsize)"..., 4096) = 4096
[pid  2414] read(3, "out.fileno())\n            c2pwri"..., 4096) = 4096
[pid  2414] read(3, "open = self._find_w9xpopen()\n   "..., 4096) = 4096
[pid  2414] read(3, "                                "..., 4096) = 4096
[pid  2414] read(3, "errwrite), to_close\n\n\n        de"..., 4096) = 4096
[pid  2414] read(3, "          # dup2() removes the C"..., 4096) = 4096
[pid  2414] read(3, "en\n                raise Runtime"..., 4096) = 4096
[pid  2414] read(3, "and_append(self.stdin, select.PO"..., 4096) = 4096
[pid  2414] read(3, "    self.send_signal(signal.SIGT"..., 4096) = 1726
[pid  2414] read(3, "", 4096)           = 0
[pid  2414] close(3)                    = 0
[pid  2414] munmap(0xb76d9000, 4096)    = 0
[pid  2414] stat64("/usr/lib/python2.7/os.py", {st_mode=S_IFREG|0644, st_size=25769, ...}) = 0
[pid  2414] open("/usr/lib/python2.7/os.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2414] fstat64(3, {st_mode=S_IFREG|0644, st_size=25769, ...}) = 0
[pid  2414] fstat64(3, {st_mode=S_IFREG|0644, st_size=25769, ...}) = 0
[pid  2414] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2414] read(3, "r\"\"\"OS routines for Mac, NT, or "..., 8192) = 8192
[pid  2414] read(3, "t the client doesn't\n    either."..., 4096) = 4096
[pid  2414] read(3, " putenv\nexcept NameError:\n    pa"..., 4096) = 4096
[pid  2414] read(3, "           return dict(self)\n\n\n "..., 4096) = 4096
[pid  2414] read(3, "urn -SIG, where SIG is the signa"..., 4096) = 4096
[pid  2414] read(3, "warnings\n            msg = \"os.p"..., 4096) = 1193
[pid  2414] read(3, "", 4096)           = 0
[pid  2414] close(3)                    = 0
[pid  2414] munmap(0xb76d9000, 4096)    = 0
[pid  2414] stat64("/usr/lib/python2.7/os.py", {st_mode=S_IFREG|0644, st_size=25769, ...}) = 0
[pid  2414] write(9, "cexceptions\nOSError\np0\n(I2\nS'No "..., 462) = 462
[pid  2359] <... read resumed> "cexceptions\nOSError\np0\n(I2\nS'No "..., 1048576) = 462
[pid  2359] mremap(0xb61b3000, 1052672, 4096, MREMAP_MAYMOVE) = 0xb61b3000
[pid  2359] close(5)                    = 0
[pid  2359] close(7)                    = 0
[pid  2359] close(8)                    = 0
[pid  2359] waitpid(2414,  <unfinished ...>
[pid  2414] exit_group(255)             = ?
[pid  2414] +++ exited with 255 +++
[pid  2359] <... waitpid resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 255}], 0) = 2414
[pid  2359] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2414, si_status=255, si_utime=0, si_stime=1} ---
[pid  2359] stat64("/usr/lib/python2.7/encodings/string_escape", 0xbffd2a10) = -1 ENOENT (No such file or directory)
[pid  2359] open("/usr/lib/python2.7/encodings/string_escape.i386-linux-gnu.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid  2359] open("/usr/lib/python2.7/encodings/string_escape.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid  2359] open("/usr/lib/python2.7/encodings/string_escapemodule.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid  2359] open("/usr/lib/python2.7/encodings/string_escape.py", O_RDONLY|O_LARGEFILE) = 5
[pid  2359] fstat64(5, {st_mode=S_IFREG|0644, st_size=953, ...}) = 0
[pid  2359] open("/usr/lib/python2.7/encodings/string_escape.pyc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid  2359] fstat64(5, {st_mode=S_IFREG|0644, st_size=953, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(5, "# -*- coding: iso-8859-1 -*-\n\"\"\""..., 4096) = 953
[pid  2359] read(5, "", 4096)           = 0
[pid  2359] unlink("/usr/lib/python2.7/encodings/string_escape.pyc") = -1 ENOENT (No such file or directory)
[pid  2359] open("/usr/lib/python2.7/encodings/string_escape.pyc", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0100644) = -1 EACCES (Permission denied)
[pid  2359] close(5)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] close(4)                    = 0
[pid  2359] close(6)                    = 0
[pid  2359] close(3)                    = 0
[pid  2359] write(2, "Traceback (most recent call last"..., 35) = 35
[pid  2359] write(2, "  File \"/home/adminuser/Desktop/"..., 74) = 74
[pid  2359] open("/home/adminuser/Desktop/htdocs/tizenTest.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2359] fstat64(3, {st_mode=S_IFREG|0751, st_size=2018, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(3, "#!/usr/bin/python\nimport fmbttiz"..., 4096) = 2018
[pid  2359] write(2, "    ", 4)         = 4
[pid  2359] write(2, "import simple\n", 14) = 14
[pid  2359] close(3)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] write(2, "  File \"/home/adminuser/lampstac"..., 90) = 90
[pid  2359] open("/home/adminuser/lampstack-5.4.26-0/apache2/htdocs/simple.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2359] fstat64(3, {st_mode=S_IFREG|0740, st_size=3266, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(3, "import fmbttizen, time\nimport da"..., 4096) = 3266
[pid  2359] write(2, "    ", 4)         = 4
[pid  2359] write(2, "d = fmbttizen.Device()\n", 23) = 23
[pid  2359] close(3)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] write(2, "  File \"/usr/local/lib/python2.7"..., 84) = 84
[pid  2359] open("/usr/local/lib/python2.7/dist-packages/fmbttizen.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2359] fstat64(3, {st_mode=S_IFREG|0644, st_size=30330, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(3, "# fMBT, free Model Based Testing"..., 4096) = 4096
[pid  2359] read(3, " will not be used.\n\n          de"..., 4096) = 4096
[pid  2359] write(2, "    ", 4)         = 4
[pid  2359] write(2, "debugAgentFile=debugAgentFile)\n", 31) = 31
[pid  2359] close(3)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] write(2, "  File \"/usr/local/lib/python2.7"..., 84) = 84
[pid  2359] open("/usr/local/lib/python2.7/dist-packages/fmbttizen.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2359] fstat64(3, {st_mode=S_IFREG|0644, st_size=30330, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(3, "# fMBT, free Model Based Testing"..., 4096) = 4096
[pid  2359] read(3, " will not be used.\n\n          de"..., 4096) = 4096
[pid  2359] read(3, "                         fmbtgti"..., 4096) = 4096
[pid  2359] read(3, "lower-right corner.\n            "..., 4096) = 4096
[pid  2359] read(3, " is, run as the default user whe"..., 4096) = 4096
[pid  2359] write(2, "    ", 4)         = 4
[pid  2359] write(2, "self.open()\n", 12) = 12
[pid  2359] close(3)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] write(2, "  File \"/usr/local/lib/python2.7"..., 80) = 80
[pid  2359] open("/usr/local/lib/python2.7/dist-packages/fmbttizen.py", O_RDONLY|O_LARGEFILE) = 3
[pid  2359] fstat64(3, {st_mode=S_IFREG|0644, st_size=30330, ...}) = 0
[pid  2359] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76d9000
[pid  2359] read(3, "# fMBT, free Model Based Testing"..., 4096) = 4096
[pid  2359] read(3, " will not be used.\n\n          de"..., 4096) = 4096
[pid  2359] read(3, "                         fmbtgti"..., 4096) = 4096
[pid  2359] read(3, "lower-right corner.\n            "..., 4096) = 4096
[pid  2359] read(3, " is, run as the default user whe"..., 4096) = 4096
[pid  2359] read(3, "path.join(os.path.dirname(agentF"..., 4096) = 4096
[pid  2359] write(2, "    ", 4)         = 4
[pid  2359] write(2, "raise TizenConnectionError('Exec"..., 124) = 124
[pid  2359] close(3)                    = 0
[pid  2359] munmap(0xb76d9000, 4096)    = 0
[pid  2359] write(2, "fmbttizen", 9)    = 9
[pid  2359] write(2, ".", 1)            = 1
[pid  2359] write(2, "TizenConnectionError", 20) = 20
[pid  2359] write(2, ": ", 2)           = 2
[pid  2359] write(2, "Executing \"sdb -s sh: 1: sdb: no"..., 88) = 88
[pid  2359] write(2, "\n", 1)           = 1
[pid  2359] lstat64("/tmp/eyenfinger.2359.wcTZGz", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid  2359] openat(AT_FDCWD, "/tmp/eyenfinger.2359.wcTZGz", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
[pid  2359] getdents64(3, /* 2 entries */, 32768) = 48
[pid  2359] getdents64(3, /* 0 entries */, 32768) = 0
[pid  2359] close(3)                    = 0
[pid  2359] rmdir("/tmp/eyenfinger.2359.wcTZGz") = 0
[pid  2359] rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x80972f1, [], 0}, 8) = 0
[pid  2359] munmap(0xb61b3000, 4096)    = 0
[pid  2359] waitpid(2414, 0xbffd4f3c, WNOHANG) = -1 ECHILD (No child processes)
[pid  2359] exit_group(1)               = ?
[pid  2359] +++ exited with 1 +++
[pid  2358] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 2359
[pid  2358] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2359, si_status=1, si_utime=6, si_stime=6} ---
[pid  2358] sigreturn() (mask [])       = 2359
[pid  2358] dup2(10, 1)                 = 1
[pid  2358] close(10)                   = 0
[pid  2358] exit_group(1)               = ?
[pid  2358] +++ exited with 1 +++
[pid  2357] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 2358
[pid  2357] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2358, si_status=1, si_utime=0, si_stime=0} ---
[pid  2357] wait4(-1, 0xbff9f9b0, 0, NULL) = -1 ECHILD (No child processes)
[pid  2357] fstat64(5, {st_mode=S_IFREG|0600, st_size=792, ...}) = 0
[pid  2357] _llseek(5, 0, [0], SEEK_SET) = 0
[pid  2357] read(5, "Traceback (most recent call last"..., 792) = 792
[pid  2357] _llseek(5, 792, [792], SEEK_SET) = 0
[pid  2357] stat64("/usr/sbin/sendmail", 0xbff9f900) = -1 ENOENT (No such file or directory)
[pid  2357] time(NULL)                  = 1397461022
[pid  2357] send(6, "<78>Apr 14 11:37:02 CRON[2357]: "..., 81, MSG_NOSIGNAL) = 81
[pid  2357] close(6)                    = 0
[pid  2357] close(5)                    = 0
[pid  2357] munmap(0xb77a8000, 4096)    = 0
[pid  2357] socket(PF_NETLINK, SOCK_RAW, 9) = 3
[pid  2357] fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
[pid  2357] readlink("/proc/self/exe", "/usr/sbin/cron", 4096) = 14
[pid  2357] sendto(3, "t\0\0\0P\4\5\0\4\0\0\0\0\0\0\0op=PAM:setcred a"..., 116, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 116
[pid  2357] poll([{fd=3, events=POLLIN}], 1, 500) = 1 ([{fd=3, revents=POLLIN}])
[pid  2357] recvfrom(3, "$\0\0\0\2\0\0\0\4\0\0\0005\t\0\0\0\0\0\0t\0\0\0P\4\5\0\4\0\0\0"..., 8988, MSG_PEEK|MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12]) = 36
[pid  2357] recvfrom(3, "$\0\0\0\2\0\0\0\4\0\0\0005\t\0\0\0\0\0\0t\0\0\0P\4\5\0\4\0\0\0"..., 8988, MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12]) = 36
[pid  2357] close(3)                    = 0
[pid  2357] getuid32()                  = 0
[pid  2357] time(NULL)                  = 1397461022
[pid  2357] socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
[pid  2357] connect(3, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0
[pid  2357] send(3, "<86>Apr 14 11:37:02 CRON[2357]: "..., 89, MSG_NOSIGNAL) = 89
[pid  2357] socket(PF_NETLINK, SOCK_RAW, 9) = 4
[pid  2357] fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
[pid  2357] readlink("/proc/self/exe", "/usr/sbin/cron", 4096) = 14
[pid  2357] sendto(4, "x\0\0\0R\4\5\0\5\0\0\0\0\0\0\0op=PAM:session_c"..., 120, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 120
[pid  2357] poll([{fd=4, events=POLLIN}], 1, 500) = 1 ([{fd=4, revents=POLLIN}])
[pid  2357] recvfrom(4, "$\0\0\0\2\0\0\0\5\0\0\0005\t\0\0\0\0\0\0x\0\0\0R\4\5\0\5\0\0\0"..., 8988, MSG_PEEK|MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12]) = 36
[pid  2357] recvfrom(4, "$\0\0\0\2\0\0\0\5\0\0\0005\t\0\0\0\0\0\0x\0\0\0R\4\5\0\5\0\0\0"..., 8988, MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12]) = 36
[pid  2357] close(4)                    = 0
[pid  2357] munmap(0xb74cd000, 107040)  = 0
[pid  2357] munmap(0xb749b000, 201052)  = 0
[pid  2357] munmap(0xb779a000, 8220)    = 0
[pid  2357] munmap(0xb7797000, 8228)    = 0
[pid  2357] munmap(0xb752a000, 12408)   = 0
[pid  2357] munmap(0xb751f000, 16504)   = 0
[pid  2357] munmap(0xb751b000, 12408)   = 0
[pid  2357] munmap(0xb7495000, 20672)   = 0
[pid  2357] munmap(0xb7489000, 45420)   = 0
[pid  2357] munmap(0xb747d000, 47180)   = 0
[pid  2357] munmap(0xb7524000, 20824)   = 0
[pid  2357] munmap(0xb741e000, 303932)  = 0
[pid  2357] munmap(0xb741a000, 12448)   = 0
[pid  2357] exit_group(0)               = ?
[pid  2357] +++ exited with 0 +++
<... nanosleep resumed> {58, 990942923}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2357, si_status=0, si_utime=0, si_stime=0} ---
waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG) = 2357
waitpid(-1, 0xbffa0b1c, WNOHANG)        = -1 ECHILD (No child processes)
sigreturn() (mask [])                   = -1 EINTR (Interrupted system call)
time(NULL)                              = 1397461022
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1464, ...}) = 0
time(NULL)                              = 1397461022
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {0x804a580, [CHLD], SA_RESTART}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({59, 0}, ^CProcess 844 detached
 <detached ...>

How can I fix this?
Is there any alternatives except of a infinity loop?

OS X build

I managed to get fMBT to build and run on OS X native. I unfortunately did it on a whim (while on vacation) and it's a total hack, but I rebased it off of devel and have it here:

https://github.com/rseymour/fMBT/tree/osx-build

I will see if I can ifdef some things and make it build properly without viciously deleting things. Once I can get it to reliably build on OSX and Linux I'll write up a deps.

And here's a screenshot for proof. 🍎
image

Is it possible to tap on accented characters?

Hi, Antti!

When I try tap on accented characters (eg.: "Café"), I get the following message:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 82-83: ordinal not in range(128)

My script:
import fmbttizen
sut = fmbttizen.Device()
sut.refreshScreenshot()
s = unicode('Café')
sut.tapOcrText(s)

I also tried:
(sharp) -- coding: utf-8 --

And:
import sys
sys.setdefaultencoding('utf-8')

Configurations:
Tizen 2.3b - fmbt on Windows (issue #16)

Please, can you help me?

Connecting to a Tizen device/emulator failed

Impossible execute very first test for tizen emulator.
Code:

import fmbttizen
d = fmbttizen.Device()

Actual result:

~/Documents/fMBT-master% python first.py
Traceback (most recent call last):
File "first.py", line 2, in
d = fmbttizen.Device()
File "/usr/local/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/local/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/local/lib/python2.7/dist-packages/fmbttizen.py", line 665, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.
~/Documents/fMBT-master%

"sdb not available" is showing when trying to add new Tizen object in fmbt-scripter

When i am selecting File->New Tizen in fmbt-scripter, fmbt-scripter is showing a message
"cannot connect to Tizen devices: sdb not available"
But sdb is working in terminal

The following lines are working from terminal
import fmbttizen, time
sut = fmbttizen.Device(pythonCommand="/opt/python/bin/python")

But when i am trying to execute these lines from fmbt-scripter, i am getting following exception message
exec block:

import fmbttizen, time
sut = fmbttizen.Device(pythonCommand="/opt/python/bin/python")
exception: [Errno 2] No such file or directory
Traceback (most recent call last):
File "./fmbt-scripter", line 1749, in _fmbtExec
exec statement in self._fmbtEnv
File "", line 3, in
File "/usr/local/lib/python2.7/site-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/local/lib/python2.7/site-packages/fmbttizen.py", line 571, in init
self._serialNumber = self.recvSerialNumber()
File "/usr/local/lib/python2.7/site-packages/fmbttizen.py", line 850, in recvSerialNumber
shell=(os.name=="nt"))
File "/usr/lib/python2.7/subprocess.py", line 537, in check_output
process = Popen(stdout=PIPE, _popenargs, *_kwargs)
File "/usr/lib/python2.7/subprocess.py", line 679, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

[fmbttizen]:File to modify to get the hardware keys working

Hi Antti,

Hope you are doing good,
We have a new spec (Tizen) for which we want to get working home key, back key, menu key, power , volume etc request you to please let me know the place and procedure to get it working.

Pls let me know the file to modify and what are the values it should be populated with.

Thanks
Madhav pai

[fmbttizen]How did you get screenshot from Tizen device

Hello @askervin

I'm trying to find a piece of code where you get screenshot from Tizen device. Can you show me if possible? I want to write some script for getting screenshot from Tizen device. I have the following bash script:

#!/usr/bin/env sh
sdb root on
sdb shell xwd -root -out /tmp/screen.xwd
sdb pull /tmp/screen.xwd .
sdb root off
convert screen.xwd -resize 50% screen.png
rm screen.xwd

But I want to try a different approach.

Thanks,
Alex

[fmbttizen]:Certain characters in the refreshscreenshot() api for tizen provides dump which has hexa values induced inbetween the characters

Hi Antti,

Certain words have hexavalue induced inbtween, them when read from the screenshot using ocr api, this becomes quite difficult for us to use the ocr related api's, Request you to pls handle them if applicable or suggest a workaround if any

for eg: The word "Profile" read from the screenshot and dumped using enableVisualLogs, the html provides the following value "Pro\xef\xac\x81le"

Thanks,
Madhav

Remote model/adapter process stays alive on test generator termination

remote_pyaal process must terminate when the fmbt process that spawned is terminated (with signal SIGTERM, for instance). This does not happen.

Steps to reproduce:

m.aal:

language "python" {
    import time
}
variables {}
input "sleep" {
    adapter { time.sleep(60) }
}

t.conf (generated by fmbt-editor):

model     = aal_remote(remote_pyaal -l "m.aal.log" "m.aal")
adapter   = aal
heuristic = lookahead(4)
coverage  = perm(2)
pass      = steps(20)

Commands:

$ fmbt t.conf &
$ kill $!
$ ps ax | grep remote_pyaal

fmbt-editor and fmbt-scripter: ImportError: No module named fmbt_config

I just found out about fmbt, downloaded and installed Fedora 21.5 64 Bit Workstation.
I followed the instructions in the Readme.md to the letter.

Everything worked fine, except that now when starting fmbt-editor or fmbt-scripter, I get this error message:

Traceback (most recent call last):
  File "/usr/local/bin/fmbt-editor", line 66, in <module>
    import fmbt_config
ImportError: No module named fmbt_config

I searched for fmbt_config and found these files, among a few other fmbt_* files:

[daniel@fedora-fmbt ~]$ find /usr/local/ -name 'fmbt*config*'
/usr/local/lib64/python2.7/site-packages/fmbt_config.pyc
/usr/local/lib64/python2.7/site-packages/fmbt_config.py

There is a /usr/local/lib/python2.7/site-packages directory, too (without the 64) which does not contain the fmbt*.py(c) files.

Is it a bug in Fedora, in Python, in fmbt's make install, or is it PEBKAC?

Connecting to Tizen Device/emulator failed. Error: Agent connection

Hi Antti,

I am trying to run python script on Tizen Z3 mobile device but facing some connection issue. I am posting the details below. Kindly guide and share your opinion.
$sdb root on
$which sdb
/usr/bin/sdb
$sdb version
Smart Development Bridge version 2.2.80
$python -c 'import fmbttizen; print fmbttizen.Device(pythonCommand="/opt/python/bin/python")'


// The above command gives a traceback with following error:
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator failed. Error : Agent connection

sh-3.2# /opt/python/bin/python /tmp/fmbttizen-agent.py ; exit
sh: /opt/python/bin/python" No such file or directory
exit
Try "sdb -s 0000c24f00007200 shell /opt/python/bin/python /tmp/fmbttizen-agent.py --debug".


$ sdb -s 0000c24f00007200 shell
closed
sh-3.2# python -c 'print "hello"
hello
sh-3.2# /opt/python/bin/python -c 'print "hello"

$
$

I have already followed the discussion at:
#27

Could you please check what is getting wrong. thank you~!

failed to install python on tizen device

Dear Mr. Antti,
I am trying to use fMBT for UI testing on tizen.It is working fine in tizen emulator but i cannot install python libraries in tizen device.I am using Tizen version 2.3.0.1 , engineering binary.According to your instruction i can root the device,also i can push the libraries.But when i try to install the libraries i got the following errors :
manjurul@manjurul:~/Downloads$ sdb shell rpm -i /tmp/*.i586.rpm
error: Failed dependencies:
cpp = 4.5.3-1.2 is needed by cross-armv7l-gcc-4.5.3-1.2.i586
libgomp = 4.5.3-1.2 is needed by cross-armv7l-gcc-4.5.3-1.2.i586
eglibc-devel is needed by cross-armv7l-gcc-4.5.3-1.2.i586
binutils >= 2.19.51.0.14 is needed by cross-armv7l-gcc-4.5.3-1.2.i586
libc.so.6(GLIBC_2.0) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.1) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.1.3) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.2) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.3) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.3.4) is needed by libpython-2.7.1-1.4.i586
libdl.so.2(GLIBC_2.0) is needed by libpython-2.7.1-1.4.i586
libdl.so.2(GLIBC_2.1) is needed by libpython-2.7.1-1.4.i586
libm.so.6(GLIBC_2.0) is needed by libpython-2.7.1-1.4.i586
libm.so.6(GLIBC_2.1) is needed by libpython-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.0) is needed by libpython-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.1) is needed by libpython-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.2) is needed by libpython-2.7.1-1.4.i586
libutil.so.1(GLIBC_2.0) is needed by libpython-2.7.1-1.4.i586
libc.so.6(GLIBC_2.0) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.1) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.1.2) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.1.3) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.2) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.3) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.3.2) is needed by python-base-2.7.1-1.4.i586
libc.so.6(GLIBC_2.3.4) is needed by python-base-2.7.1-1.4.i586
libcrypt.so.1(GLIBC_2.0) is needed by python-base-2.7.1-1.4.i586
libm.so.6(GLIBC_2.0) is needed by python-base-2.7.1-1.4.i586
libm.so.6(GLIBC_2.1) is needed by python-base-2.7.1-1.4.i586
libnsl.so.1(GLIBC_2.0) is needed by python-base-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.0) is needed by python-base-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.1) is needed by python-base-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.1.1) is needed by python-base-2.7.1-1.4.i586
libpthread.so.0(GLIBC_2.2) is needed by python-base-2.7.1-1.4.i586

Can you please help me how to solve this problem ?

tizen - d.pressHome doesn't work (issue #5 reopen)

I have a problem with the d.pressHome command - it returns true but nothing happens. How can I apply a patch from issue#5?
And I have a question, how to press Back button and Menu button? d.pressBack() is not an attribute of "Device'.

Latest python RPMs

Pls let me know where we can find latest python RPMs. We have some old RPMs, but after installing them we are not able to open any settings like wi-fi settings to connect to wi-fi.

Pls let me know is it possible to create RPMs ourself?

fmbt on windows doesn't seem to be able to create subprocess

tried this both on win7 and ubuntu14:

# preview-show-vars: dir_exists
aal "filesystemtest" {
    language "python" {
        import os
        import shutil
        import tempfile,time,fmbt
        from multiprocessing import Process
        
        **def f(name):
            ff = open("multiprocessing","w")
            for i in range(1,5):
                time.sleep(5)
                ff.write("hello " + name + "\n")
            ff.close()**

        MOUNTPOINT = tempfile.tempdir
        DIRNAME = os.path.join( MOUNTPOINT , "fmbt.filesystemtest" )
        SUBDIRNAME = os.path.join( DIRNAME , "subdir" )
    }
    variables { dir_exists, subdir_exists }
    initial_state {
        dir_exists = False
        subdir_exists = False
    }
    adapter_init {
        try: shutil.rmtree(DIRNAME)
        except OSError: pass
    }
    adapter_exit {
        if verdict == "pass" and dir_exists:
            log("cleaning up " + DIRNAME)
            shutil.rmtree(DIRNAME)
    }
    input "mkdir: ok" {
        guard()   { return not dir_exists }
        adapter() { os.mkdir(DIRNAME) }
        body()    { dir_exists = True }
    }
    input "rmdir: ok" {
        guard()   { return dir_exists and not subdir_exists }
        adapter() { os.rmdir(DIRNAME) }
        body()    { dir_exists = False }
    }
    input "mksubdir: ok" {
        guard()   { return dir_exists and not subdir_exists}
        adapter() {
            **pp = Process(target=f,args=('bob',))
            pp.start()**
            os.mkdir(SUBDIRNAME) 
        }
        body()    { subdir_exists = True }
    }
}

it works on ubuntu but not on windows(can't see the file multiprocessing being created.),

sometimes i see the subprocess being creacred but imediately being closed with the pp.is_alive() returns dead. any idea why?

using multiprocessing in aal model with heuristic lookahead

i have a mode that need to create a seperate server for event receiving

aal "test" {
    language "python" {
        # -*- coding: utf-8 -*-
        from multiprocessing import Process
        def start_server_process():
            p_server = Process()
            p_server.start()
            return p_server
    };
    
    variables {p_server,p_server_up}
    
    initial_state {
        p_server = None
        p_server_up = False
    }
    
    adapter_exit {
        p_server.terminate()
    }
    
    #start the server in another process
    input "start_server" {
        guard {return not p_server_up}
        adapter {
            p_server = start_server_process()
            assert p_server
		}
        body { p_server_up = True}
    }
    input "another action" {
    }
}

when i use the default heuristic(random), this code works fine ,but when i try to use heuristic(lookahead), ,after start_server action passed, an error pops up:

Traceback (most recent call last):
  File "C:\Python27\lib\copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "C:\Python27\lib\copy.py", line 334, in _reconstruct
    state = deepcopy(state, memo)
  File "C:\Python27\lib\copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "C:\Python27\lib\copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Python27\lib\copy.py", line 182, in deepcopy
    rv = reductor(2)
  File "C:\Python27\lib\multiprocessing\process.py", line 290, in __reduce__
    'Pickling an AuthenticationString object is '

Remote expected integer, got nothing
remote_pyaal error: Pickling an AuthenticationString object is disallowed for security reasons
aal remote(remote_pyaal -l test.aal.log test.aal) returned error Child process exited with code 1

heuristic error: Alg: Model:
model error:
error: Heuristic error

error

AttributeError: 'tuple' object has no attribute 'startswith'

Hello, Antti!
I got AttibuteError exception on sut.refreshScreenshot() in method finish() . I'm just trying to detect am I on home screen or not in this method. So is this my fault or issue in fmbttizen? Thank you.
Code:

import sys
import fmbttizen
import time

sut = fmbttizen.Device(pythonCommand="/opt/python/bin/python")
app = "/opt/apps/com.example.app/bin/app"


def setup():
    sut.enableVisualLog(sys.argv[0].split('.')[0] + ".html")
    sut.shellSOE(app, asyncOut="/tmp/app-stdout.txt", asyncError="/tmp/app-stderr.txt")
    time.sleep(5)
    sut.setDisplayBacklightTime(15 * 60)
    time.sleep(3)
    sut.refreshScreenshot()
    assert sut.verifyOcrText("App"), "App isn't launched!"


def finish():
    count = 0
    while not sut.verifyOcrText("Store") and count != 10:
        sut.pressBack()
        time.sleep(1)
        sut.refreshScreenshot()
        count += 1


def open_popup():
    sut.pressMenu()
    time.sleep(2)
    sut.refreshScreenshot()
    sut.tapOcrText("Preview")
    time.sleep(2)
    sut.refreshScreenshot()
    sut.drag((0.42, 0.63), (0.34, 0.21))
    time.sleep(2)
    sut.refreshScreenshot()
    sut.tapOcrText("Popup")
    time.sleep(2)
    sut.refreshScreenshot()
    assert sut.verifyOcrText("Popup"), "Text 'Popup' is not found!"


def test():
    setup()
    open_popup()

try:
    test()
except AssertionError as e:
    print e
finally:
    finish()

Traceback:

Traceback (most recent call last):
  File "test.py", line 50, in <module>
    test()
  File "test.py", line 48, in test
    finish()
  File "test.py", line 25, in finish
    sut.refreshScreenshot()
  File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 2737, in refreshScreenshotWRAP
    retval = loggerSelf.doCallLogException(origMethod, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 2695, in doCallLogException
    try: return origMethod(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 1594, in refreshScreenshot
    if self.existingConnection().recvScreenshot(screenshotFile):
  File "/usr/local/lib/python2.7/dist-packages/fmbttizen.py", line 824, in recvScreenshot
    if img.startswith("FMBTRAWX11"):
AttributeError: 'tuple' object has no attribute 'startswith'

Get Hardware and Software related information from Tizen device

Hello,
Can i get hardware and software related information from "fmbtTizen.Device" object ?
Such as the information shows in Settings->About Device page.
Or else if those information can be accessed using "sdb" command, then how can i do it ?

Moreover is there any event in fmbt to detect new device connection or detect when a device/emulator is disconnected ?

Thank you in advance.

fmbt-log seperater not working

logfile content :

<fmbt_log>
<version>
    0.37-1
</version>
<conf_load>
    <conf_file name="test.conf"/>
     <remote_pyaal_version>0.37-1</remote_pyaal_version>
</conf_load>
<conf_execute>
    <action_name name="i%3Acallee%3D%27Alice%27"/>
    <action_name name="i%3Acallee%3D%27Bob%27"/>
    <action_name name="i%3AphoneApp%3D%27Skype%27"/>
    <action_name name="i%3AphoneApp%3D%27WhatsApp%27"/>
    <action_name name="i%3Acall"/>
    <action_name name="o%3Aalice_becomes_happy"/>
    <test_engine>
        <tags enabled=""/>
        <status steps="0" coverage="0.000000" scov="0.000000e+00"/>
        <current_time time="1484623303.718879"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.730120"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.730224"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="1" coverage="0.166667" scov="1.666667e-01"/>
        <current_time time="1484623303.730449"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.739919"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.740106"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="2" coverage="0.333333" scov="3.333333e-01"/>
        <current_time time="1484623303.740377"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.750421"/>
        <action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.750515"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="3" coverage="0.500000" scov="5.000000e-01"/>
        <current_time time="1484623303.750704"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.762150"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.762437"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="4" coverage="0.666667" scov="6.666667e-01"/>
        <current_time time="1484623303.762761"/>
        <suggested_action type="input" name="i%3Acall" time="1484623303.773270"/>
        <action type="input" name="i%3Acall" time="1484623303.773448"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="5" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.773651"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.781869"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.781998"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="6" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.782203"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.791488"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.791618"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="7" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.791890"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.800178"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.800272"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="8" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.800459"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.808306"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.808401"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="9" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.808587"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.815662"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.815801"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="10" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.815991"/>
        <suggested_action type="input" name="i%3Acall" time="1484623303.824106"/>
        <action type="input" name="i%3Acall" time="1484623303.824197"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="11" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.824354"/>
        <suggested_action type="input" name="i%3Acall" time="1484623303.831518"/>
        <action type="input" name="i%3Acall" time="1484623303.831756"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="12" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.832037"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.840432"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.840520"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="13" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.840704"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.847767"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.847885"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="14" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.848141"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.857405"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.857495"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="15" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.857716"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.864792"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.864888"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="16" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.865084"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.872100"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.872188"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="17" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.872372"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.879674"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.879957"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="18" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.880246"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.888400"/>
        <action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.888511"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="19" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.888781"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.897496"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.897618"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="20" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.897840"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.906322"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.906419"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="21" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.906608"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.913862"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.913968"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="22" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.914160"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.921207"/>
        <action type="input" name="i%3AphoneApp%3D%27WhatsApp%27" time="1484623303.921335"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="23" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.921577"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.929212"/>
        <action type="input" name="i%3Acallee%3D%27Bob%27" time="1484623303.929333"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="24" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.929564"/>
        <suggested_action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.936604"/>
        <action type="input" name="i%3AphoneApp%3D%27Skype%27" time="1484623303.936701"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="25" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.936890"/>
        <suggested_action type="input" name="i%3Acall" time="1484623303.943940"/>
        <action type="input" name="i%3Acall" time="1484623303.944052"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="26" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.944224"/>
        <suggested_action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.951686"/>
        <action type="input" name="i%3Acallee%3D%27Alice%27" time="1484623303.951813"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="27" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.952020"/>
        <suggested_action type="input" name="i%3Acall" time="1484623303.959593"/>
        <action type="input" name="i%3Acall" time="1484623303.959712"/>
        <adapter_executed>
        </adapter_executed>
        <tags enabled=""/>
        <status steps="28" coverage="0.833333" scov="8.333333e-01"/>
        <current_time time="1484623303.959899"/>
        <action type="output" name="o%3Aalice_becomes_happy" time="1484623303.960116"/>
        <tags enabled=""/>
        <status steps="29" coverage="1.000000" scov="1.000000e+00"/>
        <current_time time="1484623303.960259"/>
        <stop verdict="pass" reason="coverage%201.0%20reached"/>
        <current_time time="1484623303.960279"/>
        <elapsed_time time="0.241599"/>
    </test_engine>
</conf_execute>
</fmbt_log>

the seperator options does not seems to be working:

root@NKG1000102834:~/work/# fmbt-log -f '$as$sc' -s ":"  test.log
i:callee='Alice'0.166667
i:callee='Bob'0.333333
i:phoneApp='Skype'0.500000
i:phoneApp='WhatsApp'0.666667
i:call0.833333
i:callee='Alice'0.833333
i:callee='Bob'0.833333
i:callee='Bob'0.833333
i:phoneApp='WhatsApp'0.833333
i:callee='Alice'0.833333
i:call0.833333
i:call0.833333
i:callee='Bob'0.833333
i:phoneApp='WhatsApp'0.833333
i:phoneApp='WhatsApp'0.833333
i:callee='Alice'0.833333
i:phoneApp='WhatsApp'0.833333
i:callee='Bob'0.833333
i:phoneApp='Skype'0.833333
i:phoneApp='WhatsApp'0.833333
i:callee='Alice'0.833333
i:callee='Bob'0.833333
i:phoneApp='WhatsApp'0.833333
i:callee='Bob'0.833333
i:phoneApp='Skype'0.833333
i:call0.833333
i:callee='Alice'0.833333
i:call0.833333
1.000000

SDB freezes with fmbt script after an hour or two

Hi, I have a script that run simple test in the infinity loop, and it freezes after some time without any error, is there any way to debug sdb process, like ADB_TRACE or gdb to got some useful information? My fmbt script stops and all sdb commands, such as 'sdb devices' freezes, I can restart tests only after device rebooting and restarting sdb server. I also have a script that runs android tests and it freezes too. Can someone suggest something?

fmbt-scripter freezes after switch on "Record" when device connected

Steps to reproduce:

  1. Connect device to host pc
  2. Enable root mode
  3. Launch fmbt-scripter for terminal emulator
  4. File -> New Tizen
  5. Click on 'Record' button

Actual result:
fmbt-scripter is not responding

Expected result:
"Record" feature should be activated, fmbt-scripter works properly

Environment:
Host: Ubuntu 12.04 32bit
Device: Tizen 2.2.1

Output:

not selecting bitmaps automatically when recording
>>> 
exec: import fmbttizen
time: 0.000 s
>>> 
exec: sut = fmbttizen.Device()
time: 0.582 s
>>> 
exec: sut.refreshScreenshot()
showing screenshot "screenshots/20141031-144650-468119-000098d20000c2f5.png"
>>> 
time: 1.439 s
>>> 
showing screenshot "screenshots/20141031-144650-468119-000098d20000c2f5.png"
>>> 
eval: sut.connection().sendRecStart(None)
exception: Agent connection lost: Traceback (most recent call last):

File "/tmp/fmbttizen-agent.py", line 892, in <module>
fmbtuinput.startQueueingEvents(filterOpts)
File "/tmp/fmbtuinput.py", line 1173, in startQueueingEvents
queueEventsFromFiles(deviceFiles, filterOpts)
File "/tmp/fmbtuinput.py", line 1148, in queueEventsFromFiles
q = Queue.Queue()
File "/opt/python/lib/python2.7/Queue.py", line 33, in __init__

AttributeError: 'module' object has no attribute 'Lock'
Exception AttributeError: '_shutdown' in <module 'threading' from '/opt/python/lib/python2.7/threading.pyc'> ignored
exit
>>> 

fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator

Hello, Antti.

I'm facing the same issue related in #23. However, I can't find a solution. The error message displayed in fmbt-scripter is:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 667, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.

My results:
$which sdb:
/home/tizen/tizen-sdk/tools/sdb

$ sdb version
Smart Development Bridge version 2.2.48

$python -c 'import fmbttizen; print fmbttizen.Device(pythonCommand="/opt/python/bin/python")'
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 667, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.

$sdb -s emulator-26101 shell
->shell opens successfully

$python -c 'print "hello"'
hello

$/opt/python/bin/python -c 'print "hello"'
bash: /opt/python/bin/python: File or directory not found

$/usr/bin/python -c 'print "hello"'
hello

$python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import os
os.getenv("PATH")
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib:/home/tizen/tizen-sdk/tools'

$echo $PATH
$/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib:/home/tizen/tizen-sdk/tools

Please, can you help me?

dumpOcr() is giving Segmentation fault (core dumped)

dumpOcr() is giving Segmentation fault (core dumped) if we call it after refreshing the screenshot using a forced image by passing the path.

fmbt_device.refreshScreenshot(file_path)
fmbt_device.screenshot().dumpOcr()

fMBT does not interact with application which launched from shell

I have tizen native app which runs from shell (icon is not present on device).
So I wrote in my test the following:

import fmbttizen
import os
import time

d = fmbttizen.Device(pythonCommand="/opt/python/bin/python")
os.system("sdb root on")
os.system("path_to_app_binary")
d.setDisplayBacklightTime(5 * 60)
time.sleep(5)
d.pressMenu()

And nothing happened after last command, fmbt just frozen. This issue makes impossible to run app in test, so if I need to test my app I need to run application manually from device shell. And it blocks my work in some way, Could you help me?

tizen - error with swipe(x,y x,y) method

Have an error with command: d.swipe((0.05, 0.55), (0.9, 0.5))

Traceback (most recent call last):
File "tizenTest.py", line 31, in
d.swipe((0.05, 0.55), (0.9, 0.5))
File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 2481, in swipeWRAP
retval = loggerSelf.doCallLogException(origMethod, args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 2473, in doCallLogException
try: return origMethod(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/fmbtgti.py", line 1701, in swipe
direction = direction % 360
TypeError: unsupported operand type(s) for %: 'tuple' and 'int'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.