Skip to content

Commit

Permalink
more help docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mwrock committed Oct 22, 2012
1 parent f925a9d commit 7a8f2f5
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 14 deletions.
39 changes: 38 additions & 1 deletion Functions/Context.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
function Context($name, [ScriptBlock] $fixture) {
function Context {
<#
.SYNOPSIS
Provides syntactic sugar for logiclly grouping It blocks within a single Describe block.
.PARAMETER Name
The name of the Context. This is a phsae describing a set of tests within a describe.
.PARAMETER Fixture
Script that is executed. This may include setup specific to the context and one or more It blocks that validate the expected outcomes.
.EXAMPLE
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
Context "when root does not exist" {
It "..." { ... }
}
Context "when root does exist" {
It "..." { ... }
It "..." { ... }
It "..." { ... }
}
}
.LINK
Describe
It
#>
param(
$name,
[ScriptBlock] $fixture
)

Setup

Expand Down
54 changes: 54 additions & 0 deletions Pester.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Module manifest for module 'Pester'
#
# Generated by: mwrock
#
# Generated on: 10/21/2012
#

@{

RootModule = 'Pester.psm1'
Description = 'Pester is a BDD based Unit Testing Framework for Powershell'
ModuleVersion = '1.7.0'
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module
AliasesToExport = '*'

# List of all modules packaged with this module.
# ModuleList = @()

# List of all files packaged with this module
FileList = 'en-US\about_should.help.txt'

# Private data to pass to the module specified in RootModule/ModuleToProcess
# PrivateData = ''

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

28 changes: 15 additions & 13 deletions Pester.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ function Invoke-Pester {
Invokes Pester to run all tests (files containing .Tests.) recursively under the relative_path
.DESCRIPTION
Upon calling Invoke-Pester. All files that have a name containing ".Tests."
will have there tests defined in their Describe blocks executed. Invoke-Pester
begins at the location of relative_path and runs recursively through each sub
directory looking for *.Tests.* files for tests to run. If a TestName is
provided, Invoke-Pester will only run tests that have a describe block with a
matching name. By default, Invoke-Pester will end the test run with a simple
report of the number of tests passed and failed output to the console. One may
want pester to "fail a build" in the event that any tests fail. To accomodate
this, Invoke-Pester will return an exit code equal to the number of failed
tests if the EnableExit switch is set. Invoke-Pester will also write a NUnit
style log of test results if the OutputXml parameter is provided. In these
cases, Invoke-Pester will write the result log to the path provided in the
OutputXml parameter.
Upon calling Invoke-Pester. All files that have a name containing
".Tests." will have there tests defined in their Describe blocks
executed. Invoke-Pester begins at the location of relative_path and
runs recursively through each sub directory looking for
*.Tests.* files for tests to run. If a TestName is provided,
Invoke-Pester will only run tests that have a describe block with a
matching name. By default, Invoke-Pester will end the test run with a
simple report of the number of tests passed and failed output to the
console. One may want pester to "fail a build" in the event that any
tests fail. To accomodate this, Invoke-Pester will return an exit
code equal to the number of failed tests if the EnableExit switch is
set. Invoke-Pester will also write a NUnit style log of test results
if the OutputXml parameter is provided. In these cases, Invoke-Pester
will write the result log to the path provided in the OutputXml
parameter.
.PARAMETER relative_path
The path where Invoke-Pester begins to search for test files. The default is the current directory.
Expand Down
1 change: 1 addition & 0 deletions en-US/about_should.help.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Some help about should

0 comments on commit 7a8f2f5

Please sign in to comment.