-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
Suggested fix for #1173 with suitable tests #1174
Conversation
Functions/Gherkin.Tests.ps1
Outdated
for ($i = 0; $i -lt $gherkin.Results.TestResult.Count; $i++) { | ||
$expectedResult = (Get-ExpectedResult $i) | ||
$result = $gherkin.Results.TestResult[$i] | ||
It "Test result $($i + 1) ('$($result.Name)') should be '$expectedResult'" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike code that generates tests -- it's extremely hard to tell what these tests prove, if anything...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we forgot to add test exclusions to the appveyor build. The style/help/whitespace checks should run only when I try releasing. Can’t check right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reacting to the other comment :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike code that generates tests -- it's extremely hard to tell what these tests prove, if anything...
You are right.
That code is a little bit too dynamic.
The test logic must be simpler.
I will replace the function by simple hash tables later...
My goal was to create a data-driven test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jaykul I changed test code and think now it is more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that looks fine now. Honestly, you could probably shorten it to just count the PassedScenarios
, the way the tests at the top of the file do, but I don't mind either way. This is clear and looks correct to me.
@cgnuechtel I upgraded your branch to the latest master because I changed how builds are done. It failed on PowerShell 2 because PowerShell 2 does not automatically expand properties on arrays. Calling |
@nohwnd Thanks, but Set-ItResult does not yet have a |
- Use failure message of pester result instead of exception message on $Pester.AddTestResult invocation in Invoke-GherkinStep - Add parameters file, line and line text to Set-ItResult
@cgnuechtel I see it builds now, is this still work in progress or done? |
@nohwnd I am ready here, but please look at Set-ItResult.ps1 as I added some parameters. However, it should be a non-breaking change. |
@cgnuechtel thanks for the heads up, I think using the Set-ItResult directly was not a good idea (I know I changed your code to do that, so it's my bad.) I will refactor to make it call an internal function that creates the error. The public |
…ester in a weird way
Conflicts resolved: Functions/Gherkin.ps1
- use $details.Message again - add some extended tests for Gherkin output
@nohwnd Please look on this code. I am not sure, if this change is correct. I am also not sure if there are missing tests here. The Gherkin tests I have been added check the NUnit XML output and the inconclusive message, but also some error stuff. If this is too confusing, feel free to remove these tests. |
@cgnuechtel it was the correct change to make I think, but not for the
Hope I did not break anything else. |
All tests pass, merging, if it does not work we should prove it wrong with broken tests. |
Fixes issue #1173 and adds tests for expected step results