Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: All
Jul 7, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Simple Component Testing

When creating ActiveX components, an easy way to test them is to add a module to the project (see the code below). In this module you can write methods that will instantiate your component and then call the methods.

To make sure nothing was broken, you can keep your unit testing code with the project and call these functions when you have to edit your code.

 Public Sub TestAddition()
Dim oAdd As cAddition
Set oAdd = New cAddition
'if the result is not 8 then something is not 
working correctly Debug.Assert oAdd.AddNumbers(5, 3) = 8 Set oAdd = Nothing End Sub
Now all you have to do is type TestAddition in the Immediate window.
David A.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date