Configuring Vapour with Octopus 2.0 - shizzlator/Vapour GitHub Wiki

Vapour can be added as an Octopus deploy step fairly easily. Firstly create your new project in Vapour:

These instructions assume Vapour is running on port 85, and its web API is on port 8040

Create a new vapour project

  1. Navigate to the vapour projects page: http://your-vapour-url:85
  2. Click "Create new"
  3. Enter a project name, e.g. "MyWebsite"
  4. Enter an environment. This should match the environment that you run builds as in Octopus, typically your team name)
  5. Enter a test description, e.g. "Smoke"
  6. Enter an assembly name, e.g. "MyWebsite.Tests.Smoke"

Add project configuration settings

Click on the cog icon on the Vapour projects page, and enter some Configuration entries rows for your chosen environment. The keys should match the appSettings keys in your test project's app.config file. The values should be specific for your environment, so the urls usually match your team name's servers.

Create a new deploy step in Octopus 2.0

Go to your Octopus server and the project you want to run the tests for.

  1. Create a new "Deploy a Nuget package" step
  2. Give the step a name, e.g. "Deploy Smoke Tests"
  3. For NuGet feed, select "Packages"
  4. Select the machine role for your test server, e.g. "TST"
  5. Enter your project's package id, e.g. "MyWebsite.Tests.Smoke"
  6. Select the "Octopus server will download the package..." option
  7. Keep the checkboxes ticked as their defaults
  8. Click the "Configure features" link
  9. Check the "custom installation directory" checkbox and "Apply"
  10. In the "Install to" textbox, enter "D:\Vapour\Assemblies\MyWebsite#{Octopus.Environment.Name}\Smoke" - assuming this is where your assemblies are configured in Vapour's web.config. Change "MyWebsite" to the project name your configured earlier.
  11. Click save

Create a new Powershell step in Octopus 2.0

Before creating this step, create a new global variable (Under Configuration->Library) called "TestServer", which is the server that Vapour runs on.

  1. Give the step a name, e.g. "Run Smoke Tests"

  2. Select the machine role for your test server, the same as the previous Octopus step - e.g. "TST"

  3. Enter the following Powershell script:

     $smokeTestServer = $OctopusParameters['TestServer']
     $environment = $OctopusParameters['Octopus.Environment.Name']
     $projectName = $OctopusParameters['Octopus.Project.Name']
    
     Write-Host "SmokeTestServer: $smokeTestServer"
     Write-Host "Environment: $environment" 
    
     $testUri = "http://" + $smokeTestServer + ":8040/test/" + $projectName + "/" + $environment + "/Smoke"
     $result = Invoke-RestMethod $testUri
     write-host $result.Message
     write-host $result.TestResult
    
     if ($result.Success)
     {
         Exit 0
     }
     else
     {
         Exit 1
     }