Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayBazuzi/9786331 to your computer and use it in GitHub Desktop.
Save JayBazuzi/9786331 to your computer and use it in GitHub Desktop.
Mark certain XUnit tests as "expensive" so they don't get run by default.
class ExpensiveFactAttribute : FactAttribute
{
public ExpensiveFactAttribute()
{
// remove this line to run these expensive tests
base.Skip = "Expensive";
}
}
@JayBazuzi
Copy link
Author

For example, suppose you want to test the code that calls in to a service that charges you $0.10 each time. Weekly that's fine; every 10 seconds and it becomes a problem.

Or maybe after the test runs you have to clean up the mess that it makes.

Or maybe the test is inherently slow.

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