Does anyone know how to get SimplyVbUnit to work in Access 2010? If so, a quick tutorial would be much apprciated. For the moment I tried adding a reference to the dll but whenever I try to add the activex control to a form access crashes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Unfortunately, SimplyVBUnit wasn't intended for use with MS Access. They definitely don't play nice when MS Access tries to directly use the control. However, I do have an experimental dll that can be referenced within Access. The dll is an external runner, hosting SimplyVBUnit in a standard VB6 form and exposes a global method (ExternalRunner.Run) that accepts a TestSuite object. I've only briefly tested in Access 2003, so I have no idea how it works in 2010.
I've attached the dll to this message so you can try it and give some feedback. To use the dll, reference it from within the Access VB code editor and create a function in a standard module. In the module you will need to create your suite of unit tests then call the ExternalRunner.Run method.
Public Function Tests()
Dim Suite As New TestSuite
Suite.Add New MyTestClass1
Suite.Add New MyTestClass2
ExternalRunner.Run Suite
End Function
You can make a macro or whatever to run this from other parts of Access.
I created a blank database (.accdb). added references to framework 4.1, type library 4.0, and externalRunner.
Class Greeter:
Public Function sayHello() As String
sayHello = "Hello"
End Function
Class GreeterTests:
Public Sub sayHello_methodCalled_returnsHello()
Dim classUnderTest As Greeter
Set classUnderTest = New Greeter
Assert.That classUnderTest.sayHello, Iz.EqualTo("Hello")
End Sub
module testrunner:
Public Sub runtests()
Dim tests As GreeterTests
Dim suite As TestSuite
Set tests = New GreeterTests
Set suite = New TestSuite
suite.Add tests
ExternalRunner.Run suite
End Sub
When stepping through runtests() with the debugger, ExternalRunner.Run suite causes a type mismatch error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, remove the SimplyVBUnit.Framework.dll reference and make sure there is a reference to the SimplyVBUnit.Component.ocx instead. When you are trying to add a control to a form, the UI runner will show up as SimplyVBComp.UIRunner. You don't need to add the control to a form. Just make sure you have a reference to the SimplyVBUnit.Component.ocx.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't heard back from the original poster. You are more than welcome to download the dll I included in my first post of this thread and see if that will work or not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should give http://accunit.access-codelib.net/ a try. It's an Access add-in which relys on the core functions of SimplyVBUnit 3.0 (supposedly not 4.1), but provides an interface that better fits into the MS Access GUI. I'm not that much familiar with the tool, because I have no Access project at the moment. But according to the web site (German language only) there is no restriction, so I assume it's working with all current Access versions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anyone know how to get SimplyVbUnit to work in Access 2010? If so, a quick tutorial would be much apprciated. For the moment I tried adding a reference to the dll but whenever I try to add the activex control to a form access crashes.
Hello,
Unfortunately, SimplyVBUnit wasn't intended for use with MS Access. They definitely don't play nice when MS Access tries to directly use the control. However, I do have an experimental dll that can be referenced within Access. The dll is an external runner, hosting SimplyVBUnit in a standard VB6 form and exposes a global method (ExternalRunner.Run) that accepts a TestSuite object. I've only briefly tested in Access 2003, so I have no idea how it works in 2010.
I've attached the dll to this message so you can try it and give some feedback. To use the dll, reference it from within the Access VB code editor and create a function in a standard module. In the module you will need to create your suite of unit tests then call the ExternalRunner.Run method.
You can make a macro or whatever to run this from other parts of Access.
Thank you very much. I'll start experimenting with this right away. I'll be sure to post some feedback once I get some tests written.
I created a blank database (.accdb). added references to framework 4.1, type library 4.0, and externalRunner.
Class Greeter:
Class GreeterTests:
module testrunner:
When stepping through runtests() with the debugger, ExternalRunner.Run suite causes a type mismatch error.
Ok, remove the SimplyVBUnit.Framework.dll reference and make sure there is a reference to the SimplyVBUnit.Component.ocx instead. When you are trying to add a control to a form, the UI runner will show up as SimplyVBComp.UIRunner. You don't need to add the control to a form. Just make sure you have a reference to the SimplyVBUnit.Component.ocx.
Did this get sorted out? I am interested in the same thing as Sylvain, wanting to do unit testing for VBA in my MS Access 2010 projects.
I haven't heard back from the original poster. You are more than welcome to download the dll I included in my first post of this thread and see if that will work or not.
You should give http://accunit.access-codelib.net/ a try. It's an Access add-in which relys on the core functions of SimplyVBUnit 3.0 (supposedly not 4.1), but provides an interface that better fits into the MS Access GUI. I'm not that much familiar with the tool, because I have no Access project at the moment. But according to the web site (German language only) there is no restriction, so I assume it's working with all current Access versions.
That looks like a very nice add-in. It may be exactly what everyone is looking for!