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

Need an "only run this after a test fails" mechanism #166

Open
pvlakshm opened this issue Jun 22, 2019 · 3 comments
Open

Need an "only run this after a test fails" mechanism #166

pvlakshm opened this issue Jun 22, 2019 · 3 comments

Comments

@pvlakshm
Copy link
Owner

From @SturlaThorvalds here.

@alfonso-mireles
Copy link

alfonso-mireles commented Jun 24, 2019

So for general test failures I am at the moment doing the following

		public void TestCleanup()
		{
			if (TestContext.CurrentTestOutcome != UnitTestOutcome.Passed)
			{

However, there is no mechanism to perform an action when a specific test fails. If my Test1 fails, I perhaps want to do some action JUST for Test1, and not the other ones.

@pvlakshm
Copy link
Owner Author

Need to specify the following:

  • signature
  • interaction with the other test life cycle methods
  • interaction with the new MSTestEx attributes

Will try to articulate and publish as an RFC for review.

@pvlakshm
Copy link
Owner Author

pvlakshm commented Jul 5, 2019

@alfonso-mireles, @sturlath,
You can check for TestContext.CurrentTestOutcome (as you have shown) and also check for the TestContext.TestName. Do you have any concern with using that pattern?

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