exactness: added simulate mode
Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com> SVN revision: 66378
This commit is contained in:
parent
17db9e1237
commit
17815fa441
17
README
17
README
|
@ -46,6 +46,20 @@ Testing with exactness composed of the following stages:
|
||||||
NOTE: You may change screenshot key from F2 to any other key
|
NOTE: You may change screenshot key from F2 to any other key
|
||||||
with TSUITE_SHOT_KEY env var.
|
with TSUITE_SHOT_KEY env var.
|
||||||
|
|
||||||
|
|
||||||
|
After recording a new test you may use 'simulate' option to play test
|
||||||
|
with no effect to output files. Simulate option lets you to examine
|
||||||
|
a test-play on-screen without actually producing output PNG file.
|
||||||
|
|
||||||
|
To do this just run:
|
||||||
|
exactness -s [-b BaseDir] [TestName]
|
||||||
|
|
||||||
|
Example:
|
||||||
|
exactness -s test_check
|
||||||
|
This will play test_check.rec from cwd,
|
||||||
|
use the -b option to tell exactness to locate this file elsewhere.
|
||||||
|
|
||||||
|
|
||||||
2. Test Initiation.
|
2. Test Initiation.
|
||||||
The final stage of testing process is based on PNG image comparison
|
The final stage of testing process is based on PNG image comparison
|
||||||
of original screenshots with current screenshots produced after code change.
|
of original screenshots with current screenshots produced after code change.
|
||||||
|
@ -91,6 +105,7 @@ Testing with exactness composed of the following stages:
|
||||||
Write resulting PNG files at cwd/current (default) dir
|
Write resulting PNG files at cwd/current (default) dir
|
||||||
along with comp_*.png files.
|
along with comp_*.png files.
|
||||||
|
|
||||||
|
|
||||||
4. Comparing PNG files.
|
4. Comparing PNG files.
|
||||||
This is the final stage of testing in which we compare output
|
This is the final stage of testing in which we compare output
|
||||||
before code update and after the update.
|
before code update and after the update.
|
||||||
|
@ -100,6 +115,7 @@ Testing with exactness composed of the following stages:
|
||||||
When all comparisons done you get final report of (N) files did not match.
|
When all comparisons done you get final report of (N) files did not match.
|
||||||
In case difference was found, you may look at comp_*.png files in DestDir.
|
In case difference was found, you may look at comp_*.png files in DestDir.
|
||||||
|
|
||||||
|
|
||||||
5. fail_if(expr) macro:
|
5. fail_if(expr) macro:
|
||||||
You may use fail_if(expr); macro to verify variable value on-the-fly.
|
You may use fail_if(expr); macro to verify variable value on-the-fly.
|
||||||
For example, if your code contains:
|
For example, if your code contains:
|
||||||
|
@ -115,6 +131,7 @@ Testing with exactness composed of the following stages:
|
||||||
When tests completed, the user gets notification message if any tests failed.
|
When tests completed, the user gets notification message if any tests failed.
|
||||||
In such case, please review the fail_*.txt files.
|
In such case, please review the fail_*.txt files.
|
||||||
|
|
||||||
|
|
||||||
6. To view exactness help issue the command:
|
6. To view exactness help issue the command:
|
||||||
exactness --help
|
exactness --help
|
||||||
or
|
or
|
||||||
|
|
|
@ -66,6 +66,20 @@ fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_simulation () {
|
||||||
|
# This will play simulation
|
||||||
|
# this will NOT produce screenshots
|
||||||
|
DEBUG echo do_simulation "\$*"
|
||||||
|
if [ -z "\$*" ]
|
||||||
|
then
|
||||||
|
exactness_raw --destdir "\$_dest_dir" --basedir "\$_base_dir" --tests
|
||||||
|
else
|
||||||
|
exactness_raw --destdir "\$_dest_dir" --basedir "\$_base_dir" --tests \$*
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
do_play () {
|
do_play () {
|
||||||
# This will play record for all test if '-a' specified.
|
# This will play record for all test if '-a' specified.
|
||||||
# or play record of tests specified as parameter.
|
# or play record of tests specified as parameter.
|
||||||
|
@ -73,7 +87,6 @@ do_play () {
|
||||||
DEBUG echo base dir: "\$_base_dir"
|
DEBUG echo base dir: "\$_base_dir"
|
||||||
DEBUG echo dest dir: "\$_dest_dir"
|
DEBUG echo dest dir: "\$_dest_dir"
|
||||||
DEBUG echo do_play "\$_dest_dir" "\$*"
|
DEBUG echo do_play "\$_dest_dir" "\$*"
|
||||||
|
|
||||||
# Play recorded tests and produce PNG files.
|
# Play recorded tests and produce PNG files.
|
||||||
# this will produce screenshots in "_dest_dir" folder
|
# this will produce screenshots in "_dest_dir" folder
|
||||||
if [ -z "\$*" ]
|
if [ -z "\$*" ]
|
||||||
|
@ -197,9 +210,21 @@ else
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Processed \$ncomp comparisons"
|
if [ "\$ncomp" -ne 0 ]
|
||||||
echo "with \$nfail diff errors"
|
then
|
||||||
echo "\$nerr rec-files were not found"
|
echo "Processed \$ncomp comparisons"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "\$nfail" -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "with \$nfail diff errors"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "\$nerr" -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "\$nerr PNG-files were not found"
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +233,7 @@ _record=
|
||||||
_play=
|
_play=
|
||||||
_compare=
|
_compare=
|
||||||
_init=
|
_init=
|
||||||
|
_simulation=
|
||||||
_remove_fail=
|
_remove_fail=
|
||||||
_orig_dir="orig"
|
_orig_dir="orig"
|
||||||
# Init dest_dir - should change on the fly
|
# Init dest_dir - should change on the fly
|
||||||
|
@ -222,7 +248,7 @@ nfail=0
|
||||||
which compare &> /dev/null
|
which compare &> /dev/null
|
||||||
comp_unavail=\$?
|
comp_unavail=\$?
|
||||||
|
|
||||||
while getopts 'ab:cd:hpri?' OPTION
|
while getopts 'ab:cd:hpris?' OPTION
|
||||||
do
|
do
|
||||||
case \$OPTION in
|
case \$OPTION in
|
||||||
b) _base_dir="\$OPTARG"
|
b) _base_dir="\$OPTARG"
|
||||||
|
@ -243,6 +269,9 @@ do
|
||||||
_play=1
|
_play=1
|
||||||
_remove_fail=1
|
_remove_fail=1
|
||||||
;;
|
;;
|
||||||
|
s) _dest_dir="\$_orig_dir"
|
||||||
|
_simulation=1
|
||||||
|
;;
|
||||||
h) do_help
|
h) do_help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
@ -256,6 +285,18 @@ shift \$((\$OPTIND - 1))
|
||||||
DEBUG echo _base_dir="\$_base_dir"
|
DEBUG echo _base_dir="\$_base_dir"
|
||||||
DEBUG echo _dest_dir="\$_dest_dir"
|
DEBUG echo _dest_dir="\$_dest_dir"
|
||||||
|
|
||||||
|
if [ "\$_simulation" ]
|
||||||
|
then
|
||||||
|
# When in simulation mode, we will just commit play (ignore other options)
|
||||||
|
_init=
|
||||||
|
_record=
|
||||||
|
_compare=
|
||||||
|
_remove_fail=
|
||||||
|
_play=
|
||||||
|
do_simulation "\$*"
|
||||||
|
# This will cause render simulation
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -e "\$_base_dir" ]
|
if [ ! -e "\$_base_dir" ]
|
||||||
then
|
then
|
||||||
echo "Base dir <\$_base_dir> - not found."
|
echo "Base dir <\$_base_dir> - not found."
|
||||||
|
|
Loading…
Reference in New Issue