devxlogo

Simple Component Testing

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 correctlyDebug.Assert oAdd.AddNumbers(5, 3) = 8 Set oAdd = Nothing End Sub

Now all you have to do is type TestAddition in the Immediate window.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist