Skip to content

Exposing ExitCodes class #7156

@smdn

Description

@smdn

Summary

Please expose Microsoft.Testing.Platform.Helpers.ExitCodes class.

Background and Motivation

I am currently writing code to test the MTP extension, and I am utilizing the return value of ITestApplication.RunAsync (=exit code) as the test result.
The values and meanings of MTP exit codes are documented, but I would like Microsoft.Testing.Platform.Helpers.ExitCodes class to be exposed so that it can be used in my code as well.

For example, I want to use ExitCodes in test code like the following:

 [Test] // NUnit test case
 public async Task TestMyMTPExtension()
 {
-  const int ZeroTestsExitCode = 8;
 
   var applicationBuilder = await TestApplication.CreateBuilderAsync(...);
 
   applicationBuilder.AddMyExtensionProvider(); // Add my MTP extension to be tested
 
   var application = await applicationBuilder.BuildAsync();
 
   Assert.That(
     await application.RunAsync(),
-    Is.EqualTo(ZeroTestsExitCode),
+    Is.EqualTo(ExitCodes.ZeroTests),
     "Test application must exit without any errors."
   );
 }

Proposed Feature

Make Microsoft.Testing.Platform.Helpers.ExitCodes public.
The namespace likely needs to be changed to a more appropriate one.

Alternative Designs

Instead of exposing ExitCodes, add an equivalent enum type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MTPBelongs to the Microsoft.Testing.Platform core library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions