kellyethridge / SimplyVBUnit

The SimplyVBUnit framework provides powerful unit-testing capabilities for VB6.
MIT License
41 stars 14 forks source link

No test available in compiled exe #4

Open wqweto opened 5 years ago

wqweto commented 5 years ago

I'm working on tests for this project: https://github.com/wqweto/VbYoga/tree/master/test

Testing works very well in VBIDE but once compiled the classes are recognized with no methods and show (0 Tests)

image

Is there something simple I am missing?

Could it be SimplyVBUnit runtime versions mismatch as 5.0 setup went to C:\Program Files (x86)\SimplyVBUnit 4.1 for some reason?

kellyethridge commented 5 years ago

Hello,

Unfortunately this is the effects of a compiled EXE. Here is a discussion on the issue you're having

wqweto commented 5 years ago

Thank you for the info. Too bad fetching available tests is not possible to be automated in the compiled binary.

I just integrated an (optional) codegen of ITestFixture_GetTestCases directly in the Form_Load of frmTestRunner of my test project to reduce manual copy/paste.

FYI, couple of my tests failed when compiled, e.g. .IsNotNothing node failed on an objects reference for no apparent reason while .AreNotSame Nothing, node now works as expected.

bryceschober commented 5 years ago

I'm also interested in running from a compiled .exe... Were your changes a possible solution to this, @wqweto? Ultimately, what I'd love to do is run all the tests in a command-line mode with reasonable output for an automated build system, @kellyethridge.

wqweto commented 5 years ago

I did not attempt generic solution but had to implement ITestFixture_GetTestCases which is the supported way by the framework.

The most inconvenient part is that although the codegen is automated it has to be triggered manually and the generated code has to be copy/pasted manually too when new tests are added.

Rhorandir commented 2 weeks ago

Just as a comment for the running the test in a CI environment. It is possible to create a console Testrunner with the provided libraries in this project. I need to request our company if we can provide our solution for the OpenSource Community, but the very basic approach is creating a Testcollector in VB6 as part of the COM Library containing the tests and make this interface as static as possible and than build a console application with e.g. .NET and consume this interface and executes the test like the frmtestrunner does, just hand over the collected test classes. You may need to have your VB6 libraries to be project compatible to previously created and shared library with the test runner. (Some COM magic required to make things work). To make things work better with newer cintooling, you can export the test results into other formats like nunit or junit by parsing the testresult and coverting it into your format of choice. Well this approach need to adopted per project, but I guess its even possible to make things more generic, if you know COM better than me ;-)