Difference between revisions of "SmokeTest"
m (→Code) |
|||
(19 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | == | + | == Overview == |
+ | {{AOo}} 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.<br /> | |
+ | 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).<br /> | ||
+ | Open smoketestdoc.sxw with OpenOffice manually, there are three buttons as follows: | ||
+ | [[File:smoke test buttons.png]] | ||
− | [[Category: | + | The first button is to run the default smoke test cases. Chick the second button, there is a dialog popping up: |
+ | [[File:smoke test options.png]] | ||
+ | |||
+ | 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: | ||
+ | [[File:smoke test result.png]] | ||
+ | |||
+ | 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 /> | ||
+ | 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 == | ||
+ | Macros in smoketestdoc.sxw are organized by StarBasic language. The basic code is as following: | ||
+ | <syntaxhighlight lang="oobas"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 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 /> | ||
+ | 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 | ||
+ | |||
+ | [[Category:Test]] | ||
[[Category:Quality Assurance]] | [[Category:Quality Assurance]] |
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