Skip to content

Commit

Permalink
Merge pull request #16 from it-praktyk/demo-extended
Browse files Browse the repository at this point in the history
Demo tests extended, examples for v. 1.3.3. added
  • Loading branch information
it-praktyk authored Sep 5, 2016
2 parents 964f241 + bae9948 commit 5d3dced
Show file tree
Hide file tree
Showing 15 changed files with 1,034 additions and 110 deletions.
158 changes: 103 additions & 55 deletions demo/DemoFunction1.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,55 +1,103 @@
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Import-Module "$here\DemoFunction1.ps1"

Describe "DemoFunction1" {

Context "Useless test 1-1" {

It "does something useful 1-1-1" {
DemoFunction1 -FirstParam 5 | Should BeLessThan 3

}

It "does something useful 1-1-2" {

DemoFunction1 -FirstParam 5 | Should BeLessThan 7

}

It "does something useful 1-1-3" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $(Get-Random -Maximum 100 -Minimum 0)

}

}

Context "Useless test 1-2" {

It "does something useless 1-2-1" {

DemoFunction1 -FirstParam 6 | Should Be 5

}

It "does something useless 1-2-2" {

DemoFunction1 -FirstParam 5 | Should Be 5

}

It "does something useful 1-2-3" {

$RandomResult = $(Get-Random -Maximum 100 -Minimum 0)

DemoFunction1 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $RandomResult

}

}

}

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Import-Module "$here\DemoFunction1.ps1"

Describe "DemoFunction1 - Random" -Tag Random {

Context "Useless test R-1-1" {

It "does something useful R-1-1-1" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 2 -Minimum 0) | Should Be $true

}

It "does something useful R-1-1-2" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 10 -Minimum 0) | Should BeLessThan 7

}

It "does something useful R-1-1-3" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $(Get-Random -Maximum 100 -Minimum 0)

}

}

Context "Useless test R-1-2" {

It "does something useless R-1-2-1" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 32 -Minimum 27) | Should Be 30

}

It "does something useless R-1-2-2" {

DemoFunction1 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeGreaterThan 30

}

It "does something useful R-1-2-3" {

$RandomResult = $(Get-Random -Maximum 100 -Minimum 0)

DemoFunction1 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $RandomResult

}

}

}

Describe "DemoFunction1 - Static" -Tag Static {

Context "Useless test S-1-1" {

It "does something useful S-1-1-1" {

DemoFunction1 -FirstParam 5 | Should BeLessThan 3

}

It "does something useful S-1-1-2" {

DemoFunction1 -FirstParam 5 | Should BeLessThan 7

}

It "does something useful S-1-1-3" {

DemoFunction1 -FirstParam 56 | Should Be 56

}

}

Context "Useless test S-1-2" {

It "does something useless S-1-2-1" {

DemoFunction1 -FirstParam 6 | Should Be 5

}

It "does something useless S-1-2-2" {

DemoFunction1 -FirstParam 5 | Should BeGreaterThan 3

}

It "does something useful S-1-2-3" {

DemoFunction1 -FirstParam 2 | Should Not Be 2

}

}

}
158 changes: 103 additions & 55 deletions demo/DemoFunction2.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,55 +1,103 @@
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Import-Module "$here\DemoFunction2.ps1"

Describe "DemoFunction2" {

Context "Useless test 2-1" {

It "does something useful 2-1-1" {
DemoFunction2 -FirstParam 5 | Should BeLessThan 3

}

It "does something useful 2-1-2" {

DemoFunction2 -FirstParam 5 | Should BeLessThan 6

}

It "does something useful 2-1-3" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $(Get-Random -Maximum 100 -Minimum 0)

}

}

Context "Useless test 2-2" {

It "does something useless 2-2-1" {

DemoFunction2 -FirstParam 6 | Should Be 5

}

It "does something useless 2-2-2" {

DemoFunction2 -FirstParam 5 | Should Be 5

}

It "does something useful 2-2-3" {

$RandomResult = $(Get-Random -Maximum 100 -Minimum 0)

DemoFunction2 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $RandomResult


}

}

}
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Import-Module "$here\DemoFunction2.ps1"

Describe "DemoFunction2 - Random" -Tag Random {

Context "Useless test R-2-1" {

It "does something useful R-2-1-1" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 2 -Minimum 0) | Should Be $true

}

It "does something useful R-2-2-2" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 10 -Minimum 0) | Should BeLessThan 7

}

It "does something useful R-2-1-3" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $(Get-Random -Maximum 100 -Minimum 0)

}

}

Context "Useless test R-2-2" {

It "does something useless R-2-2-1" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 32 -Minimum 27) | Should Be 30

}

It "does something useless R-2-2-2" {

DemoFunction2 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeGreaterThan 30

}

It "does something useful R-2-2-3" {

$RandomResult = $(Get-Random -Maximum 100 -Minimum 0)

DemoFunction2 -FirstParam $(Get-Random -Maximum 100 -Minimum 0) | Should BeLessThan $RandomResult

}

}

}

Describe "DemoFunction2 - Static" -Tag Static {

Context "Useless test S-2-1" {

It "does something useful S-2-1-1" {

DemoFunction2 -FirstParam 3 | Should Be 3

}

It "does something useful S-2-2-2" {

DemoFunction2 -FirstParam 8 | Should BeGreaterThan 7

}

It "does something useful S-2-1-3" {

DemoFunction2 -FirstParam 56 | Should Not Be 56

}

}

Context "Useless test S-2-2" {

It "does something useless S-2-2-1" {

DemoFunction2 -FirstParam 6 | Should Be 6

}

It "does something useless S-2-2-2" {

DemoFunction2 -FirstParam 2 | Should BeGreaterThan 3

}

It "does something useful S-2-2-3" {

DemoFunction2 -FirstParam 1 | Should BeLessThan 2

}

}

}
30 changes: 30 additions & 0 deletions examples/1.3.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Example files generated by
- Format-Pester v. 1.3.3
- PScribo v. 0.7.12.47

## Known issues
- Polish (pl-PL) specific letters are not correctly dipslayed in a text format - [bug need be investigated](https://github.com/equelin/Format-Pester/issues/12)

## en-US

### 20160822a
```powershell
Invoke-Pester -Path .\demo\ -Quiet -PassThru | Format-Pester -Format word,html,text -Path .\examples\1.3.3\en-US\ -BaseFileName 20160822a -GroupResultsBy Result-Describe -Language en-us
```

### 20160823b
```powershell
Invoke-Pester -Path .\demo\ -Quiet -PassThru -Tag Static | format-pester -Format word,html,text -Path .\examples\1.3.3\en-US\ -BaseFileName 20160822b -GroupResultsBy Result-Describe-Context -Language en-us
```

## pl-PL

### 20160822a
```powershell
Invoke-Pester -Path .\demo\ -Quiet -PassThru | Format-Pester -Format word,html,text -Path .\examples\1.3.3\pl-PL\ -BaseFileName 20160822a -GroupResultsBy Result-Describe -Language pl-PL
```

### 20160823b
```powershell
Invoke-Pester -Path .\demo\ -Quiet -PassThru -Tag Static | format-pester -Format word,html,text -Path .\examples\1.3.3\pl-PL\ -BaseFileName 20160822b -GroupResultsBy Result-Describe-Context -Language pl-PL
```
Binary file added examples/1.3.3/en-US/20160822a.docx
Binary file not shown.
Loading

0 comments on commit 5d3dced

Please sign in to comment.