Documentation of tbot event backends

dashboard

class dashboard.dashboard(tb, host, user, pw, dbname, tname)

Bases: object

extract tbot results to a mysql database after tbot has finished

Prerequisites:

MySQLdb python module is needed, install it for example on the raspberry pi with:

apt-get install python-mysqldb

If tb.config.create_dot == ‘yes’ then you need the dot

command, please install this, see for example:

http://askubuntu.com/questions/97552/how-to-install-dot-provided-by-graphviz

If tb.config.create_statistic == ‘yes’ you need the gnuplot

command. See an example for installing gnuplot here:

http://askubuntu.com/questions/340579/how-to-install-gnuplot-in-ubuntu

The dashboard backend also collects information from other backends (if they are enabled) and stores them in “webdir”. Currently this is a fix place, need here some work to make this configurable. Currently it is placed at “/var/www/html”, and subdir “tbot” plus current MYSQL ID “id_%d” ...

  • parameters, types, return and return types:
Parameters:
  • arg1 – tb
  • arg2 – host
  • arg3 – username
  • arg4 – pw
  • arg5 – dbname
  • arg5 – tname
insert_test_into_db()

starts with filling the DB

documentation

class documentation.doc_backend(tb, ignorelist)

Bases: object

extract from all executed testcases the logs from tbots connection.

Format of the created filenames:

testcasename_connectionname_index_incnumber.txt

testcasename: Name of TC

connectionname: Name of the tbot connection

index: counts, how often the TC was called, starts with 1

incnumber: each switch to another connection increments this number
starts with 1

This files could be used to create documentation files, which contains logs.

You can set a own “testcasename” if you create the event: SET_DOC_FILENAME.

enable this backend with “create_documentation = ‘yes’”

created files are stored in tb.workdir + ‘/logfiles/ so, be sure you have created this directory.

Configuration Variable: tb.config.event_documentation_strip_list

list of strings. If a line in the logfile is found, which contains a string of this list. This line is deleted, and replaced by a “[...]”. If more lines are found in a row, only one “[...]” is inserted.

tools/scripts:

replace_tbot_marker.py searches for tbot markers “tbot_ref:[filename]” in textfiles, and replaces them with the content of the file [filename]

$ python2.7 ../scripts/demo/documentation_backend/replace_tbot_marker.py --help
  Usage: replace_tbot_marker.py [options]
  Options:
    -h, --help            show this help message and exit
    -i IFILE, --inputfile=IFILE
                          input file
    -o OFILE, --outputfile=OFILE
                          output file
    -t TCPATH, --tcpatch=TCPATH
                          path to logfiles.
    -r REPLACE, --replace=REPLACE
                          replace some tbot paths
    -l LITERAL, --literal=LITERAL
                          type of literal block (bash or rst)
    -w WRAP, --wrap=WRAP  wrap lines after n characters

see https://github.com/hsdenx/tbot/blob/testing/scripts/demo/documentation_backend/README for a demo, how you can create a html/pdf/man page, which contains content of tbot logfiles and text around it.

  • parameters, types, return and return types:
Parameters:
  • arg1 – tb
  • arg2 – list of strings, containing testcasesnames, which get ignored
create_docfiles()

create the files

dot

class dot.dot(tb, dotfile, ignorelist)

Bases: object

create a dot description file from the executed testcases.

after tbot hs finsihed create a png with:
dot -Tpng tc.dot > tc.png
or create a postscript with:
dot -Tps tc.dot > tc.ps
  • parameters, types, return and return types:
Parameters:
  • arg1 – tb
  • arg2 – filename, which contains the dot description data
  • arg3 – list of strings, containing testcasesnames, which get ignored
create_dotfile()

create the dot file

html_log

class html_log.html_log(tb, htmlfile)

Bases: object

create a html log file after tbot hs finished

create a nicer log ... see for an example:

http://xeidos.ddns.net/tbot/id_189/html_log.html

the created html file needs the css file:

https://github.com/hsdenx/tbot/blob/testing/log/multiplexed_tbotlog.css

  • parameters, types, return and return types:
Parameters:
  • arg1 – tb
  • arg2 – filename which gets created, place tb.workdir
create_htmlfile()

create the html file

statistic_plot

class statisitic_plot.statistic_plot_backend(tb, fdfile, ignorelist)

Bases: object

create a statistic of called testcases

create a stat.dat file for creating a TC statistic image with gnuplot

call “gnuplot balkenplot.sem” in tbot workdir after tbot finsihed, so you need gnuplot installed on your system.

used balkenplot.sem file:

https://github.com/hsdenx/tbot/blob/master/src/files/balkenplot.sem

  • parameters, types, return and return types:
Parameters:
  • arg1 – tb
  • arg2 – filename which gets created
  • arg3 – list of strings, containing testcasesnames, which get ignored
create_statfile()

create the statistic file