exactness: Automatically compare outputs when running "play".

Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com>

SVN revision: 66313
This commit is contained in:
Aharon Hillel 2011-12-18 14:12:01 +00:00 committed by Tom Hacohen
parent d3e1171bf2
commit d4e0182e05
2 changed files with 10 additions and 18 deletions

20
README
View File

@ -73,37 +73,33 @@ Testing with exactness composed of the following stages:
(locate "test_hover.rec" in "${prefix}/share/exactness/recordings") (locate "test_hover.rec" in "${prefix}/share/exactness/recordings")
3. Test playing, producing current state PNG files. 3. Test playing, producing current state PNG files and comparison files (4).
After doing Test Initiation (2) and updating elementary code, After doing Test Initiation (2) and updating elementary code,
you may run tests for current state of elm: you may run tests for current state of elm:
exactness -p [-b BaseDir] [-d DestDir] TestName1 [TestName2 ...] exactness -p [-b BaseDir] [-d DestDir] TestName1 [TestName2 ...]
Omitting DestDir param will cause exactness place all PNG files Omitting DestDir param will cause exactness place all PNG files
under (default) folder named 'current'. under (default) folder named 'current'.
Note that comparing PNG files (4) is also done upon completion of play.
This will produce comp_*.png files in your DestDir.
You may put record-files at specific folder with -b (base dir) argument: You may put record-files at specific folder with -b (base dir) argument:
Example: Example:
exactness -p -b ${prefix}/share/exactness/recordings exactness -p -b ${prefix}/share/exactness/recordings
Play test_hover, find ".rec" file at "${prefix}/share/exactness/recordings" Play test_hover, find ".rec" file at "${prefix}/share/exactness/recordings"
Write resulting PNG files at cwd/current (default) dir. Write resulting PNG files at cwd/current (default) dir
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.
Matching PNG files from 'orig' and 'current' folder are compared. Following 'play' action, matching PNG files from 'orig' and 'current'
folder are compared.
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.
To run a comparison:
exactness -c [-d DestDir] TestName1 [TestName2 ...]
All comp_*.png files will reside in DestDir.
Omitting DestDir cause exactness to use default of 'current' folder name.
Optional:
You may also do play and compare in a single command:
exactness -p -c [-d DestDir] TestName1 [TestName2 ...]
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:

View File

@ -35,12 +35,7 @@ echo "To play and rewrite 'orig' dir, use init option for all test: \$0 -i [-b B
echo "To play and rewrite 'orig' dir, use init option for selected tests: \$0 -i [-b BaseDir] [TestName1 ...]" echo "To play and rewrite 'orig' dir, use init option for selected tests: \$0 -i [-b BaseDir] [TestName1 ...]"
echo "Use BaseDir arg tell \$0 where record-files are found." echo "Use BaseDir arg tell \$0 where record-files are found."
echo "Otherwise, \$0 will try to find it in cwd." echo "Otherwise, \$0 will try to find it in cwd."
echo echo "This will also run comprison to produce comp_*.png files in DestDir"
echo "Run comprison to produce comp_*.png files"
echo "To compare all tests:"
echo "\$0 -c [-d DestDir]"
echo "To compare specific tests:"
echo "\$0 -c -d DestDir TestName1 [TestName2 ...]"
echo echo
echo "NOTE:" echo "NOTE:"
echo "For all actions require DestDir, when omitting this param we use 'current' as default." echo "For all actions require DestDir, when omitting this param we use 'current' as default."
@ -237,6 +232,7 @@ do
d) _dest_dir="\$OPTARG" d) _dest_dir="\$OPTARG"
;; ;;
p) _play=1 p) _play=1
_compare=1
_remove_fail=1 _remove_fail=1
;; ;;
r) _record=1 r) _record=1