Could Resharper support Unit Test Report?

Dear,

I encounter a very strange problem when using Resharper Unit testing tools.

The problem is:

1. I have a COM+ Component, which was written in VB, and registered into COM+ Service.
In this component, its methods receives a message ( by parameter) and then write or delete some data in Sql Server 2000, which under COM+ and MTC Transaction control.

2. I write a NUnit Test Class to test those methods. To make my test envirment clean and same, I use System.EnterpriseService Transaction to rollback the modification during testing.
The sample code is the following:

VB:
Public Function UpdateInfo( some paramters) as Variant

// ado
Connection " Begin Transaction"

// do some thing. such as delete, insert, update some data.

Connection "Commit Transaction"
or "Rollback "
End Function

C# Test:
// register as a COM+ Compoent so as to using Distrbute Transaction



public class TestVB : ServicedComponent
{


public void fixturesetup(){
// register the VB COM+ Component into COM+ Service.
}


public void fixtureteardown(){
// unregister the component.
}


public void Setup(){
// using ADO.NET to insert some testing data into database directly.
}


public void Teardown(){
ContextUtil.SetAbort(); // rollback whole Transaction.
}


public void testsxx(){
// invoke the method in VB component, and then using ADO.NET to verify whether success or not.
}

}


The problem is, everytime I use JetBrains.ReSharper.UnitTestRunner.exe run those test case, it's OK, it's green bar.
But when I try to run it using NUnit.exe or NUnit.console.exe , those case all failed, Red bar...

I want to know is there any differece between JetBrains.ReSharper.UnitTestRunner.exe and NUnit.exe , I mean the implement details ?
Or, could JetBrains.ReSharper.UnitTestRunner.exe support test report and command line testing, so that I could integrate into CC.NET for our daily build?


Thanks.

5 comments
Comment actions Permalink

Definetely, there is difference between out UnitTestRunner and NUnit.
We tried to simulate NUnit behavour completely, but in some circumstances
the behavour could differ

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"hbifts" <no_reply@jetbrains.com> wrote in message
news:7458284.1153463832091.JavaMail.itn@is.intellij.net...

Dear,

>

I encounter a very strange problem when using Resharper Unit testing
tools.

>

The problem is:

>

1. I have a COM+ Component, which was written in VB, and registered into
COM+ Service.
In this component, its methods receives a message ( by parameter) and then
write or delete some data in Sql Server 2000, which under COM+ and MTC
Transaction control.

>

2. I write a NUnit Test Class to test those methods. To make my test
envirment clean and same, I use System.EnterpriseService Transaction to
rollback the modification during testing.
The sample code is the following:

>

VB:
Public Function UpdateInfo( some paramters) as Variant

>

// ado
Connection " Begin Transaction"

>

// do some thing. such as delete, insert, update some data.

>

Connection "Commit Transaction"
or "Rollback "
End Function

>

C

  1. Test:

// register as a COM+ Compoent so as to using Distrbute Transaction

>



public class TestVB : ServicedComponent
{

>


public void fixturesetup(){
// register the VB COM+ Component into COM+ Service.
}

>


public void fixtureteardown(){
// unregister the component.
}

>


public void Setup(){
// using ADO.NET to insert some testing data into database directly.
}

>


public void Teardown(){
ContextUtil.SetAbort(); // rollback whole Transaction.
}

>


public void testsxx(){
// invoke the method in VB component, and then using ADO.NET to verify
whether success or not.
}

>

}

>
>

The problem is, everytime I use JetBrains.ReSharper.UnitTestRunner.exe run
those test case, it's OK, it's green bar.
But when I try to run it using NUnit.exe or NUnit.console.exe , those case
all failed, Red bar...

>

I want to know is there any differece between
JetBrains.ReSharper.UnitTestRunner.exe and NUnit.exe , I mean the
implement details ?
Or, could JetBrains.ReSharper.UnitTestRunner.exe support test report and
command line testing, so that I could integrate into CC.NET for our daily
build?

>
>

Thanks.



0
Comment actions Permalink

oh....

So, could resharper supply Unit Test Report so that we could integrate it into Daily build?

0
Comment actions Permalink

It is better to modify your tests so they will be successfull under any test
runner....

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"hbifts" <no_reply@jetbrains.com> wrote in message
news:9944378.1153472214185.JavaMail.itn@is.intellij.net...

oh....

>

So, could resharper supply Unit Test Report so that we could integrate it
into Daily build?



0
Comment actions Permalink

:(

I think so...

I have modified those test case, now it could run well under NUnit.

0
Comment actions Permalink

Most of the time I have seen this behavior it is an error in the sequencing of the tests... I have experienced the same issues. Usually when using R#'s unit tests, you are typically running a single test, am I right? and when running NUnit you are testing the suite.

Try using R# to run the suite and see if it fails as well... also you can check to see if maybe the test itself is to blame by writing another test that repeatedly runs your failing test to see if the results are the same after x iterations (usually 10-20 iterations should be enough to nail down any variations).

A simplified example of where this could be a problem:

DateTime expected = DateTime.Now
DateTime actual = DateTime.Now

Assert.AreEqual(expected, actual); //Will fail intermittently

Actually fails some of the time... though when running it, intermittently it will pass... simply because the time elapsed between the two declarations. Also be aware of boxing / unboxing issues... i.e.:

object x = 4
object y = 4

Assert.AreEqual(x,y) // will fail

Hope this helps you nail it down.... Ciao

0

Please sign in to leave a comment.