.net - Is it possible to to execute code befor all tests are run? -
i writing integration tests.now, before tests run want setup database initial data.for this, have created separate project, run before test project executed(using msbuild file).but, want merge db setup code in testproject, , have executed before tests executed.i using mbunit 3.is possible?
you can declare class [assemblyfixture] attribute; , few methods class [fixturesetup] , [fixtureteardown] attributes define assembly-level setup , teardown methods.
[assemblyfixture] public class myassemblyfixture {    [fixturesetup]    public void setup()    {       // code run before test fixture within assembly executed.    }     [fixtureteardown]    public void teardown()    {       // code run after test fixture within assembly executed.    } }   in fact, syntax similar done @ test fixture level well-known [testfixture], [setup], , [teardown] attributes.
Comments
Post a Comment