Test your websites with this simple GUI based scripted webtester. Generate simple testscripts directly from surfng on the webpage, enhance them with your commands, with variables, loops, checks, … and finally run automated web tests.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.8 KiB
101 lines
2.8 KiB
## @file This is a test script to test and to show the features of the webtester framework. |
|
|
|
testsuite Test WebTester Commands |
|
|
|
testcase Test Certificate Load |
|
# Load a SwissSign root certificate, so that it is accepted in the |
|
# following tests. Normally this is only necessary if you use |
|
# self-signed certificates, that are unknown by qt. |
|
ca-certificate ca.pem |
|
|
|
testcase Test Variable Definition |
|
# set a variable to a value |
|
set ARG4 = Argument number 4 |
|
# set a variable to the output of a system command |
|
set WORKDIR |
|
execute pwd |
|
|
|
testcase Test Function Call |
|
# call a test function with three comma separated arguments |
|
# - either with single quotes, allmust be quoted |
|
call test '1', 'hello world', 'here is a comma, so it must be quoted', 'ARG4' |
|
# - or with double quotes, but the two types cannot be mixed |
|
call test "2", "hello world", "here's a comma, so it must be quoted", "ARG4" |
|
# - or with no quotes |
|
call test 3, hello world, here's no comma and no quotes, ARG4 |
|
|
|
testcase Test Function Definition |
|
## Just a test function |
|
## @param ARG1 an argument |
|
## @param ARG2 another argument |
|
## @param ARG3 another argument |
|
## @param ARG4 another argument |
|
function test ARG1, ARG2, ARG3, ARG4 |
|
if ARG1 = 1 |
|
# this is the first function call (or at leas declared to be the first) |
|
echo This is the first call of function "test" |
|
echo called funtion test ARG1, ARG2, ARG3, ARG4 |
|
|
|
testcase Test Checks |
|
# check comparisions of values |
|
# fist set some variables to test |
|
set TEXT = Hello world, this is a test. |
|
set TWO = 2 |
|
# then so some checks |
|
check TWO = 2 |
|
check 2 = TWO |
|
check TWO = TWO |
|
# @todo the following test fails: the dot is the problem |
|
#check TEXT = Hello world, this is a test. |
|
check TEXT ^ hello world |
|
# @todo the following test fails |
|
#check TEXT ~ [hH]ello.*test |
|
check TEXT ~ world |
|
check 1 < TWO |
|
check TWO < 3 |
|
check 3 > TWO |
|
|
|
testcase Test Setting Clicktype |
|
# there are two clicktypes: |
|
# - normal javascript this.click(); call |
|
# - Qt emulated real mouse click |
|
clicktype realmouse |
|
clicktype javascript |
|
|
|
testcase Test Load Client Certificate |
|
# define a client certificate to authenticate to a server |
|
client-certificate client.pem client.key password |
|
|
|
testcase Test For Loop |
|
# test the for loop feature |
|
# first run with a gven list |
|
execute bash |
|
echo -n "test:" > testfile |
|
for VAR -> 1, 2, 3, 4 |
|
execute bash |
|
echo -n "-VAR;">> testfile |
|
set RESULT |
|
execute bash |
|
cat testfile |
|
rm testfile |
|
check RESULT = test:-1;-2;-3;-4; |
|
# then run with a given global value |
|
set VAR = 5, 6, 7, 8, 9 |
|
for VAR |
|
execute bash |
|
echo -n "-VAR;">> testfile |
|
set RESULT |
|
execute bash |
|
cat testfile |
|
rm testfile |
|
check RESULT = -5;-6;-7;-8;-9; |
|
# multi dimensional for loops |
|
# VAR colides with VARS1 and VARS2 |
|
unset VAR |
|
set VARS1 = 1, 2, 3, 4 |
|
set VARS2 = a, b, c, d |
|
set RESULT = |
|
for VARS1 |
|
for VARS2 |
|
set RESULT = RESULTVARS1VARS2 |
|
check RESULT = 1a1b1c1d2a2b2c2d3a3b3c3d4a4b4c4d
|
|
|