Difference between revisions of "SmokeTest"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 41: Line 41:
 
== Code ==
 
== Code ==
 
Macros in smoketestdoc.sxw are organized by StarBasic language. The basic code is as following:
 
Macros in smoketestdoc.sxw are organized by StarBasic language. The basic code is as following:
<source lang="Basic">
+
<source lang="basic4gl">
 
Sub StartTestByOptions
 
Sub StartTestByOptions
 
bShowTable = true
 
bShowTable = true

Revision as of 12:23, 26 February 2012

Overview

OO.o has a beautiful built-in smoke-test application for running some basic sanity checks on a build to ensure that nothing wildly wrong crept in between releases. These tests run quite quickly, since they only do simple document creation / load / save tasks.

How to use

The smoke test is run by building module smoketestoo_native. It should be built as the last step of each complete build. Build smoketestoo_native module with the following steps:

  • source LinuxX86Env.Set.sh
  • cd smoketestoo_native
  • build

Test points

  • Remove old installation(Optional)
  • Install OpenOffice
  • Document creation(Document types include Writer, Calc, Impress, Draw, Base, Math, HTML, Chart)
  • Object creation
  • Document save
  • Document open
  • Remove installation(Optional)

Sample file

The operations on documents and objects are executed by Macros wrote in the smoketestdoc.sxw document. Other preparations for testing, such as installation, are run by smoketest.cxx. The sample file smoketestdoc.sxw is generated by zipping some files in smoketestdoc module while building smoketestdoc module. It is located in <sourcecode>/main/smoketestdoc/unxmacxi/pro/misc/zip/. Open smoketestdoc.sxw with OpenOffice manually, there are three buttons as follows: Smoke test buttons.png

The first button is to run the default smoke test cases. Chick the second button, there is a dialog popping up:

Smoke test options.png


In this dialog, you can choose the functions you want to test by selecting the check box. The test cases that are not checked will not be tested when you click “Smoketest” button on this dialog. After running the test cases, test result will show up in this file as follows:

Smoke test result.png

The green cells show the cases are executed successfully. If there is any red cell, it means that case met some problem.

After that, you can click the “delete table” to delete the result table.

Normally, when you open smoketestdoc.sxw and click the button in it, there is no response. It is because of the security of macros. Choose Tools->Options->OpenOffice.org->Security->Macro security, click “Macro Security...” button. In the popping up dialog, choose “Security Level” tab, and choose “Low” level, and click “OK”. Then you can run the test cases manually.

Code

Macros in smoketestdoc.sxw are organized by StarBasic language. The basic code is as following:

Sub StartTestByOptions
	bShowTable = true
	call ReadOptions
	call Main
	if bMakeTerminateAfterTest then
		ClearDocFull (gOutputDoc)
		gOutputDoc.dispose
		'StarDesktop.Terminate
 
		'EnableReschedule( false )
		'DispatchSlot( 5300 )
		stop
	End If
end Sub

When you click “start smoketest” button, the “StartTestByOptions” macro in “Global” module will be run.

You can add more test cases by adding modules and macros. Firstly you should learn more about macors.

TODO: Provide basic code of smoke test module.

Personal tools