Skip to content
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

Label text sent to console when running multiple tests #54

Closed
jcansdale opened this issue Oct 5, 2016 · 3 comments
Closed

Label text sent to console when running multiple tests #54

jcansdale opened this issue Oct 5, 2016 · 3 comments

Comments

@jcansdale
Copy link
Owner

jcansdale commented Oct 5, 2016

NOTE: When running all tests in a project/solution, any console/trace output will be labeled with the name of the test that output it.

When a test outputs some text, it can be a pain to find the noisy test when executing all tests in a project/solution.

One solution would be to label text output when running all tests in a project. E.g.

Hello, World!
<-- Namespace.TestClass.HelloTest

777
<-- Namespace.TestClass.NumberTest

I wonder how this might impact BDD folk? Any thoughts @mwhelan?

@jcansdale
Copy link
Owner Author

@mwhelan, Here's a preview version with this functionality.

TestDriven.NET-4.0.3410_Extraterrestrial_Beta.zip

Simply Run Test(s) on a project who's tests write to the console. I'd be interested to hear what you think. 😄

@jcansdale jcansdale added this to the v4.0-beta2 milestone Oct 7, 2016
@mwhelan
Copy link

mwhelan commented Oct 7, 2016

@jcansdale
Hey Jamie

First off, awesome that the BDDfy console report is now working with TestDriven.Net! How did you get that working?

To answer your question, here is the output. The output label is a little bit redundant with the BDD scenario output already providing the identifying info. Thoughts?

------ Test started: Assembly: Specify.Examples.UnitSpecs.dll ------

NUnit .NET Core Runner 3.4.0 
Copyright (C) 2016 Charlie Poole

Runtime Environment
    OS Platform: Windows
     OS Version: 10.0.14393
        Runtime: win10-x64

Test Files
    D:\Apps\github\Specify\src\Samples\Examples\Specify.Examples.UnitSpecs\bin\Debug\netcoreapp1.0\Specify.Examples.UnitSpecs.dll

Story: Account holder withdraws cash story
    As an Account Holder
    I want to withdraw cash from an ATM
    So that I can get money when the bank is closed

Scenario: Account Has Insufficient Funds
    Given the Account Balance is $10
      And the Card is valid
      And the machine contains enough money
    When the Account Holder requests $20
    Then the ATM should not dispense any Money
      And the ATM should say there are Insufficient Funds
      And the Account Balance should be $20
      And the Card should be returned

Passed
<-- Specify.Examples.UnitSpecs.ATM.AccountHasInsufficientFunds.Specify

Story: Account holder withdraws cash story
    As an Account Holder
    I want to withdraw cash from an ATM
    So that I can get money when the bank is closed

Scenario: Account Has Sufficient Funds
    Given the account balance is $100
      And the Card is valid
      And the machine contains enough money
    When the account holder requests $20
    Then the ATM should dispense $20
      And the account balance should be $80
      And the Card should not be retained

Passed
<-- Specify.Examples.UnitSpecs.ATM.AccountHasSufficientFunds.Specify

Story: Account holder withdraws cash story
    As an Account Holder
    I want to withdraw cash from an ATM
    So that I can get money when the bank is closed

Scenario: Card Has Been Disabled
    Given the Card is disabled
    When the account holder requests $20
    Then the Card should be retained
      And the ATM should say the Card has been retained

Passed
<-- Specify.Examples.UnitSpecs.ATM.CardHasBeenDisabled.Specify

Specifications For: OrderProcessor

Scenario: Orders With A Negative Quantity
    Given the item is available
    When processing an order with a negative quantity
    Then the order is rejected
      And it does not check the inventory
      And it does not raise an order submitted event

Passed
<-- Specify.Examples.UnitSpecs.OrderProcessing.orders_with_a_negative_quantity.Specify

Specifications For: OrderProcessor

Scenario: Processing An Order
    Given the item is available
    When processing an order
    Then the order is accepted
      And it checks the inventory
      And it raises an order submitted event

Passed
<-- Specify.Examples.UnitSpecs.OrderProcessing.processing_an_order.Specify

5 passed, 0 failed, 0 skipped, took 3.28 seconds (netcoreapp1.0).

@jcansdale jcansdale reopened this Oct 7, 2016
@jcansdale
Copy link
Owner Author

At the moment test results (json format) and console output end up in the same place. It's a case of disentangling it all. 😄

I've found labeling the output to be useful when debug messages might be sent to Trace.WriteLine or there might be some left over Console.WriteLine diagnostics. Without the label, finding the noisy test can be a pain. Unfortunately these labels don't work so well in the BDD scenario. 😢

I'll have a think...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants