Installing vbUnitFree
Components
- vbUnitFreeTestRunner - the ActiveX EXE that runs the tests.
- RunVBUnit - the command line exe, used for quick testing when the green/red indicator might not be needed or for use in batch files when testing large parts of a system.
- vbUnitFreeAddIn - VB IDE Add-In that lets you run you tests in the IDE.
- vbUnitFreeSampleTests - a sample Dll that can be used to learn how to use the testing tools. Contains working and failing tests that demonstrate the full behaviour of vbunitfree.
Binary install
- Download the distribution
- Extract the distribution to a suitable place.
- Use the batch file to register the components.
- Add the location of the RunVBUnit.exe file to your path, so that you can easily run it from the command line and in scripts.
Source
- Get the latest source from cvs.
- Check that you have vbUnit3.dll registered on your system.
- Compile in the following order, respecting the usual COM rules when it comes to binary compatibility. If you have a major change to make, submit a patch so that future distributions contain any fixes that you've made.
- vbUnitFreeTestRunner.vbp
- RunVBUnit.vbp. This either needs to be compiled using something like Matt Curland's VB6 Console Application add-in, or hacking the resulting exe using some other means. See the resources section.
- vbUnitFreeAddin.vbp. Fully functional version. There are still a few features that it would be nice to have here, like shortcut keys to run the tests.
- Try running the vbUnitFreeSampleTests project.
Writing Tests
- vbUnit online tutorial. vbUnitFree was created to provide free implementation of this functionality, so the tutorial can be followed and is a good introduction to how to start writing tests, along with considerations like which parts of the interface to test and suggestions on how to structure your source directories.
- Command Line Help
- Add-In Help
Resources
Creating Console applications with Visual Basic 6
- Matt Curland's site for the book Advanced Visual Basic 6. Sadly this site appears to be defunct, showing that book authors as well as Microsoft are dropping support for VB6. So I'd try Amazon for the book if you're interested, or just use one of the other methods.
- NirSoft sample
Using the Microsoft Linker to do the job for you. I'm not sure whether this requires Visual C++ (the installed location would tend to imply that you do), but you should have an exe named link.exe in Microsoft Visual Studio/VC98/BIN/. You can pass it the following command:
link /edit /subsystem:console [path]\runvbunit.exe
This corresponds to a call to the application editbin.exe like this:
editbin /subsystem:console [path]\runvbunit.exe
There are others as well, but basically it involves altering a flag in the Portable Executable File format, showing that this is a Console application rather than a GUI application.
Further Reading
- 'Test Driven Development By Example' by Kent Beck
- Wiki for eXtreme Programming and agile methods.
- JUnit
- Eclipse project I used the CVS client for vbUnitFree, but also, a lot of the sources of my playing with VB come from what I do with Java. I miss not having certain features in VB6!
- xp123 Test-First Challenge. It is in Java, but is a nice way of developing and really helps develop the rhythm of a test-first approach.