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

Test (Explorer) events #268

Open
djfoxer opened this issue Aug 28, 2022 · 1 comment
Open

Test (Explorer) events #268

djfoxer opened this issue Aug 28, 2022 · 1 comment

Comments

@djfoxer
Copy link

djfoxer commented Aug 28, 2022

Hi, where Can I find details about subscribing to the Tests results (from Test Explorer) ? Just want to know when Tests Failed or Passed,

@tonyhallett
Copy link

from the vstest repo

This mentions some extensibility points https://github.com/microsoft/vstest/blob/main/docs/RFCs/0001-Test-Platform-Architecture.md

The extension I work obtains this information via reflection.
We export an ITestContainerDiscoverer and handle the StateChanged event specifically looking for the TestOperationStates.TestExecutionFinished. The IOperation can be reflected to obtain TotalTests and FailedTests.
https://github.com/FortuneN/FineCodeCoverage/blob/e5eff797294cb27be86f83fe1644d133af87e5fe/SharedProject/Impl/TestContainerDiscovery/TestOperationFactory.cs#L31
The extensibility interfaces were obtained from https://www.nuget.org/packages/Microsoft.VisualStudio.TestWindow.Interfaces

This information can probably be obtained by adding a DataCollector https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel

The Initialize method receives DataCollectionEvents that you can subscribe to - TestCaseEnd args has a TestOutcome property of enum type

public enum TestOutcome
{
    /// <summary>
    /// Test Case Does Not Have an outcome.
    /// </summary>
    None = 0,

    /// <summary>
    /// Test Case Passed
    /// </summary>
    Passed = 1,

    /// <summary>
    /// Test Case Failed
    /// </summary>
    Failed = 2,

    /// <summary>
    /// Test Case Skipped
    /// </summary>
    Skipped = 3,

    /// <summary>
    /// Test Case Not found
    /// </summary>
    NotFound = 4,
}

This is not the correct repo and this issue should be closed as this repo is for ( samples ) vs extensibility and you are requesting information on a particular visual studio extension.

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

No branches or pull requests

2 participants