Difference between revisions of "SmokeTest"
(→Code) |
m (→Code) |
||
(One intermediate revision by the same user not shown) | |||
Line 25: | Line 25: | ||
[[File:smoke test options.png]] | [[File:smoke test options.png]] | ||
− | In this dialog, you can choose the functions you want to test by selecting the | + | In this dialog, you can choose the functions you want to test by selecting the checkbox. The test cases that are not checked will not be tested when you click “Smoketest” button in this dialog.<br /> |
After running the test cases, test result will show up in this file as follows: | After running the test cases, test result will show up in this file as follows: | ||
[[File:smoke test result.png]] | [[File:smoke test result.png]] | ||
Line 31: | Line 31: | ||
The green cells show the cases that are executed successfully. If there is any red cell, it means that case met some problem. | The green cells show the cases that 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.<br /> | After that, you can click the “delete table” to delete the result table.<br /> | ||
− | 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 | + | 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 {{menu|Tools|Options|OpenOffice|Security|Macro security}}, click {{button|Macro Security…}} button. In the popping up dialog, choose “Security Level” tab, and choose “Low” level, and click {{button|OK}}. Then you can run the test cases manually. |
== Code == | == Code == | ||
Line 51: | Line 51: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | When you click | + | When you click {{button|start smoketest}} button, the “StartTestByOptions” macro in “Global” module will be run. |
You can add more test cases by adding modules and macros.<br /> | You can add more test cases by adding modules and macros.<br /> | ||
But firstly you should learn more about macros from here: https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Getting_Started/Getting_Started_with_Macros | But firstly you should learn more about macros from here: https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Getting_Started/Getting_Started_with_Macros |
Latest revision as of 11:29, 10 August 2022
Overview
Apache OpenOffice 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(on 32bit-linux)
- 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)
- Document save
- Document open
- Remove installation (Optional)
Sample file
The operations on documents 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/unxlngi6.pro/misc/zip/(on linux).
Open smoketestdoc.sxw with OpenOffice manually, there are three buttons as follows:
The first button is to run the default smoke test cases. Chick the second button, there is a dialog popping up:
In this dialog, you can choose the functions you want to test by selecting the checkbox. The test cases that are not checked will not be tested when you click “Smoketest” button in this dialog.
After running the test cases, test result will show up in this file as follows:
The green cells show the cases that 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 → 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.
But firstly you should learn more about macros from here: https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Getting_Started/Getting_Started_with_Macros