Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples to readme #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,69 @@ The default setup expects a directory structure similar to:

`New-ScriptValidationTest` - This will create a stub script validation test powershell file as a starting point for a new test.

## Examples

### Step Template

`ExampleStepTemplate.ps1`:
```powershell
$StepTemplateName = 'Example Step Template'
$StepTemplateDescription = 'An example step template to demonstrate OctopusStepTemplateCI'
$StepTemplateParameters = @(
@{
'Name' = 'Example Parameter';
'Label' = 'Example Parameter';
'HelpText' = "A placeholder parameter example";
'DefaultValue' = $null;
# values for DisplaySettings can be discovered by watching the structure used via
# the Octopus portal in your browsers dev tools
"DisplaySettings" = @{ }
}
)
Set-StrictMode -Version Latest

throw "Step Template not implemented"
```

`ExampleStepTemplate.Tests.ps1`:
```powershell
Set-StrictMode -Version Latest
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Describe "Example Step Template" {
It "does something useful" {
$true | Should Be $false
}
}
```

### Script Module

`ExampleScriptModule.ps1`:
```powershell
$ScriptModuleName = "Example Script Module"
$ScriptModuleDescription = "An example script module to demonstrate OctopusStepTemplateCI"
Set-StrictMode -Version Latest

throw "Script Module not implemented"
```

`ExampleScriptModule.Tests.ps1`:
```powershell
Set-StrictMode -Version Latest
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Describe "Example Script Module" {
It "does something useful" {
$true | Should Be $false
}
}
```

## License

Copyright 2016 ASOS.com Limited
Expand Down