Skip to content

Commit

Permalink
Merge pull request #19 from it-praktyk/master
Browse files Browse the repository at this point in the history
The project README.md updated, example added to Format-Pester v. 1.4.1
  • Loading branch information
it-praktyk authored Dec 3, 2016
2 parents 2498da0 + d72706c commit 021277b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 70 deletions.
6 changes: 3 additions & 3 deletions Format-Pester/Format-Pester.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RootModule = 'Format-Pester.psm1'
# Version number of this module.
# If you are increasing ModuleVersion please change also the values of variable 'ScriptVersion' in the Format-Pester.ps1 file
# Verify also translations and increase the values of msg00 fields
ModuleVersion = '1.4.0'
ModuleVersion = '1.4.1'

# ID used to uniquely identify this module
GUID = 'daa609a5-1293-4f62-9467-1a120c529e87'
Expand Down Expand Up @@ -97,7 +97,7 @@ PrivateData = @{
Tags = @('Pester','PScribo')

# A URL to the license for this module.
# LicenseUri = 'https://github.com/equelin/Format-Pester/blob/master/LICENSE'
LicenseUri = 'https://github.com/equelin/Format-Pester/blob/master/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/equelin/Format-Pester'
Expand All @@ -106,7 +106,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''
ReleaseNotes = 'https://github.com/equelin/Format-Pester/blob/master/VERSIONS.md'

} # End of PSData hashtable

Expand Down
19 changes: 14 additions & 5 deletions Format-Pester/Public/Format-Pester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,20 @@ Function Format-Pester {
This command will document the results of the Pester's tests.
Documents will be stored in the current path and they will be available in 3 formats (.html,.docx and .txt).
.EXAMPLE
Invoke-Pester -PassThru | Export-Clixml -Path .\Test-Result.xml
Import-Clixml -Path .\Test-Result.xml | Format-Pester -Format .\ -BaseFileName Test-Result -Format HTML -FailedOnly
The first command you can run e.g. on a server where PScribo and Format-Pester is not installed. The tests results will be stored in a file as xml representation of object.
After copy the file to the computer where PScribo and Format-Pester are available you can generate report. The html file will be generated with results of failed tests only.
.LINK
https://github.com/equelin/Format-Pester
.LINK
https://github.com/iainbrighton/PScribo
.NOTES
Initial author: Erwan Quelin
Expand All @@ -84,10 +96,7 @@ Function Format-Pester {
LICENSE
Licensed under the MIT License - https://github.com/equelin/Format-Pester/blob/master/LICENSE
TODO
- Pester test need to be updated - yes, post factum TDD ;-)
#>
#>

[CmdletBinding(DefaultParameterSetName = 'AllParamSet')]
[OutputType([IO.FileInfo])]
Expand Down Expand Up @@ -150,7 +159,7 @@ Function Format-Pester {
[Switch]$DumpPScriboObject
)

[Version]$ScriptVersion = "1.4.0"
[Version]$ScriptVersion = "1.4.1"

If ($Version.IsPresent) {

Expand Down
90 changes: 30 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ Powershell module for documenting Pester's results.

All the formating work is done by the module [PScribo](https://github.com/iainbrighton/PScribo).

## Example
Reports are generated base on a custom PowerShell object returned by Invoke-Pester run with the parameter `PassThru`. NUnit style files generated by Pester are not supported at that moment by Format-Pester.

If you can't generate report on a computer where tests are executed please save tests results piping them to `Export-Clixml`.

You can be interested also in the [ReportUnit](http://reportunit.relevantcodes.com/) tool what is a report generator for the test-runner family. It uses stock reports from NUnit, MsTest, xUnit, TestNG and Gallio and converts them HTML reports with dashboards.

## Report example

![](./img/format-pester.png)

Expand All @@ -14,96 +20,60 @@ Screenshot from HTML report generated by Format-Pester v. 1.3.0, PScribo v. 0.7.
More examples you can find [here](/examples/).

## Supported languages
Since version 1.3.0 internationalization of generated reports is supported.
Since version 1.3.0 internationalization of generated reports is supported. Internalization means that report parts e.g. section names, columns headers, etc. can be wrote in a language different than English.

Currently available languages
- en-US - English United Staes - main language
- pl-PL - Polish

If would you like add support for your language please read the section 'Information for translators'
If would you like add support for your language please read the section [Information for translators](https://github.com/equelin/Format-Pester/wiki/Information-for-translators) in the project wiki.

# Requirements

- Powershell v.4.x
- [Pester](https://github.com/pester/Pester)
- [PScribo](https://github.com/iainbrighton/PScribo) - preferred the version >= 0.7.12.47 due to [bug](https://github.com/iainbrighton/PScribo/issues/20)

# Instructions
## Install the module
```powershell
# One time setup with Powershell 5
Install-Module Format-Pester
# Or Manually
# Download the repository
# Unblock the zip
# Extract the Format-Pester folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)
# Import the module
Import-Module Format-Pester #Alternatively, Import-Module \\Path\To\Format-Pester
# Usage

# Get commands in the module
Get-Command -Module Format-Pester
Format-Pester is the PowerShell module so before usage it you need import it - more instruction you can find in [wiki](https://github.com/equelin/Format-Pester/wiki/Importing-Format-Pester).

# Help for commands
Get-Help Format-Pester -Full
## Example 1
```PowerShell
Invoke-Pester -PassThru | Format-Pester -Path . -Format HTML,Word,Text
```
## Online help
You can read [online version of help](/doc/Format-Pester.md) - online help generated by [platyPS module](https://github.com/powershell/platyps)

# Usage
This command will document the results of the Pester's tests. Documents will be store in the current path and they will be available in 3 formats (.html,.docx and .txt).

## Example 2
```PowerShell
Invoke-Pester -PassThru | Format-Pester -Path . -Format HTML,Word,Text
Invoke-Pester -PassThru | Export-Clixml -Path .\Test-Result.xml
Import-Clixml -Path .\Test-Result.xml | Format-Pester -Format .\ -BaseFileName Test-Result -Format HTML -FailedOnly
```

The first command you can run e.g. on a server where PScribo and Format-Pester is not installed. The tests results will be stored in a file as xml representation of object.

After copy the file to the computer where PScribo and Format-Pester are available you can generate report. The html file will be generated with results of failed tests only.

This command will document the results of the Pester's tests. Documents will be store in the current path and they will be available in 3 formats (.html,.docx and .txt).
## Online help
You can read [online version of help](/doc/Format-Pester.md) - online help generated by [platyPS module](https://github.com/powershell/platyps).

# Available functions
# Initial author

- [Format-Pester](/doc/Format-Pester.md)
- Erwan Quélin - [GitHub](https://github.com/equelin) - [Twitter](https://twitter.com/erwanquelin)

# Contributors

- Travis Plunk - [GitHub](https://github.com/TravisEz13) - [Twitter](https://twitter.com/TravisPlunk)
- Wojciech Sciesinski - [GitHub](https://github.com/it-praktyk) - [Twitter](https://twitter.com/ITpraktyk)

# Author

**Erwan Quélin**
- <https://github.com/equelin>
- <https://twitter.com/erwanquelin>

# Information for translators
Format-Pester can be used to prepare reports in languages different than English but a language file for your PSCulture/language need to be available.

To translate required strings to your language please
- read general information about PowerShell support for internationalization
```
Get-Help about_Script_Internationalization
```
online version about_Script_Internationalization available [here](https://technet.microsoft.com/en-us/library/hh847854.aspx).
- create subfolder with your language/culture code under Public - e.g. xx-XX
- copy the file [Format-Pester.psd1](/Public/en-US/Format-Pester.psd1) from Public\en-US\ to your xx-XX - please don't translate module manifest - files have the same name!
- translate required strings
- test - please use Pester, to skip non-translation related tests please use the command
```
Invoke-Pester -Path .\tests\ -Tag Translations
```
you can also uncomment line in the Format-Pester.ps1 file (remember about re-import module with Force)
```
#$LocalizedStrings
```
- use the Language parameter if your PSCulture is different than required language for output
- submit your translation to public repo, pull requests are welcomed

# [Version history](VERSIONS.md)

# [TODO and development plans](TODO.md)

# License
Copyright 2016 Erwan Quelin and the community.
Licensed under the MIT License
Licensed under [the MIT License](LICENSE)

# TODO
- updated examples - align them to v. 1.4.0 and PScribo 0.7.12.47
- update VERSIONS.md
- automate preparing example files
6 changes: 6 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# TODO AND DEVELOPMENT PLANS
- add support for NUnit style xml file -> restore PS objects from NUnit https://github.com/pester/Pester/blob/master/Functions/TestResults.ps1#L41
- add support for create separate file by blocks Describe and Context of used/documented tests
- updated examples - align them to v. 1.4.0 and PScribo 0.7.12.47
- update VERSIONS.md
- automate preparing example files
8 changes: 6 additions & 2 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
## 1.2.0 - 2016-07-20

## 1.3.0 - 2016-08-14
-

## 1.3.1 - 2016-08-14
- Fix: added explicit Throw for null or empty PesterResult parameter
Expand All @@ -22,4 +21,9 @@
- Fix issue #12
- Update
- help: descriptions of INPUTS, OUTPUTS added
- possibility to dump the PScribo Document object added
- possibility to dump the PScribo Document object added

## 1.4.1 - 2016-12-04
- Update
- help: an example added, link to PScribo added
- module manifest: added link to the VERSION.md

0 comments on commit 021277b

Please sign in to comment.