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

Allow for assembly setup and teardown #111

Closed
giggio opened this issue Jun 4, 2014 · 3 comments
Closed

Allow for assembly setup and teardown #111

giggio opened this issue Jun 4, 2014 · 3 comments

Comments

@giggio
Copy link

@giggio giggio commented Jun 4, 2014

Similar to what is find in AssemblyInitialize for MsTest or SetUpFixture in NUnit, allow some code to run before any test in a specific assembly run, and after all of them have ran.

The main reason to ask for that is because of integration tests, where we usually need to do some preparation on the environment before any tests can run, like write some files, migrate a DB, bring up a web server, etc. And to clear it all up at the end.

Also, it is very hard to migrate from other framework that already support this.

I am aware that there are workarounds. I understand that it is possible to create some static class with a static constructor and call it somehow, or maybe have all test classes inherit from a base test class and do the setup there. But this means have to mix setup concerns with test concerns, which is not good design. Also, again, it is a lot of work when migrating from some other framework and you have hundreds of tests.

@bradwilson
Copy link
Member

@bradwilson bradwilson commented Aug 2, 2014

After discussing this, we have decided that we are opting not to do this. Thank you for the suggestion, though.

@bradwilson bradwilson closed this Aug 2, 2014
@ewilde
Copy link

@ewilde ewilde commented Feb 9, 2015

@bradwilson I struggling to enable some scenarios without this kind of feature. Here is what i do with nunit during an integration test.

[SetUpFixture]
    public class RunOncePerNamespace
    {
        [SetUp]
        public void Setup()
        {
           // Setup databases and services
        }

        [TearDown]
        public void TearDown()
        {
            // Shutdown databases and services
        }
    }

What are the workarounds in xunit the enable this type of thing ? Care to share why you opted out of doing this?

@athinboy
Copy link

@athinboy athinboy commented May 13, 2020

@ewilde @bradwilson
I think ewilde is reasonable!
Can you give us a why ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.