MbUnit Support for ReSharper

Hi,

if you wan't Unit Test Support, then you can give my MbUnit PlugIn for
ReSharper a chance. It adds support for MbUnit in the Unit Test Runner of
ReSharper.

Download it from my Blog:

http://der-albert.com/archives/93-MbUnit-Support-fuer-ReSharper.html

(The Blog is in german, but the download includes an ReadMe.txt in english
with the instructions).

It is the first try, so not all supported tests of MbUnit may displayed in
the Unit Test Runner. But all Tests should run.

@JetBrains: I have some questions about the Unit-Test API, should i write
them in the openapi group or can you give me a contact person?

--
Freundliche Grüße

Albert

http://der-albert.com

5 comments
Comment actions Permalink

Cool! I would love to see how you use the R# Unit-Test API. I can't find
it documented anywhere.


0
Comment actions Permalink

Hallo flipdoubt,

Cool! I would love to see how you use the R# Unit-Test API. I can't find
it documented anywhere.


It is not documented as far i know.

Here are my Informations, there are two thing to implement

First: Exploring the Code

JetBrains.ReSharper.UnitTestSupport.PluginInterface.IUnitCodeExplorer

public interface IUnitCodeExplorer
{
// Methods
XmlDocument Explore(IMetadataAssembly assembly);
bool IsTestFixture(CodeClass2 codeClass);
bool IsTestFixture(ITypeElement element);
bool IsTestMethod(CodeFunction2 codeFunction);
bool IsTestMethod(ITypeMember element);
bool Vote(IMetadataAssembly assembly);
bool Vote(IProject project);
}

The IsTestFixture() and IsTestMethod() are for finding out if a method or
class (fixture) is for testing. Here for C# only the one with ITypeElement
& ITypeMember are used by ReSharper, i think the other ones are for
languages not supported by ReSharper and uses the Visual Studio Code
Modell. This is only for displaying the

Vote() is for determining if the current Assembly/Project has an Reference
to the Unit Testing Assembly.

Explore() is for exploring your Fixture an filling the Unit Test Runner
with Data, it uses an XmlFormat which i don't know i take a look with
Reflector on the NUnit Plugin.

Second: Running the Test

Implemente an own Runner on based on
JetBrains.ReSharper.UnitTestSupport.PluginInterface.UnitTestAssemblyBase

You have to Implement the Run-Method()

public abstract void Run(string fixtureName, string[] methodNames, bool[]
explicitFlags);

Only Method which are defined within Explore() Method are the methodNames.

Within the Run() method you have to run every method of the test fixture.
How this is done depends on the unit testing framework. MbUnit has a own
runner for all the test wich i call (with some events binding to my code).

UnitTestAssemblyBase has a Listener-Property which implement the
JetBrains.ReSharper.UnitTestSupport.PluginInterface.ITestListener
interface.

public interface ITestListener
{
// Methods
void OnConsole(string runnerId, string assemblyName, string message,
TestOutputType outputType);
void OnException(string runnerId, string assemblyName, string[]
messages, string[] stackTraces);
void OnFixtureFinished(string runnerId, string assemblyName, string
fixtureName, FixtureTestResult testResult, string message);
void OnFixtureStartup(string runnerId, string assemblyName, string
fixtureName);
void OnFixtureTeardown(string runnerId, string assemblyName, string
fixtureName);
void OnTestAppDomainException(string runnerId, string assemblyName,
string[] messages, string[] stackTraces);
void OnTestDiff(string runnerId, string assemblyName, string
fixtureName, string testName, string expected, string was);
void OnTestFinished(string runnerId, string assemblyName, string
fixtureName, string testName, TestResult testResult, string message, double
time);
void OnTestStarted(string runnerId, string assemblyName, string
fixtureName, string testName);
void RequestAbort(string runnerId);
}

You have to call

OnFixtureStartup()

foreach (Method to Test)
{
OnTestStarted()
-> Run the Test
OnTestFinished()
}

OnFixtureFinished()

The other are optional.

That's seems to be all :)

Regards

Albert
http://der-albert.com

0
Comment actions Permalink

Hallo Albert Weinert,

Download it from my Blog:

http://der-albert.com/archives/93-MbUnit-Support-fuer-ReSharper.html


I released a new Version which runs with MbUnit 2.3 and 2.4. The "old" one
only runs with 2.3.105

Regards

Albert

0
Comment actions Permalink

Hallo Albert Weinert,

I released a new Version which runs with MbUnit 2.3 and 2.4. The "old" one
only runs with 2.3.105


Another Update is available

0.2.10105 1/5/2007

- ProcessFixture/TestSequence-Tests now correctly displayed in Runner
- Display Console Output of the Test in Runner
- Correct displaying of an Exception in Runner if a test fails.

http://der-albert.com/archives/95-Update-zum-MbUnit-PlugIn-fuer-ReSharper.html

Regards

Albert

0
Comment actions Permalink

Hello Albert,

Check this one, please: http://jetbrains.net/jira/browse/RSRP-35440

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


AW> Hi,
AW>
AW> if you wan't Unit Test Support, then you can give my MbUnit PlugIn
AW> for ReSharper a chance. It adds support for MbUnit in the Unit Test
AW> Runner of ReSharper.
AW>
AW> Download it from my Blog:
AW>
AW> http://der-albert.com/archives/93-MbUnit-Support-fuer-ReSharper.html
AW>
AW> (The Blog is in german, but the download includes an ReadMe.txt in
AW> english with the instructions).
AW>
AW> It is the first try, so not all supported tests of MbUnit may
AW> displayed in the Unit Test Runner. But all Tests should run.
AW>
AW> @JetBrains: I have some questions about the Unit-Test API, should i
AW> write them in the openapi group or can you give me a contact person?
AW>
AW> Albert
AW>
AW> http://der-albert.com
AW>


0

Please sign in to leave a comment.