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

TestContext.CurrentTestOutcome is always InProgress in the TestCleanup method #548

Closed
mjcheetham opened this issue Feb 27, 2017 · 2 comments
Labels

Comments

@mjcheetham
Copy link
Member

mjcheetham commented Feb 27, 2017

Description

In the TestCleanup method, the TestContext.CurrentTestOutcome property is always InProgress rather than the actual current test outcome.

Using the old test framework (bundled with VS, New > Project > Unit Test) the outcome is set correctly.

Steps to reproduce

using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class MyTestClass
{
	public TestContext TestContext { get; set; }

	[TestMethod]
	public void PassTest()
	{
		Assert.IsTrue(true);
	}

	[TestMethod]
	public void InconclusiveTest()
	{
		Assert.Inconclusive();
	}

	[TestMethod]
	public void FailTest()
	{
		Assert.Fail();
	}

	[TestCleanup]
	public void TestCleanup()
	{
		System.Console.WriteLine($"{TestContext.TestName}: {TestContext.CurrentTestOutcome}");
	}
}

Expected behavior

TestContext.CurrentTestOutcome is set to the actual outcome type of the current test.

image

Image taken when executing the code above using the old VS-bundled framework.

Actual behavior

TestContext.CurrentTestOutcome is always InProgress

image

Image taken when executing the code above using the new NuGet package framework.

Environment

  Version
OS Windows 10 Enterprise build 14393
IDE Visual Studio Enterprise 2015 Update 3
Target framework 4.5.2
MSTest.TestAdapter 1.1.12
MSTest.TestFramework 1.1.11
@AbhitejJohn
Copy link
Contributor

Thanks for reporting this @mjcheetham. Created microsoft/testfx#89.

@codito
Copy link
Contributor

codito commented Apr 1, 2017

Closing since this is already tracked in testfx repo.

@codito codito closed this as completed Apr 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants