pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.
https://pester.dev/
Other
3.11k stars 473 forks source link

Gherkin related functions - partial lack of help #808

Closed it-praktyk closed 6 years ago

it-praktyk commented 7 years ago

One of the biggest features of Pester v4 is the implementation of Gherking-style (is it a correct description?).

I checked a status of help for Gherkin related functions - I used for this https://github.com/it-praktyk/Pester/tree/DevV4_Addd_Tests_For_Help_2 - and help is not completed - results are listed below.

I think that it should be added before releasing of final Pester v4 version.

What do you think?

Guys - especially: @Jaykul, @adbertram, @KevinMarquette - help is needed.

    Context The function [Find-GherkinStep] - Help
      [-] Synopsis for the function is filled up 167ms
        Expected: value was {Find-GherkinStep [[}, but should not have been the same
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 43
        43:                     $HelpSynopsisBegin | Should Not Be "$Function [["
      [-] Description for the function is filled up 66ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 59
        59:                     $FunctionDescription | Should not BeNullOrEmpty
      [-] The parameter [BasePath] contains description 95ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] The parameter [Step] contains description 62ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] Example - At least one example exist 73ms
        Expected {0} to be greater than {0}
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 95
        95:                     $ExamplesCount | Should BeGreaterthan 0

    Context The function [Get-MockDynamicParameters] - Help
      [+] Synopsis for the function is filled up 176ms
      [-] Description for the function is filled up 58ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 59
        59:                     $FunctionDescription | Should not BeNullOrEmpty
      [-] The parameter [CmdletName] contains description 79ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] The parameter [FunctionName] contains description 57ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] The parameter [ModuleName] contains description 85ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] The parameter [Parameters] contains description 74ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [-] The parameter [Cmdlet] contains description 73ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty

    Context The function [GherkinStep] - Help
      [+] Synopsis for the function is filled up 118ms
      [+] Description for the function is filled up 42ms
      [+] The parameter [Name] contains description 60ms
      [+] The parameter [Test] contains description 65ms
      [-] Example - At least one example exist 63ms
        Expected {0} to be greater than {0}
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 95
        95:                     $ExamplesCount | Should BeGreaterthan 0

    Context The function [Invoke-Gherkin] - Help
      [+] Synopsis for the function is filled up 168ms
      [+] Description for the function is filled up 52ms
      [+] The parameter [FailedLast] contains description 63ms
      [+] The parameter [Path] contains description 76ms
      [+] The parameter [ScenarioName] contains description 65ms
      [+] The parameter [EnableExit] contains description 84ms
      [+] The parameter [Tag] contains description 63ms
      [+] The parameter [ExcludeTag] contains description 62ms
      [+] The parameter [CodeCoverage] contains description 78ms
      [+] The parameter [Strict] contains description 60ms
      [+] The parameter [OutputFile] contains description 54ms
      [+] The parameter [OutputFormat] contains description 67ms
      [+] The parameter [Quiet] contains description 62ms
      [+] The parameter [PesterOption] contains description 53ms
      [+] The parameter [Show] contains description 64ms
      [-] The parameter [PassThru] contains description 75ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 81
        81:                         $ParameterDescription | Should not BeNullOrEmpty
      [+] Example - At least one example exist 80ms
      [+] Example - remarks on [ EXAMPLE 1 ] are filled up 61ms
      [+] Example - remarks on [ EXAMPLE 2 ] are filled up 49ms
      [+] Example - remarks on [ EXAMPLE 3 ] are filled up 74ms
      [+] Example - remarks on [ EXAMPLE 4 ] are filled up 66ms
      [+] Example - remarks on [ EXAMPLE 5 ] are filled up 50ms
      [+] Example - remarks on [ EXAMPLE 6 ] are filled up 56ms
      [+] Example - remarks on [ EXAMPLE 7 ] are filled up 63ms

    Context The function [Invoke-GherkinStep] - Help
      [+] Synopsis for the function is filled up 143ms
      [-] Description for the function is filled up 57ms
        Expected: value to not be empty
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 59
        59:                     $FunctionDescription | Should not BeNullOrEmpty
      [+] The parameter [Step] contains description 61ms
      [+] The parameter [Visible] contains description 64ms
      [+] The parameter [Pester] contains description 60ms
      [-] Example - At least one example exist 62ms
        Expected {0} to be greater than {0}
        at <ScriptBlock>, C:\Users\Wojtek\Documents\Scripts\2 - GitHub Extenal\Pester\Help.Tests.ps1: line 95
        95:                     $ExamplesCount | Should BeGreaterthan 0
nohwnd commented 7 years ago

Is this that crucial for the release? How many regular users of gherkin are there apart from Jaykul's team? Ten maybe? So how about we put it in 4.1?

it-praktyk commented 7 years ago

@Jaykul, could you mark which Gherkin-related functions exported by Pester module shouldn't be directly invoked?

Thank you.

Jaykul commented 7 years ago

Invoke-Gherkin is the big kahuna, like Invoke-Pester Invoke-GherkinStep should probably be private...

Find-GherkinStep is useful outside of tests.

The rest map roughly to the Pester functions, and are meant for use in .Steps.ps1 files like the Pester versions are only meant for use in .Tests.ps1 files

Gherkin Pester
GherkinStep It
BeforeEachFeature BeforeAll
AfterEachFeature AfterAll
BeforeEachScenario BeforeEach
AfterEachScenario AfterEach
it-praktyk commented 6 years ago

The current situation

    Context The function [Find-GherkinStep] - Help
      [-] Example - At least one example exist 9ms
        Expected {0} to be greater than {0}
        103:                     $ExamplesCount | Should BeGreaterthan 0
        at Invoke-LegacyAssertion, <FOLDER_PATH>\Pester\Functions\Assertions\Should.ps1: line 190
        at <ScriptBlock>, <FOLDER_PATH>\Pester\Help.Tests.ps1: line 103

    Context The function [GherkinStep] - Help
      [-] Example - At least one example exist 10ms
        Expected {0} to be greater than {0}
        103:                     $ExamplesCount | Should BeGreaterthan 0
        at Invoke-LegacyAssertion, <FOLDER_PATH>\Pester\Functions\Assertions\Should.ps1: line 190
        at <ScriptBlock>, <FOLDER_PATH>\Pester\Help.Tests.ps1: line 103

Update

It can (?) be skipped if the function Invoke-GherkinStep will not be exported like I propose in the pull request #948.

    Context The function [Invoke-GherkinStep] - Help
      [-] Description for the function is filled up 12ms
        Expected: value to not be empty
        67:                     $FunctionDescription | Should not BeNullOrEmpty
        at Invoke-LegacyAssertion, <FOLDER_PATH>\Pester\Functions\Assertions\Should.ps1: line 190
        at <ScriptBlock>, <FOLDER_PATH>\Pester\Help.Tests.ps1: line 67
      [-] Example - At least one example exist 16ms
        Expected {0} to be greater than {0}
        103:                     $ExamplesCount | Should BeGreaterthan 0
        at Invoke-LegacyAssertion, <FOLDER_PATH>\Pester\Functions\Assertions\Should.ps1: line 190
        at <ScriptBlock>, <FOLDER_PATH>\Pester\Help.Tests.ps1: line 103
it-praktyk commented 6 years ago

@Jaykul, thank you for your answer.

Invoke-GherkinStep should probably be private...

Can you prepare the pull request which changes exported module member?

it-praktyk commented 6 years ago

@Jaykul, I prepared a pull request what I asked you about in the previous comment.

nohwnd commented 6 years ago

The PR #948 is merged.

Jaykul commented 6 years ago

Thanks guys, it's been a bit ... crazy over here. I'll add examples for those two (GherkinStep and Find-GherkinStep)

it-praktyk commented 6 years ago

@Jaykul, can I ask for these examples?

I just opened the pull request #955 what contains tests to validate help completions.

it-praktyk commented 6 years ago

@Jaykul, gentle reminder. Thank you.

KevinMarquette commented 6 years ago

I went ahead and created a few simple examples for these commands.

it-praktyk commented 6 years ago

Thank you @KevinMarquette!

it-praktyk commented 6 years ago

Completed, #994, #995