Hi,
In our company we use typemock to test some of our code, and we have a server that do continues integration. We use FinalBuilder/CruiseControl to build our code evertime there have been checked in some changes to the code, and then all tests are run.
(The server is 64-bit)
In one of our tests we try to mock some call to a fillAll procedure that is filling a collection from a database.
TestCode:
Dim _mockObjectCollection As New SubscriptionCollection
Using recorder As New RecordExpectations
Mercatus.Common.Data.BusinessObjects.BusinessObjectDataProvider.Instance.FillAll( _
_mockObjectCollection)
End Using
'Execute code:
Dim s As String = SubscriptionController.ProcessSubscriptions()
In SubscriptionController.ProcessSubscriptions() we have this call, where typemock fails to mock, subscriptions.FillAll()
<System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
Public Sub FillAll() Implements IBusinessObjectCollection.FillAll
DataProvider.FillAll(Me)
End Sub
And that is calling this code which we try to mock in our recorder.
''' <summary>
''' Populate a businessObjectCollection from datastorage, by a select *
''' </summary>
''' <param name="itemCollection">The businessObjectCollection to populate</param>
Public Sub FillAll(ByVal itemCollection As IBusinessObjectCollection)
If itemCollection Is Nothing Then
Throw New ArgumentNullException("itemCollection")
End If
Using reader As DbDataReader = DataMapper.ListAll(itemCollection.ItemObjectName)
PopulateCollectionFromReader(reader, itemCollection)
End Using
End Sub
This works fine when we are running it on our developer machines, but sometimes fails when we run it in our server that runs our builds.
The error we get is that it can not open database (which is not created hence the mocking).
The strange thing is that this is not consistent, sometimes the mocking is ok, and somtimes it is not mocking. (It is more correct than wrong!!)
And in most cases a new force build solves the problem.
Are we doing something wrong in our test, or is this a bug?
Are there some logging in typemock we can turn on to get more information?
On the same server we run multiple projects on different build scripts that use TypeMock to run their unittests. But they are not running simultainously.
Regards
Magne Hopland