Frequently Asked Questions
- Product Questions
Q: Will there be a version of vbUnit3 for Visual Basic .NET ?
- Testing Questions
Q: How can I save the test results to a file?
Q: How should I test private methods of my classes? It seems that I have to change them to be public or friend.
Q: How can I perform some initialization and cleanup before and after ALL tests have run?
- Licensing Questions
Q: Will the source code for the vbUnit3 TestRunner be released?
Q: Will there be any royalties for using vbUnit?
Q: Shouldn't all the xUnit tools be free?
Q: What are the implications of the GNU Lesser General Public License?
Q: What is the status of the tests that I have written for vbUnit?
Q: Is it possible to upgrade to a higher license type, e.g. from a 5-user license to a site license?
Q: How should I test private methods of my classes? It seems that I have to change them to be public or friend.A: You've just realized an important point of unit testing, which is the fact that testability is part of your design requirements and will force you to do certain things in a certain way. Usually this results in a much cleaner design.
I do not recommend testing private methods of an object, because it will increase the coupling between interface and implementation. If your tests know about private methods of your object, they know a lot about your specific implementation, and it will be much harder for you to change the implementation without changing all the tests. However, if there is absolutely no way around it, you do indeed need to make the methods under test to be Public or Friend to allow the test classes to see them.
A better way would be to create a new interface that is private to your test project and that exposes the internal details of a class. The class could then implement this interface to allow the test classes to see its details.
However, if your class is so complex that much of it that needs to be tested is private, you should consider refactoring this complexity into several smaller classes with public interfaces that expose the minimum of information necessary to connect each class to the rest of the world. These interfaces would then be a good place to run tests against.
'CompareHexNumbers Public Sub TestCompareHexNumbers m_assert.StringsEqual ToHex(number1), ToHex(number2), "cmpHexNum" End Sub Private Function ToHex(ByVal number As Long) As String ToHex = Right$("00000000" & Hex$(number&), 8) End Function
GNU Lesser General Public License. The vbUnit3 TestRunner is not Open Source and will be licensed for a small fee.
However, if you find vbUnit useful, please support it by registering it.
Please read the full license for all details.
Q: Is it possible to upgrade to a higher license type, e.g. from a 5-user license to a site license?A: Yes, this is possible. The price is generally the difference between these licenses plus five percent. If you would like to upgrade your license please contact firstname.lastname@example.org.