assert_and_click, assert_and_dclick

  assert_and_click($mustmatch,[$button],[$timeout],[$click_time],[$dclick]);

deprecated: assert_and_dclick($mustmatch,[$button],[$timeout],[$click_time]);

wait_idle

  wait_idle([$timeout_sec]);

Wait until the system becomes idle (as configured by IDLETHESHOLD)

wait_serial

  wait_serial($regex [[, $timeout_sec], $expect_not_found]);

Wait for $rexex to appear on serial output. You could have sent it there earlier with

 script_run("echo Hello World E<gt> /dev/$serialdev");

Returns the string matched or undef if $expect_not_found is false (default).

Returns undef or (after tiemout) the string that did _not_ match if $expect_not_found is true.

become_root

open a root shell. the implementation is distribution specific, openSUSE calls su -c bash and chdirs to /tmp

 become_root;

upload_logs

upload log file to openqa host

 upload_logs '/var/log/messages';

ensure_installed

distribution specific helper to install a package to test

  ensure_installed 'zsh';

upload_asset

upload log file to openqa host

you can upload private assets only visible in the openQA web interface:

  upload_asset '/tmp/suse.ps';

Or you can upload public assets that will have a fixed filename replacing previous assets - useful for external users upload_asset '/tmp/suse.ps';

wait_screen_change

  wait_screen_change { $code };

wrapper around code that is supposed to change the screen. This is basically the opposite to wait_still_screen. Make sure to put the commands to change the screen within the block to avoid races between the action and the screen change

  wait_screen_change {
     send_key 'esc';
  };

wait_still_screen

  wait_still_screen([$stilltime_sec [, $timeout_sec [, $similarity_level]]]);

Wait until the screen stops changing

get_var

  get_var($variable [, $default ])

Return content of named openQA variable - or the default given as 2nd argument or undef

get_required_var

  get_required_var($variable)

Like get_var but without default. Fails when variable can not be retrieved.

set_var

  set_var($variable, $value);

set openQA variable - to be consumed by followup tests

check_var

  check_var($variable, $value);

boolean function to check if the content of the named variable is the given value

get_var_array

get_var_array($variable [, $default ]);

Return the given variable as array reference (split by , | or ; )

check_var_array

  check_var_array($variable, $value);

Boolean function to check if a value list contains a value

 check_var_array('GREETINGS', 'hallo');

script_run

  script_run($program, [$wait_seconds]);

Run $program (by assuming the console prompt and typing it). Wait for idle before and after.

assert_script_run

  assert_script_run($command);

run $command via script_run and die if it's exit status is not zero. The exit status is checked by via magic string on the serial port.

script_sudo

  script_sudo($program, [$wait_seconds]);

Run $program. Handle the sudo timeout and send password when appropriate.

$wait_seconds defaults to 2 seconds

assert_script_sudo

  assert_script_sudo($command);

run $command via script_sudo and die if it's exit status is not zero. The exit status is checked by via magic string on the serial port.

power

  power($action);

Trigger backend specific power action, can be on, off, acpi or reset

  power('off');

eject_cd

  eject_cd;

if backend supports it, eject the CD

send_key

  send_key($qemu_key_name[, $wait_idle]);

send_key_until_needlematch

  send_key_until_needlematch($tag, $key, [$counter, $timeout]);

Send specific key if can not find the matched needle.

type_string

  type_string($string [ , max_interval => <num> ] [, secret => 1 ] );

send a string of characters, mapping them to appropriate key names as necessary

you can pass optional paramters with following keys:

max_interval (1-250) determines the typing speed, the lower the max_interval the slower the typing.

secret (bool) suppresses logging of the actual string typed.

type_password

  type_password([$password]);

A convience wrappar around type_string, which doesn't log the string and uses $testapi::password if no string is given

autoinst_url

returns the base URL to contact the local os-autoinst service. You can also pass a path as argument to append it automatically.

  script_run("curl " . autoinst_url . "/data");

data_url

  data_url($name);

returns the URL to download data or asset file Special values REPO_\d and ASSET_\d points to the asset configured in the corresponding variable

script_output

script_output($script, [$wait])

fetches the script through HTTP into the VM and execs it with bash -xe and directs stdout (*not* stderr!) to the serial console and returns the output *if* the script exists with 0. Otherwise the test is set to failed.

The default timeout for the script is 10 seconds. If you need more, pass a 2nd parameter

validate_script_output

validate_script_output($script, $code, [$wait])

wrapper around script_output, that runs a callback on the output. Use it as

validate_script_output "cat /etc/hosts", sub { m/127.*localhost/ }

multi console support

All testapi commands that interact with the system under test do that through a console. send_key, type_string type into a console. assert_screen 'looks' at a console, assert_and_click looks at and clicks on a console.

Most backends support several consoles in some way. These consoles then have names as defined by the backend.

Consoles can be selected for interaction with the system under test. One of them is 'selected' by default, as defined by the backend.

There are no consoles predefined by default, the distribution has to add them during initial setup and define actions on what should happen when they are selected first by the tests.

E.g. your distribution can give e.g. tty2 and tty4 a name for the tests to select

  $self->add_console('root-console',  'tty-console', {tty => 2});
  $self->add_console('user-console',  'tty-console', {tty => 4});
select_console("root-console")

Select the named console for further testapi interaction (send_text, send_key, wait_screen_change, ...)

If this the first time, a test selects this console, the distribution will get a call into activate_console('root-console', $console_obj) to make sure to actually log in root. For the backend it's just a tty object (in this example) - so it will sure the console is active, but to setup the root shell on this console, the distribution needs to run test code.

add_console("console", "console type" [, optional console parameters...])

You need to do this in your distribution and not in tests. It will not trigger any action on the system under test, but only store the parameters.

The console parameters are console specific.

console("testapi_console")-$console_command(@console_command_args)>

Some consoles have special commands beyond type_string, assert_screen

Such commands can be accessed using this API.

console("bootloader"), console("errorlog"), ... returns a proxy object for the specific console which can then be directly accessed.

This is also useful for typing/interacting 'in the background', without turning the video away from the currently selected console.

Note: assert_screen() and friends look at the currently selected console (select_console), no matter which console you send commands to here.

reset_consoles

  reset_consoles;

will make sure the next select_console will activate the console. This is important if you did something to the system that affects the console (e.g. trigger reboot).

parse_junit_log

  parse_junit_log("report.xml");

Upload log file from SUT (calls upload_logs internally). The uploaded file is then parsed as jUnit format and extra test results are created from it.

start_audiocapture

  start_audiocapture;

Tells the backend to record a .wav file of the sound card (only works in qemu atm).

assert_recorded_sound

  assert_recorded_sound('we-will-rock-you');

Tells the backend to record a .wav file of the sound card (only works in qemu atm).

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 993:

Unknown directive: =out

Around line 995:

'=item' outside of any '=over'