kellyethridge / simplyvbunit Goto Github PK
View Code? Open in Web Editor NEWThe SimplyVBUnit framework provides powerful unit-testing capabilities for VB6.
License: MIT License
The SimplyVBUnit framework provides powerful unit-testing capabilities for VB6.
License: MIT License
SimplyVBComp.UIrunner not a loaded class and does not compile
First of all, let me thank you for bringing this project to GitHub and continuing to develop it (and for making it in the first place, of course!).
I became interested in it a few months ago, when it was still on SourceForge, and had become convinced that it was stone-dead. I was flabbergasted when I saw "5.0" today!!
Now, here's the actual, first, request. It's not very fun, I'm afraid:
Would it be possible to add to the repository the releases before 2009-11?
I suppose that's the date you started to use a VCS (svn), and that's the reason the repository starts there.
However, I imagine you still have copies of the code of at least the major releases before that, right? Apparently at least the 3.0 and the 2.1 versions used to be downloadable from SourceForge; they are not anymore but I imagine you kept copies of at least them.
To help studying the code:
Currently there are 136 files just in the Framework part, with very little documentation, so it's very hard to understand even where to start to read the code.
In what's currently the first commit of the repository there were a lot less files (47 in the Framework), but still enough to make getting familiar with the code quite an endeavour.
However I imagine things were a lot simpler in the first releases.
They were for sure very different from the current code (looking at https://sourceforge.net/p/simplyvbunit/news it appears you rewrote everything more than once), but they would most likely help to understand how things started and how they got to the current point, and so to gradually understand the current code.
What's more, the core of the source is probably still where it was in the first versions, so studying them can tell you at the very least where to start from with the current code.
By the way, yes, the lack of documentation is a problem in itself (maybe I'll make a separate Issue about that), but even if the code were extensively documented looking at how it was in the first releases would be helpful in some cases. At the very least, it would be interesting!
You are probably thinking, "this guy doesn't know that you can't change a git repository's history".
It's not like that, I do. However:
Git has a feature to indeed change a repository's history, although not really: it's git replace.
It lets you "cover" individual commits with different ones, so that the commands and tools that support the feature behave as if you replaced the commits, but without changing the hashes of the following commits.
It's a trick, but it works rather well in my experience.
This allows to put new commits before the beginning of the current repository, by replacing the first commit of the repository with one identical except for the addition of a reference to another commit (this commit would be the most recent one of the chain of commits you want to add).
It's not very fun, but not as hard as it might appear either. I could guide you in the process if you decide to take this step.
The move to git and github was very recent, and you appear to have made only 9 commits since then. This means that we are still at a time where rewriting the repository would not be unthinkable: there are probably very few people who already cloned it, there are no references to previous hashes in the current commit messages and it would probably not cause significant disruption to the developers (you) to have indeed the history rewritten.
Given the favourable state of things, I think this option should be given serious consideration: git replace does seem to work well but it's a trick, and using it is likely to bring some problems, for some uses, now or in the future. So as long as it's conceivable to make a complete rewrite instead of using it, it's strongly advisable to consider doing so.
If you do take this path, remember to put a very prominent note in the README.md warning of the rewrite, with instructions for what to do if you had already cloned the repository.
Even just one old release would help a lot, but if you happen to have more snapshots, possibly even between the public versions ("manual", copy-and-pase, version control, or possibly even commits of a VCS you used only privately, if you did) , it would help a lot to include them as well. The more the better, to understand the evolution of a software project.
Well, I ask you now most of all because I just now got to know that the project is still alive, but aside from that we're now very close to the ideal time for doing stuff like this, as I explained above.
So it's worthwhile to give this thing a serious consideration now, before enough people clone or reference the repository that rewriting it becomes inconceivable.
A simple alternative of course would be to simply re-publish the code of the old versions somewhere.
Entirely acceptable, but if we can, including them in the repository itself would add a considerable amount of convenience for the "students"/code archeologist.
If you do end up rewriting the history, it might be helpful (for someone) to add a tag, in the rewritten repository, to what was the first commit in the current history, to help them understand what happened and cope with it.
It might be called "previous_first_commit", with a lengthier explanation in its comment (annotation).
As per Issue #3, if you do this it would be better to add tags for these old versions as well.
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)
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?
It would be convenient if you added git tags for the old releases (before v4.1.6) as well.
It's true that there are few enough of them that it's easy to look for their commits manually, but tags would add convenience.
And if you end up adding other old releases, as per Issue #2, well tags would become even more handy.
I'd like to announce the release of SimplyVBUnit version 5.0.1.
This version includes a couple bug fixes and UI enhancement.
Fixes
Asserting against a compiled object that is private is incorrectly handled.
Enhanced enumerable object detection for objects of private classes.
Features
Added "Errors" panel to status bar in UI.
Thank you for the great work building SimpleVBUnit! It seems that template references are now correct inside the source code, while are broken in the latest release version 5.0.4.
It would be great if it were possible to create a new release version 5.0.5 with the updates so that newcomers can immediately get started with the examples and enjoy all the great functionality that SimpleVBUnit provides. It would be then possible to close the related issue (#13). Thank you in advance for the consideration!
I'm pleased to announce the release of version 5.0.4.
Added a minor enhancement with this release.
I'm using ver. 5.0.4, no previous version used.
On creating new SimpleVBUnit project via wizard, test runner form are not created correctly
and I got error dialog about .tlb
reference.
It is because template .vbp
and .frm
has bad references of component and type library.
Project template (.vbp
and .frm
) should have good references like this, I guess:
(I'm happy with these templates copied into C:\Program Files (x86)\Microsoft Visual Studio\VB98\Template\Projects\
)
diff --git a/Source/Projects/SimplyVBUnit Project.vbp b/Source/Projects/SimplyVBUnit Project.vbp
index 0275626..40ba2a0 100644
--- a/Source/Projects/SimplyVBUnit Project.vbp
+++ b/Source/Projects/SimplyVBUnit Project.vbp
@@ -1,7 +1,7 @@
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automatio
n
-Reference=*\G{923925AC-1013-4D27-9FB1-4FF0B3B47BA2}#4.0#0#..\..\..\..\..\..\..\Windows\SysWow64\SimplyVBUnitType.tlb#Simp
lyVBUnit Type Library 4.0
-Object={7983BD3B-752A-43EA-9BFF-444BBA1FC293}#4.0#0; SimplyVBUnit.Component.ocx
+Reference=*\G{3E4F7CEC-C640-49F1-80D9-8DD42421CB1B}#5.0#0#..\..\..\..\..\..\..\Windows\SysWOW64\SimplyVBUnitType.tlb#Simp
lyVBUnit 5.0 Type Library
+Object={7983BD3B-752A-43EA-9BFF-444BBA1FC293}#5.0#0; SimplyVBUnit.Component.ocx
Form=frmTestRunner.frm
Startup="frmTestRunner"
Command32=""
diff --git a/Source/Projects/frmTestRunner.frm b/Source/Projects/frmTestRunner.frm
index 303644d..2fda3b7 100644
--- a/Source/Projects/frmTestRunner.frm
+++ b/Source/Projects/frmTestRunner.frm
@@ -1,5 +1,5 @@
VERSION 5.00
-Object = "{7983BD3B-752A-43EA-9BFF-444BBA1FC293}#3.2#0"; "SimplyVBUnit.Component.ocx"
+Object = "{7983BD3B-752A-43EA-9BFF-444BBA1FC293}#5.0#0"; "SimplyVBUnit.Component.ocx"
Begin VB.Form frmTestRunner
ClientHeight = 5535
ClientLeft = 120
When assertion failed on running tests, runner will stop with runtime error dialog.
I expect that this error is catched and counted as 'failed test', and continue next test.
I guess it might be because I'm using Japanese version of VB6 (SP6).
For example, with this test code...
Sub Test1()
Assert.Fail "test for assertion"
End Sub
... cause runtime error dialog.
(NOTE: "実行時エラー" means "runtime error")
this issue looks the same as https://sourceforge.net/p/simplyvbunit/discussion/415411/thread/807817da/
looks like the install is trying to get the path by reading the registry
RegQueryStringValue(HKCU,'Software\Microsoft\Visual Basic\6.0', 'TemplatesDirectory', TemplateDir);
which doesn't exist on my machine
I think it could use the ProductDir registry key in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Basic
to get the install folder for vb6, then append "TemplatesDirectory". I couldn't say if people are seeing different registry keys for their VB6 setups, or why the key for "TemplatesDirectory" doesn't exist on my machine.
copying "frmTestRunner.frm" and "SimplyVBUnit Project.vbp" from "C:\Program Files (x86)\SimplyVBUnit 5.0\Source\Projects" to "C:\Program Files (x86)\Microsoft Visual Studio\VB98\Template\Projects" got the templates added.
Under my project solution i have multiple web tests in Visual Studio 2017. While checking in git repo now i am trying to add this solution which has all web test scripts in azure pipeline release. Once release is created everything runs well including project solution but end of the release it says "No test is available in D:\a\r1\a_Performance\drop\packages". So it never runs those web tests in the assigned vsts2017 VMserver.
[command]D:_work_tool\VsTest\16.0.0\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe @d:_work_temp\5c6a81b1-3ba4-11e9-9f62-33b695c91a61.txt
2019-02-28T22:01:12.8971948Z Microsoft (R) Test Execution Command Line Tool Version 16.0.0
2019-02-28T22:01:12.8974196Z Copyright (c) Microsoft Corporation. All rights reserved.
2019-02-28T22:01:12.8974262Z
2019-02-28T22:01:13.6547537Z vstest.console.exe
2019-02-28T22:01:13.6548147Z "D:_work\r1\a_Performance\drop\WebAndLoadTestProject1\bin\Release\Microsoft.VisualStudio.QualityTools.WebTestFramework.dll"
2019-02-28T22:01:13.6548405Z "D:_work\r1\a_Performance\drop\WebAndLoadTestProject1\bin\Release\WebAndLoadTestProject1.dll"
2019-02-28T22:01:13.6549990Z /Settings:"D:_work_temp\5c7b2380-3ba4-11e9-9f62-33b695c91a61.testsettings"
2019-02-28T22:01:13.6550436Z /logger:"trx"
2019-02-28T22:01:20.2083460Z Starting test execution, please wait...
2019-02-28T22:01:21.4449882Z The following DLL(s) do not match the specified framework .NETFramework,Version=v4.5 and platform X86 settings.
2019-02-28T22:01:21.4450541Z Microsoft.VisualStudio.QualityTools.WebTestFramework.dll is built for Framework 4.0 and Platform AnyCPU.
2019-02-28T22:01:21.4451521Z Ensure that the test assemblies target the specified framework/platform settings. Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings.
2019-02-28T22:01:31.8712695Z TestSettings will soon be deprecated for automated unit and functional testing scenarios. It is recommended that you use RunSettings. To learn more, see http://aka.ms/runsettings
2019-02-28T22:01:35.3315409Z TestSettings will soon be deprecated for automated unit and functional testing scenarios. It is recommended that you use RunSettings. To learn more, see http://aka.ms/runsettings
2019-02-28T22:01:36.6120443Z No test is available in D:_work\r1\a_Performance\drop\WebAndLoadTestProject1\bin\Release\Microsoft.VisualStudio.QualityTools.WebTestFramework.dll D:_work\r1\a_Performance\drop\WebAndLoadTestProject1\bin\Release\WebAndLoadTestProject1.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
2019-02-28T22:01:37.1681780Z Results File: D:_work\r1\a\TestResults\VssAdministrator_fv-az550_2019-02-28_22_01_36_943.trx
When the test "Assert.AreNotEqual 1, 1" is attempted the error message contains the text
Expected: not 1
But was : Empty
This behaviour is also seen if tests Assert.AreNotEqualFloats or Assert.AreNotEqualStrings are used.
I've traced this back to EqualConstraint.Matches.
mActual is only populated when mComparer.Equals(mExpected, Actual) = False.
The fix is to always call "VariantCopyInd mActual, Actual" at the start of EqualConstraint.Matches.
Has anyone noticed this and if so do you have a different solution?
You can find the screenshots attached.
The included examples seem to fail executing the test cases, and report that no tests are inside each of the classes inside the AssertionExamples, MovieTracker or any new SimpleVBUnit Project that is build from scratch. All this while running them from the VB6 IDE with Administrative Rights and Windows XP Service Pack 2 Compatibility Mode on Windows 10.
I also tried to implement ITestFixture like it was recommended on the Sourceforge Forum for compiled executables without success.
With ITestFixture you can see the test case listed, but it does not run and I get back Error 429, ActiveX cannot create the object.
Option Explicit
Implements ITestFixture
Private Sub ITestFixture_GetTestCases(ByVal Test As SimplyVBComp.TestFixtureBuilder)
Test.Add("myTest").Use "arg"
End Sub
Public Sub myTest()
Debug.Print "This is a failing test."
Assert.That 1, Iz.EqualTo(2), "Always fails!"
End Sub
Is there anything I can do to solve the problem? Is there any test I may help with in order to pinpoint the problem and fix the issue in new releases?
Thank you for your precious support!
Screenshot of the AssertionExamples project included in the 5.0.4 release not finding any tests:
Screenshot of the MovieBusinessGroup project included in the 5.0.4 release not finding any tests:
If a VB object in a dll is private but can be accessed through some means, performing assertions against that object fails because there is no public type information interface, causing SimplyVBUnit
to fail, usually with a method ~ of~ failed
type description.
@kellyethridge , all
I'm trying to create a simple dll project with SimplyVBUnit and running into a weird problem. When I open the project group and build the project, everything goes according to plan THE FIRST TIME, but every subsequent build attempt after results in a Permission Denied error in reference to my dll. If I close the project group and reopen it, I can build it ONCE but never again until I restart VB6. Additionally, if I only open the dll project (not the group that contains the test project also) I don't have any trouble building repeatedly. If I re-add the test project to the environment, same problem happens. It seems as if SimplyVBUnit is locking the dll file after the first build. I've verified that the test project is referencing the dll vbp and not the dll directly. Any advice?
Scott
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.