Difference between revisions of "Groovy Uno Release Testing"
((checkpoint save)) |
|||
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
− | |||
− | |||
== Overview == | == Overview == | ||
This page is to document the testing procedure for a Groovy UNO Extension release candidate. | This page is to document the testing procedure for a Groovy UNO Extension release candidate. | ||
For information on the extension see the [[Groovy_UNO_Extension]] wiki page. | For information on the extension see the [[Groovy_UNO_Extension]] wiki page. | ||
− | The current release candidate is guno-extension-0.1. | + | |
+ | The current release candidate is '''guno-extension-0.1.5-rc1-r1740645'''<br /> | ||
+ | The current Gradle URL is '''org.openoffice:guno-extension:0.1.5'''<br /> | ||
+ | The current Apache Nexus staging repo URL is '''https://repository.apache.org/content/repositories/orgapacheopenoffice-1021/''' | ||
The test procedure will be: | The test procedure will be: | ||
Line 18: | Line 19: | ||
To build the extension from source you also need [http://gradle.org/ Gradle]. | To build the extension from source you also need [http://gradle.org/ Gradle]. | ||
− | == | + | == Download and Run the Test Script == |
− | Download the HelloTextTableShape.groovy test script from Bugzilla [https://bz.apache.org/ooo/show_bug.cgi?id=126770 Issue 126770]. | + | Download the HelloTextTableShape.groovy test script from AOO Bugzilla [https://bz.apache.org/ooo/show_bug.cgi?id=126770 Issue 126770] to your local machine. This location will be referred to as the test script location. |
− | + | The test script is a Groovy rewrite of the HelloTextTableShape.java provided with the SDK. Running the script will download the artifact from Apache Nexus and install it in Groovy's Ivy cache along with other dependencies. On Fedora 20 Linux it is here: ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.jar | |
− | |||
− | |||
− | |||
− | If using Windows or | + | === Edit the script === |
− | + | Open the script in a text editor and verify the @GrabResolver matches the repo URL and the @Grab for guno-extension matches the Gradle URL version noted at the beginning of this page.<br /> | |
+ | If using Windows or Linux with a soffice executable location other than "/opt/openoffice4/program/" edit the test script for the location of the soffice executable. | ||
A Windows example would look like: "C:/Program Files (x86)/OpenOffice 4/program" | A Windows example would look like: "C:/Program Files (x86)/OpenOffice 4/program" | ||
− | Run the script from the download location | + | === Run the script from the download location === |
+ | <source lang="bash"> | ||
groovy HelloTextTableShape.groovy | groovy HelloTextTableShape.groovy | ||
− | + | </source> | |
The script should bootstrap the office and add sample content to some of the applications using the guno-extension jar. | The script should bootstrap the office and add sample content to some of the applications using the guno-extension jar. | ||
Close OpenOffice after the test. | Close OpenOffice after the test. | ||
− | + | == Download and Build the Source == | |
− | + | Source packages for the RC are available at: [https://dist.apache.org/repos/dist/dev/openoffice/devtools/ https://dist.apache.org/repos/dist/dev/openoffice/devtools/]. | |
− | |||
+ | === Unpack the source jar === | ||
+ | This will be the guno-extension test directory | ||
− | + | === Edit the Spock Tests === | |
− | + | This step is optional unless you would like to run the Spock unit tests. | |
− | |||
− | |||
− | This | ||
− | If using Windows or | + | Spock functional tests can be ran along with the build process and may need edited for the location of the soffice executable. |
− | Edit the two | + | If using Windows or Linux with a soffice executable location other than "/opt/openoffice4/program/". |
− | src/test/groovy/org/openoffice/guno/SpreadsheetSpec.groovy and UnoSpec.groovy | + | Edit the two Spock test files for the location of the soffice executable. The files to edit are ''src/test/groovy/org/openoffice/guno/SpreadsheetSpec.groovy and UnoSpec.groovy'' |
− | The | + | The line to edit looks like: |
+ | <source lang="groovy"> | ||
String oooExeFolder = "/opt/openoffice4/program/" | String oooExeFolder = "/opt/openoffice4/program/" | ||
+ | </source> | ||
+ | To run the Spock unit tests only (From guno-extension test directory) | ||
+ | <source lang="bash"> | ||
+ | gradle clean test | ||
+ | </source> | ||
+ | To run them with the build they must go after the jar task due to jar running 'clean' first. | ||
+ | <source lang="bash"> | ||
+ | gradle jar test | ||
+ | </source> | ||
+ | Test results can be viewed at ''build/reports/tests/index.html'' | ||
− | + | === Run the Build === | |
− | (From guno-extension test directory) | + | If you haven't ran 'jar' already.. (From guno-extension test directory) |
+ | <source lang="bash"> | ||
gradle jar | gradle jar | ||
+ | </source> | ||
− | + | == Test the Build == | |
+ | === Rename the downloaded jar in the local Groovy Ivy cache === | ||
(From guno-extension test directory) | (From guno-extension test directory) | ||
− | mv ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1. | + | <source lang="bash"> |
+ | mv ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.jar ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.save | ||
+ | </source> | ||
+ | === Copy the test jar into it's place === | ||
+ | <source lang="bash"> | ||
+ | cp ./build/libs/guno-extension-0.1.5.jar ~/.groovy/grapes/org.openoffice/guno-extension/jars/ | ||
+ | </source> | ||
+ | === Edit the test script === | ||
+ | In order to hide the Apache Nexus staging area from Groovy edit the HelloTextTableShape.groovy script and comment out the grab resolver for the staging area. Groovy should find the newly built jar in the Ivy cache. | ||
+ | <source lang="groovy"> | ||
+ | // @GrabResolver(name = 'guno', root = 'https://repository.apache.org/content/repositories/orgapacheopenoffice-1021/') | ||
+ | </source> | ||
+ | === Run the script again to test the newly built jar === | ||
+ | <source lang="bash"> | ||
+ | groovy HelloTextTableShape.groovy | ||
+ | </source> | ||
+ | Once finished you can remove the test jar from Ivy and rename the guno-extension-0.1.5.save back to .jar | ||
− | + | == Test the Test Procedure == | |
− | + | The "Test the Build" procedure depends on substituting a .jar file in a cache. | |
+ | There is an obvious risk that the test script will still download the .jar or have it cached somewhere else. | ||
+ | This is a procedure verifies that the test procedure really does test the locally built .jar. | ||
+ | === Edit UnoExtension.groovy === | ||
+ | Insert an arbitrary exception throw into a key method: | ||
+ | <source lang="groovy"> | ||
+ | static Object guno(final Object self, Class clazz) { | ||
+ | throw new IllegalArgumentException("This is a strange exception"); | ||
+ | UnoRuntime.queryInterface(clazz, self) | ||
+ | } | ||
+ | </source> | ||
+ | === Repeat the test process === | ||
− | + | Repeat the "gradle jar" and "Test the Build" steps above. | |
− | + | This time, the run should fail with a stack trace reporting "java.lang.IllegalArgumentException: This is a strange exception". | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:API]] | [[Category:API]] |
Latest revision as of 14:55, 23 April 2016
Overview
This page is to document the testing procedure for a Groovy UNO Extension release candidate. For information on the extension see the Groovy_UNO_Extension wiki page.
The current release candidate is guno-extension-0.1.5-rc1-r1740645
The current Gradle URL is org.openoffice:guno-extension:0.1.5
The current Apache Nexus staging repo URL is https://repository.apache.org/content/repositories/orgapacheopenoffice-1021/
The test procedure will be:
- Download and run a test script that will cause the release candidate artifact to be downloaded from the Apache Nexus staging location.
- Download and unpack the signed source files and build with Gradle.
- Replace the Downloaded RC jar with the newly built jar.
- Edit the test script to remove the staging repository location.
- Run the test script again.
Prerequisites
To run the test script you need a Java JDK and Apache Groovy because Groovy scripts are compiled at runtime. To build the extension from source you also need Gradle.
Download and Run the Test Script
Download the HelloTextTableShape.groovy test script from AOO Bugzilla Issue 126770 to your local machine. This location will be referred to as the test script location.
The test script is a Groovy rewrite of the HelloTextTableShape.java provided with the SDK. Running the script will download the artifact from Apache Nexus and install it in Groovy's Ivy cache along with other dependencies. On Fedora 20 Linux it is here: ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.jar
Edit the script
Open the script in a text editor and verify the @GrabResolver matches the repo URL and the @Grab for guno-extension matches the Gradle URL version noted at the beginning of this page.
If using Windows or Linux with a soffice executable location other than "/opt/openoffice4/program/" edit the test script for the location of the soffice executable.
A Windows example would look like: "C:/Program Files (x86)/OpenOffice 4/program"
Run the script from the download location
groovy HelloTextTableShape.groovy
The script should bootstrap the office and add sample content to some of the applications using the guno-extension jar. Close OpenOffice after the test.
Download and Build the Source
Source packages for the RC are available at: https://dist.apache.org/repos/dist/dev/openoffice/devtools/.
Unpack the source jar
This will be the guno-extension test directory
Edit the Spock Tests
This step is optional unless you would like to run the Spock unit tests.
Spock functional tests can be ran along with the build process and may need edited for the location of the soffice executable. If using Windows or Linux with a soffice executable location other than "/opt/openoffice4/program/". Edit the two Spock test files for the location of the soffice executable. The files to edit are src/test/groovy/org/openoffice/guno/SpreadsheetSpec.groovy and UnoSpec.groovy The line to edit looks like:
String oooExeFolder = "/opt/openoffice4/program/"
To run the Spock unit tests only (From guno-extension test directory)
gradle clean test
To run them with the build they must go after the jar task due to jar running 'clean' first.
gradle jar test
Test results can be viewed at build/reports/tests/index.html
Run the Build
If you haven't ran 'jar' already.. (From guno-extension test directory)
gradle jar
Test the Build
Rename the downloaded jar in the local Groovy Ivy cache
(From guno-extension test directory)
mv ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.jar ~/.groovy/grapes/org.openoffice/guno-extension/jars/guno-extension-0.1.5.save
Copy the test jar into it's place
cp ./build/libs/guno-extension-0.1.5.jar ~/.groovy/grapes/org.openoffice/guno-extension/jars/
Edit the test script
In order to hide the Apache Nexus staging area from Groovy edit the HelloTextTableShape.groovy script and comment out the grab resolver for the staging area. Groovy should find the newly built jar in the Ivy cache.
// @GrabResolver(name = 'guno', root = 'https://repository.apache.org/content/repositories/orgapacheopenoffice-1021/')
Run the script again to test the newly built jar
groovy HelloTextTableShape.groovy
Once finished you can remove the test jar from Ivy and rename the guno-extension-0.1.5.save back to .jar
Test the Test Procedure
The "Test the Build" procedure depends on substituting a .jar file in a cache. There is an obvious risk that the test script will still download the .jar or have it cached somewhere else. This is a procedure verifies that the test procedure really does test the locally built .jar.
Edit UnoExtension.groovy
Insert an arbitrary exception throw into a key method:
static Object guno(final Object self, Class clazz) {
throw new IllegalArgumentException("This is a strange exception");
UnoRuntime.queryInterface(clazz, self)
}
Repeat the test process
Repeat the "gradle jar" and "Test the Build" steps above. This time, the run should fail with a stack trace reporting "java.lang.IllegalArgumentException: This is a strange exception".