Gishu Pillai | 18 Nov 2011 06:32
Picon
Gravatar

Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Disclaimer: My MSTest exposure has been less than a week.

Context: We're using NUnit for acceptance/customer tests. Recently there
were opinions of choosing/moving to MSTest (due to reasons e.g. better
integration with TFS et.all). So there are heavy code blocks that we want
to run ONCE per test-class.
e.g. Sample FixtureSetup => Start the app and dependent services. Teardown
would be the opposite.

However it is important that they execute in cycles of FixtureSetup >>
Tests >> FixtureTeardown.
MSTest seems to be collecting FixtureTeardowns and executing them as a
bunch at some random point of time in the future.

Already posted this on SO.. but it seems to have crossed SO's usual
time-period before getting buried :)
http://stackoverflow.com/questions/8173371

So I decided to shrug my inertia & give it a fair try (more details in the
blog post linked in the SO Question). This is the only hurdle that cannot
be worked around. So if someone has solved / worked around this.. please
share.

Thanks,
Gishu

[Non-text portions of this message have been removed]

------------------------------------

(Continue reading)

Donaldson, John (GEO | 21 Nov 2011 09:09
Picon
Favicon

RE: Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Gishu,

I've used both - and generally prefer NUnit. *But* if you are in a MS-only environment, then go with the flow
and embrace the whole MS story.
They have perfectly acceptable "setup"s. And the test runner knows about the order they should run in. Some
of the rich NUnit syntax is missing though...

Also, I have to say I really like the integration inside Visual Studio.

John D.

-----Original Message-----
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Gishu Pillai
Sent: 18 November 2011 06:32
To: testdrivendevelopment <at> yahoogroups.com
Subject: [TDD] Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Disclaimer: My MSTest exposure has been less than a week.

Context: We're using NUnit for acceptance/customer tests. Recently there were opinions of
choosing/moving to MSTest (due to reasons e.g. better integration with TFS et.all). So there are heavy
code blocks that we want to run ONCE per test-class.
e.g. Sample FixtureSetup => Start the app and dependent services. Teardown would be the opposite.

However it is important that they execute in cycles of FixtureSetup >> Tests >> FixtureTeardown.
MSTest seems to be collecting FixtureTeardowns and executing them as a bunch at some random point of time in
the future.

Already posted this on SO.. but it seems to have crossed SO's usual time-period before getting buried :)
(Continue reading)

Gishu Pillai | 23 Nov 2011 16:27
Picon
Gravatar

RE: Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Did you mean implement Setup as [Teardown Everything + Setup] since Setup
is reliable?

The problem I am having is that MSTest seems to be
1. collecting ClassCleanup (TestFixtureTearDown) methods while it is
running
2. running all collected methods together as a batch at the end

What this causes is TestClass#1 can trip up Class#2 (since
FixtureTeardown#1 has been deferred).

For unit tests, I guess this can be worked around.

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/testdrivendevelopment/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/testdrivendevelopment/join
    (Yahoo! ID required)

<*> To change settings via email:
(Continue reading)

Donaldson, John (GEO | 24 Nov 2011 10:29
Picon
Favicon

RE: Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Gishu,

Personally I stayed away from that whole TestContext thing.
If you just use TestClass and TestMethod - it's like any test runner.
But the various setups and contexts are a bit special and I have tended to avoid them.

John D.

-----Original Message-----
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Gishu Pillai
Sent: 23 November 2011 16:28
To: testdrivendevelopment <at> yahoogroups.com
Subject: RE: [TDD] Can I achieve deterministic suite/fixture/class teardown with MSTest ?

Did you mean implement Setup as [Teardown Everything + Setup] since Setup is reliable?

The problem I am having is that MSTest seems to be 1. collecting ClassCleanup (TestFixtureTearDown)
methods while it is running 2. running all collected methods together as a batch at the end

What this causes is TestClass#1 can trip up Class#2 (since
FixtureTeardown#1 has been deferred).

For unit tests, I guess this can be worked around.

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links
(Continue reading)


Gmane