Testing

libopc has built in regression testing. To run the most basic tests build the win32 solution, change to the libopc directory and type
libopc> python test.py --target=debug --type=static

when you want to test the debug build or
libopc> python test.py --target=release  --type=static

when you want to test the release built.

This will run all sample programs like opc_dump, opc_zipread, etc. and compare the actual output to the output found in the test_docs directory. E.g. the file OOXMLI1.docx.opc_dump is the output of the opc_dump test_docs\OOXMLI1.docx command. If the output of the current build and the regression file is different the test fails.

opc_generate testing (win32)

On win32 there is also the possibility to run opc_generate-based tests. The syntax is as follows
libopc> python test.py --target=release --generate=test_docs 

or with the -skip switch to skip already generated test docs:
libopc> python test.py --target=release --generate=test_docs --skip

Make sure you issue the command in the "Visual Studio Command Prompt", e.g. make sure that the compilers paths are properly set.

This opc_generate tests will use the opc_generate tools to generate a "c" file from the source container, execute the "c" file to generate the container via the API and then compare the opc_dump results to ensure the source container and the generated container are equal.

Sometimes it’s necessary to exclude certain files from the opc_generate testing. This can be done by placing a opc_generate.ignore file in the root test directory. E.g. if you run the test command with
libopc> python test.py --target=release --generate=c:\sample_docs

the opc_generate.ignore file needs to have the path c:\sample_docs\opc_generate.ignore. If the test directory has more test directories then the path relative to the root test directory needs to be given using the “/” as a path separator. E.g.
{ 
	"OOXMLI4.docx": True,
	"xlsx_tests/iz23172.xlsx": True
}



Last edited Jun 13, 2011 at 1:47 PM by flr, version 14

Comments

No comments yet.