When you use the binary installer version it will place a project template in
the VB6 project templates folder. So, when you start VB6 you can select the
SimplyVBUnit project to begin. Also, in the SimplyVBUnit installation folder
in program files there are example projects.
Kelly
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! But what to do with already existing projects that "just" should get
some unit tests now? And then how to continue? Sorry, that may be dumb
questions, but I stumbled over this project during a session with Paul
Rohorzka this weekend and have never used this kind of unit tests before.
Is there any "How to start" document somwhere around? If not, perhaps I can
write one after I managed this all :-)
Thanks again,
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To add tests to an existing project can be kind of difficult depending on how
the project is structured.
If the code you want to test is in an EXE project then the only way to test
that code is to include the tests within the same project. If the code is in a
DLL then you would add a new SimplyVBUnit project to the group or create a new
project group with the SimplyVBUnit project and the DLL project.
For testing an existing DLL project:
1) Add new SimplyVBUnit project to the same project group as the DLL project
2) Add reference to the DLL project from the SimplyVBUnit project
3) Add test classes as shown in the example test projects
For testing an EXE project requires a bit of effort:
1) Add reference to "SimplyVBUnit Framework v3.x"
2) Add reference to "SimplyVBUnit 3.0 Type Library"
3) Copy the "frmSimplyVBUnit3Runner.frm" file from "C:\Program Files\Microsoft
Visual Studio\VB98\Template\Projects\" to "C:\Program Files\Microsoft Visual
Studio\VB98\Template\Forms"
3.1) This will be under "Program Files (x86)" for 64bit machines
4) In the EXE project add a new Form, select the "frmSimplyVBUnit3Runner"
4.1) You may need to add a referece to "SimplyVBUnit GUI 3.x" control
5) To run the tests you have to set the Startup Object to the SimplyVBUnit
form
6) Add test classes as shown in the example test projects
Testing from within an EXE will always be a bit difficult. Unit testing in VB6
can be a challenge at times. When I had to deal with pre-existing EXE monolith
projects I would add a SimplyVBUnit project and empty DLL project to the
project group and slowly migrate code from the EXE project to the DLL, writing
tests for the migrated code. It can be difficult because of the tight coupling
of the code within the EXE.
Hope this helps!
Kelly
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found this in the frmSimplyVBUnit3Runner form's code:
' Steps to create a TestCase:
'
' 1. Add a new class
' 2. Name it as desired
' 3. (Optionally) Add a Setup/Teardown method to be run before and after every test.
' 4. (Optionally) Add a FixtureSetup/FixtureTeardown method to be run at the
' before the first test and after the last test.
' 5. Add public Subs of the tests you want run.
'
' Public Sub MyTest()
' Assert.That a, Iz.EqualTo(b)
' End Sub
That's exactly what I did, but when running my project with the above form as
main object, nothing happens. Clicking on "Run", it says "Tests Completed" and
something about 0.0218 ms. Even if I modify one of the example tests to
provoke a failure, the same status appears.
Public Sub TestTwoExactStrings()
Assert.That "string2", Iz.EqualTo("string1")
End Sub
How does the test framework recognized my test subroutines?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I don't think it's a case of you not understanding. More along the lines
of how you had to get the unit testing integrated to begin with. Usually
people start with an empty SimplyVBUnit project that includes the form runner.
The form itself should have examples of using Assert and the Form_Load event
should have comments on how to add tests. There are example projects included
that shows several of the assertion types, but people may not be aware of
them.
In the next release I'll have better support and documentation for getting
started with unit testing, including when you have to start with an already
existing project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to set this up to test an EXE project. I followed the steps
prescribed by juengling up to step #4.1 but I didn't find any reference to
this tool.
How can I get this reference displayed in the list? (sorry but I'm not exactly the VB6 Wiz kind of person).
Where are the example test projects?
juengling , you said:"You add the test methods to a test class then in the
Form's Load event you add an instance of those test classes."
The form you are talking about, is it the form you are testing or the frmSimplyVBUnit3Runner? I would not want to put test code in the code I want to release.
Thanks you
Private Sub Form_Load
AddTest New MyClassWithTests
AddTest New MyOtherClassWithTests
' and so on
End Sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As I could not find any information in the help file nor in my VB6 menu or
icons, please forgive me to ask a very simple question :-)
How do i start creating unit tests after installing SimplyVBUnit?
When you use the binary installer version it will place a project template in
the VB6 project templates folder. So, when you start VB6 you can select the
SimplyVBUnit project to begin. Also, in the SimplyVBUnit installation folder
in program files there are example projects.
Kelly
Thanks! But what to do with already existing projects that "just" should get
some unit tests now? And then how to continue? Sorry, that may be dumb
questions, but I stumbled over this project during a session with Paul
Rohorzka this weekend and have never used this kind of unit tests before.
Is there any "How to start" document somwhere around? If not, perhaps I can
write one after I managed this all :-)
Thanks again,
Chris
To add tests to an existing project can be kind of difficult depending on how
the project is structured.
If the code you want to test is in an EXE project then the only way to test
that code is to include the tests within the same project. If the code is in a
DLL then you would add a new SimplyVBUnit project to the group or create a new
project group with the SimplyVBUnit project and the DLL project.
For testing an existing DLL project:
1) Add new SimplyVBUnit project to the same project group as the DLL project
2) Add reference to the DLL project from the SimplyVBUnit project
3) Add test classes as shown in the example test projects
For testing an EXE project requires a bit of effort:
1) Add reference to "SimplyVBUnit Framework v3.x"
2) Add reference to "SimplyVBUnit 3.0 Type Library"
3) Copy the "frmSimplyVBUnit3Runner.frm" file from "C:\Program Files\Microsoft
Visual Studio\VB98\Template\Projects\" to "C:\Program Files\Microsoft Visual
Studio\VB98\Template\Forms"
3.1) This will be under "Program Files (x86)" for 64bit machines
4) In the EXE project add a new Form, select the "frmSimplyVBUnit3Runner"
4.1) You may need to add a referece to "SimplyVBUnit GUI 3.x" control
5) To run the tests you have to set the Startup Object to the SimplyVBUnit
form
6) Add test classes as shown in the example test projects
Testing from within an EXE will always be a bit difficult. Unit testing in VB6
can be a challenge at times. When I had to deal with pre-existing EXE monolith
projects I would add a SimplyVBUnit project and empty DLL project to the
project group and slowly migrate code from the EXE project to the DLL, writing
tests for the migrated code. It can be difficult because of the tight coupling
of the code within the EXE.
Hope this helps!
Kelly
This is great, thanks very much! It may be a good idea to include this text in
http://simplyvbunit.sourceforge.net/
:-)
Sorry, one additional question ...
I found this in the frmSimplyVBUnit3Runner form's code:
That's exactly what I did, but when running my project with the above form as
main object, nothing happens. Clicking on "Run", it says "Tests Completed" and
something about 0.0218 ms. Even if I modify one of the example tests to
provoke a failure, the same status appears.
How does the test framework recognized my test subroutines?
You add the test methods to a test class then in the Form's Load event you add
an instance of those test classes.
Great, thanks very much!
This works now for me, besides the bug I checked in here at SF.net, thanks
again.
Was I just too dumb to understand (or search), or shall I create a "how to
start" description for public use?
Well I don't think it's a case of you not understanding. More along the lines
of how you had to get the unit testing integrated to begin with. Usually
people start with an empty SimplyVBUnit project that includes the form runner.
The form itself should have examples of using Assert and the Form_Load event
should have comments on how to add tests. There are example projects included
that shows several of the assertion types, but people may not be aware of
them.
In the next release I'll have better support and documentation for getting
started with unit testing, including when you have to start with an already
existing project.
Hi,
I'm trying to set this up to test an EXE project. I followed the steps
prescribed by juengling up to step #4.1 but I didn't find any reference to
this tool.
How can I get this reference displayed in the list? (sorry but I'm not exactly the VB6 Wiz kind of person).
Where are the example test projects?
juengling , you said:"You add the test methods to a test class then in the
Form's Load event you add an instance of those test classes."
Thanks you
Private Sub Form_Load
AddTest New MyClassWithTests
AddTest New MyOtherClassWithTests
' and so on
End Sub