Skip to content

Fix FastFetch test failure#186

Merged
kyle-rader merged 6 commits intomicrosoft:masterfrom
kyle-rader:bug/fastfetch-force-checkout-test-failure
Aug 20, 2018
Merged

Fix FastFetch test failure#186
kyle-rader merged 6 commits intomicrosoft:masterfrom
kyle-rader:bug/fastfetch-force-checkout-test-failure

Conversation

@kyle-rader
Copy link
Contributor

@kyle-rader kyle-rader commented Aug 17, 2018

This should fix the somehow missed test failure for FastFetch addressing #185

@kyle-rader kyle-rader self-assigned this Aug 17, 2018
if (!expectError)
{
result.Errors.ShouldBeEmpty(result.Errors);
result.ExitCode.ShouldEqual(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If expectError is true can\should we verify that ExitCode is non-zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yep, thanks

@kyle-rader kyle-rader force-pushed the bug/fastfetch-force-checkout-test-failure branch from 33fc478 to 9087f85 Compare August 17, 2018 18:32
@kyle-rader kyle-rader requested a review from wilbaker August 17, 2018 18:34
result.Output.Contains("Error").ShouldEqual(expectError, result.Output);
if (expectError)
{
Assert.IsTrue(result.Errors.Length > 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our tests we try to use the Should syntax whenever possible. Rather than doing:

Assert.IsTrue(result.Errors.Length > 0);

Switch to something like one of these:

result.Errors.Length.ShouldBeNonEmpty("Expected an error message");
result.Errors.Length.ShouldBeAtLeast(1, "Expected an error message");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would Should be non empty mean for an integer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, that option should have been result.Errors.ShouldBeNonEmpty("Expected an error message");

@kyle-rader kyle-rader requested a review from wilbaker August 17, 2018 18:52
result.Output.Contains("Error").ShouldEqual(expectError, result.Output);
if (expectError)
{
result.Errors.Length.ShouldBeAtLeast(1, "Expected at lest 1 error");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: lest -> least

@kyle-rader kyle-rader requested a review from wilbaker August 17, 2018 19:20
@wilbaker
Copy link
Member

@kyle-rader I'm approving but please make sure full functional tests pass before merging

@kyle-rader kyle-rader force-pushed the bug/fastfetch-force-checkout-test-failure branch from 58adfb5 to 0422c3b Compare August 17, 2018 20:09

string[] expectedResults = new string[] { "Cannot use --force-checkout option without --checkout option." };
result.ShouldContain(expectedResults);
// Run a second time in the same repo on the same branch with more folders but expect an error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyle-rader, could you update this comment to explain why we're expecting an error?

(I'm not sure why the check you removed was failing)

@kyle-rader kyle-rader force-pushed the bug/fastfetch-force-checkout-test-failure branch from c151bd4 to e514b3b Compare August 20, 2018 18:01
@kyle-rader kyle-rader merged commit 47701d6 into microsoft:master Aug 20, 2018
@kyle-rader kyle-rader changed the title Enable runFastFetch to expect an error Fix FastFetch test failure Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants