WindowsTesting
Size: 13188
Comment:
|
Size: 13249
Comment: It is no a tutorial perse
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from UbuntuOne/Tutorials/WindowsTesting |
The following details what's needed to test the window UbuntuOne installer and builds under windows.
Dependencies
- A Windows machine or VM
Download and install VS Express 2008 C# from http://www.microsoft.com/express/Downloads/#2008-Visual-CS
The Ubuntu One Windows Installer code from Launchpad
Building
In order to simplify the build process of the project and automate it as much as possible Nant has been used to create the build script. The fact that Nant is used adds a number of features that make the automation easier:
Tasks
Tasks in Nant can be seen as operations that can be performed with Nant using the projects contents. Each tasks performs an operation on the source code and can depend on other tasks that have been defined in the build script.
The following is a list of the different tasks that are currently defined in the project and a small description.
bootstrapper: Creates a bootstrapper that will allow to install in the users machine the Ubuntu One solution plus a number of useful applications (Tomboy + GtkSharp)
build: Compiles the different projects that are part of the solution. This task depends on clean and build_protos.
clean: Removes the different results from the last compilation/task .
generate_protos: Generates part of the C# code of the solution that depends on the protobuffer definitions found in the proto dir.
installer: Compiles the application using the build task, runs the unit tests usint the tests task and creates a msi installer that can be used to install Ubuntu One in the users machine (do not confuse with the bootstrapper, it only installes Ubuntu One)
tests: Compiles the solution using the build task and runs the different unit tests. The output of the tests can be found in the test-results dir.
Nant provides a way to list all the available tasks in a project by executing the following:
tools\Nant\bin\nant.exe -projecthelp NAnt 0.90 (Build 0.90.3780.0; release; 08/05/2010) Copyright (C) 2001-2010 Gerry Shaw http://nant.sourceforge.net Default Target: installer Compiles the solution and create a merge installer that allows to install the solution and other related apps. Main Targets: bootstrapper Creates a bootstrapper that will allow to install Ubuntu One, Tomboy and Gtk Sharp in the users machine. build Compiles all the different projects that form part of the solution. clean Removes all the different results of the last comilation if they exist generate_protos Generates the code that is used to talk with the python process using protobuffer. installer Compiles the solution and create a merge installer that allows to install the solution and other related apps. tests Runs the unit tests of the project.
Parameters
Nant allows to pass enviroment variables that can be used to configure the different tasks, the normal way to pass a property is the following:
tools\Nant\bin\nant.exe -D:enviroment="debug"
Currently the build script supports the following configuration parameters:
enviroment: The environment use for the compilation, the available values are:
- debug
- release
Building and Testing:
These are the commands to run to build and run the tests.
tools\Nant\bin\nant.exe clean
tools\Nant\bin\nant.exe build
tools\Nant\bin\nant.exe tests
This error happens if you run the tests from a network drive (e.g: Virtualbox share):
[mkdir] Creating directory 'Z:\mandel\fix_tomboy_installer\test-results'. [echo] Executing Canonical.UbuntuOne.Common.Tests [exec] Z:\mandel\fix_tomboy_installer\main.build(147,4): Attribute 'userunt imeengine' for <exec ... /> is deprecated. Use the managed attribute and Manage d property instead. [exec] [exec] Unhandled Exception: System.TypeInitializationException: The type in itializer for 'NUnit.ConsoleRunner.Runner' threw an exception. ---> System.Secur ity.SecurityException: That assembly does not allow partially trusted callers. [exec] at NUnit.ConsoleRunner.Runner..cctor() [exec] The action that failed was: [exec] LinkDemand [exec] The assembly or AppDomain that failed was: [exec] nunit-console-runner, Version=2.5.5.10112, Culture=neutral, PublicKe yToken=96d09a1eb7f44a77 [exec] The method that caused the failure was: [exec] NUnit.Core.Logger GetLogger(System.Type) [exec] The Zone of the assembly that failed was: [exec] Internet [exec] The Url of the assembly that failed was: [exec] file:///Z:/mandel/fix_tomboy_installer/tools/NUnit/lib/nunit-console -runner.DLL [exec] --- End of inner exception stack trace --- [exec] at NUnit.ConsoleRunner.Runner.Main(String[] args) [exec] at NUnit.ConsoleRunner.Class1.Main(String[] args) BUILD FAILED - 0 non-fatal error(s), 22 warning(s) Z:\mandel\fix_tomboy_installer\main.build(147,4): External Program Failed: Z:\mandel\fix_tomboy_installer\tools\NUnit\nunit-consol e.exe (return code was -532459699) Total time: 152.4 seconds.
Fix is to move the code to a local drive.
Build the msi
tools\Nant\bin\nant.exe installer
If you get this:
[get] Retrieving 'http://download.gnome.org/binaries/win32/tomboy/1.2/Tomb oy-1.2.2.msi' to 'C:\Documents and Settings\Stuart Colville\Desktop\fix_tomboy_i nstaller\tomboy.msi'. [exec] C:\Documents and Settings\Stuart Colville\Desktop\fix_tomboy_install er\main.build(121,5): Attribute 'useruntimeengine' for <exec ... /> is deprecate d. Use the managed attribute and Managed property instead. BUILD FAILED - 0 non-fatal error(s), 6 warning(s) C:\Documents and Settings\Stuart Colville\Desktop\fix_tomboy_installer\main.buil d(121,5): 'C:\Program Files\Windows Installer XML v3\bin\dark.exe' failed to start. The system cannot find the path specified Total time: 24.5 seconds.
Wix is present in the src tree under the tools directory, this means that the build script will be able to create an .msi without the need of having Wix installed in the VM.
Re-run the installer command and you should find UbuntuOne.msi in the install directory.
Build the bootstrapper
Due to the nature of the windows installer only a single msi can be executed at a time. The project contains a boostrapper generation that will create a setup.exe program that will concatenate the installation of the following:
- Ubuntu One on Windows
- Gtk-Sharp
- Tomboy
In order to create the bootstrapper the following command has to be executed:
tools\Nant\bin\nant.exe bootstrapper
The output should be similar to the following:
Target framework: Microsoft .NET Framework 3.5 Target(s) specified: bootstrapper bootstrapper: [exec] InstallerLinker: dotNetInstaller Packager (1.9.5931.0) [exec] BUILD SUCCEEDED Total time: 1 seconds.
Once this command has been ran you should find setup.exe in the install directory.
Installing
The windows installer solution has different components that are installed by the msi. In certain cases it is interesting to install the different components independently to simplfy the testing.
Installing the windows service
InstallUtil is the command line that can be used to install and uninstall a windows service. In order to install a windows service we first have to add C:\Windows\Microsoft.NET\Framework\v2.0.50727 in your shell path (edit environment variables). Once InstallUtil is in you path you can execute in the command line:
InstallUtil Canonical.UbuntuOne.ProcessDispatcher.exe
If the installation is successful a message similar to the following will be given:
Affected parameters are: logtoconsole = assemblypath = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_servi ce_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe logfile = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_service_wi x\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.InstallLog Installing service UbuntuOne SyncDaemon... Service UbuntuOne SyncDaemon has been successfully installed. Creating EventLog source UbuntuOne SyncDaemon in log Application... The Install phase completed successfully, and the Commit phase is beginning. See the contents of the log file for the C:\Users\Mandel\Documents\Projects\Ubun tuOne\net\install_service_wix\install\build_results\Daemon\Canonical.UbuntuOne.P rocessDispatcher.exe assembly's progress. The file is located at C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_ service_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.I nstallLog. Committing assembly 'C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_se rvice_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe '. Affected parameters are: logtoconsole = assemblypath = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_servi ce_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe logfile = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_service_wi x\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.InstallLog The Commit phase completed successfully. The transacted install has completed.
If there are any errors the installation will be rolled back and a message like the following will be given:
Installing service UbuntuOne SyncDaemon... Creating EventLog source UbuntuOne SyncDaemon in log Application... An exception occurred during the Install phase. System.ComponentModel.Win32Exception: The specified service has been marked for deletion The Rollback phase of the installation is beginning. See the contents of the log file for the C:\Users\Mandel\Documents\Projects\Ubun tuOne\net\install_service_wix\install\build_results\Daemon\Canonical.UbuntuOne.P rocessDispatcher.exe assembly's progress. The file is located at C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_ service_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.I nstallLog. Rolling back assembly 'C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_ service_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.e xe'. Affected parameters are: logtoconsole = assemblypath = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_servi ce_wix\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe logfile = C:\Users\Mandel\Documents\Projects\UbuntuOne\net\install_service_wi x\install\build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.InstallLog Restoring event log to previous state for source UbuntuOne SyncDaemon. The Rollback phase completed successfully. The transacted install has completed. The installation failed, and the rollback has been performed.
Once the service has been installed you can manage it with mmc.exe. Once you have finished the different tests the service can be uninstalled with:
InstallUtil /u Canonical.UbuntuOne.ProcessDispatcher.exe
Testing
There are a number of different ways/path to test the solution.
Unit Testing
Unit testing is executed in an automated manner by the build script everytime a new deploymnet package (msi) is build. The results of the unit testing can be found in the test-results dir. A tool like Nunit2report can be used to view the results in a more human readable manner.
Test the msi
Testing the full result of an msi installation is a hard task due to the huge amount of possible actions that a msi can perform (install features, add short-cuts, add registry values...). Nevertheless there is a certain part of the msi testing that can be automated which is msi custom actions.
Custom actions are wix extensions that have been added in the project to perform special operations that wix is not able to do. The tool to be used to test this custom actions is Lux.
To be able to execute the Lux test the following command should be executed when installing the msi:
msiexec /l lux.log /i install\UbuntuOne.msi
Once the installation has been completed search the log for WixRunImmediateUnitTests to see test results. If issues exist with the installer please provide the output of lux.log (from the above command) to the bug report.
UI testing
A UI testing tool can be used to test the msi and add extra logic to ensure that the different operations to place. Read the UI testing for more information.
UI testing
TODO: Complete when ever a tool has been decided.
UbuntuOne/Contribute/WindowsTesting (last edited 2012-01-20 19:37:27 by 30-36-17-190)