2

I am trying to implement SimplyVBUnitTesting for a VB6 project. The wiki says to add a reference to the main project DLL.

My first thought was, "How would I do that for a standard exe that has an MDI form in it?" (Doesn't seem like you can create a DLL with an MDI form in it.)

My second thought was, "Could I use a project group to add a reference to the main project?"

The documentation that I have seen online seems to always be referring to a main project referencing ActiveX projects (which have no problem forming a DLL). They say that the reference for the other projects should be listed in (Project -> References...) after all of the actively selected references and before the alphabetical listing of unused references. It doesn't seem to be listed there. Can you only make a reference to projects that could make a DLL?

I am surprised as this is exceptionally easy for .NET for every type of project within the same solution. Am I missing something?

(I don't really want to change the original project type to accommodate testing as it might complicate the deployment.)

Jeffrey P
  • 357
  • 1
  • 4
  • 17
  • Did you try the 'Browse' button in the references dialog? – Rob Jun 02 '14 at 21:32
  • Yes, I had thought about that, but it only points to Type Libraries (*.olb; *.tlb; *.dll) or Executable Files (*.exe; *.dll) or ActiveX Controls (*.ocx) or All Files ( *.* ). Upon pointing to the .vbp file for the original project I get an error message "can not be referenced because it's project type is EXE." Well, that seems definitive. – Jeffrey P Jun 02 '14 at 21:37
  • Probably not ideal, as it would get compiled with the main exe (or you have to drop it before deploying) - but you can add it to the original project and just set the frmTestRunner.frm as the startup object. Blech. – Jeffrey P Jun 02 '14 at 22:09

1 Answers1

4

Unfortunately it's not possible to add a reference to a Standard EXE.

If the classes you wish to test are in a Standard EXE, then the best you can do is to add a SimplyVBUnit Standard EXE project to the project group that contains your main EXE. You can then share the class files from your main EXE with the SimplyVBUnit EXE by adding an existing class and browsing to your main EXE classes. You would add new classes to the SimplyVBUnit project that hold your tests as you normally would. You would have to select the start-up project depending of if you want to run tests or the main application.

It's a cumbersome solution for sure. Especially if your classes have dependencies that access areas in your main EXE. You would need to wrap those dependencies up and set up fake environments in the testing exe.

Kelly Ethridge
  • 1,669
  • 1
  • 11
  • 12
  • I came to the same conclusion. Although technically I am not using a project group anymore. I am just keeping separate .vbp files. One with only the production files and one with production + test files. At least this way the startup objects can be set once. The downside would be having to add any new classes to the the test.vbp... but you'd have to add a new test class for it anyway. A solution, but ick! I'm glad we are migrating away from VB6! – Jeffrey P Jun 03 '14 at 15:59