Unit Testing in VB 6 with SimplyVBUnit - unit-testing

I've recently decided to start using some light unit testing to see if it adds any value to our project, but I'm having trouble finding documentation for SimplyVBUnit. Any suggestions?

There's some discussion of VB6 unit testing in this question, with Gutzofter's mini tutorial on SimplyVBUnit.

If you downloaded the binary installer for SimplyVBUnit it comes with a couple of example projects in the installation folder. Both the source code zip file and binary installer include a Help.chm showing many of the classes and how to apply them in your tests.

Have you considered collecting test coverage? This determines what part of your code has run, often as exercised by your unit tests. To do this, you need a test coverage data collection tool, as well as your tests.
EDIT: The only VB6 test coverage tool I know is http://www.aivosto.com/vbwatch.html
Aivisto seems to have a generally good reputation for thier VB tools.

Related

Are Unit Tests with Google Test exported with project?

I've been studying Unit Testing with Google Test in C++.
If the purpose of Unit Testing is to ensure certain segments or objects of the code are working the way they are supposed to, I would assume it's not necessary to compile and export the unit testing code with the final project, right? It's not like the user will be using it anyway. It just seems like it makes the project size unnecessarily larger.
My main question is: will all the Unit Testing code be compiled and exported with the final project or will I have to manually delete all the Unit Tests before exporting it?
Is there a best (or common) practice for Unit Testing and exporting projects?
If you're publishing a library, it's quite common to publish the unit tests. Imagine you're developing on Mac or Linux, for example, and someone wants to compile on Windows. Well, they should probably be able to run your tests to ensure they pass on a different environment. Or Android, or some microcontroller. Whatever.
Also, someone might decide to help you improve your project. They'll add a nifty-cool feature. It's nice if they can run your unit tests to make sure they don't break anything.
So yes, if you're publishing your project as source code, include the unit tests. If you're only publishing a compiled library, you can exclude them.
Any tests are used for maintaining source code.
When you do some changes in source code, the you should run test to verify that: new functionality is working properly and old functionality is didn't got broken.
If test tails this is signal for developer that something has to be fixed.
So if your application or library is shipped as exactable there is o point to ship tests. Why? When you have only executable you can't modify code, so no point to run tests.
If you are publishing a library as open source then you test should be published too.
If you are publishing your library only as executable, source code of test can be form of documentation. If test are written properly they will document how API can be used in every possible way and as since test are a code (formal language) this form of documentation can't be misinterpret.
Shipping tests as executable has no seance at all.
I recommend to watch Uncle Bob (Robert C. Martin) talks, in most of them he explains what are test for and why they are important.

What is NCover and how does it relate to NUnit?

I'm writing unit tests using NUnit.Framework for a project I have up live. I have read few things about Ncover and it looks like an alternative of NUnit. Could someone please explain what it really is and what it does or post a link where I could find my answer.
NCover is a code-coverage tool that allows you to assess how much of your source code is "covered" by unit tests. The idea is that while you're running your unit tests with nUnit, nCover will be operating in the background, keeping track of each line of code that's being executed. After the tests are finished, nCover will show a visual report showing exactly which parts of your source code are and are not covered by existing unit tests.
It's a tool to help you determine if you have any functionality that isn't assessed by unit tests. While it's not perfect, it does give a good visual representation if you're missing out on some potential tests.

How can I perform system or integration tests using visual studio 2012 without including them in run all tests?

I am working on a project in where I decided to use unit tests. This was new to me but after researching I feel pretty confident I am doing it correctly creating mock objects and testing that the correct methods are called. This is working great but now I would like to actually run some tests that use the actual database and external components. How should I go about testing the actual execution of code? I do not want these tests to run when I run all tests. Is there a way to accomplish this using built in testing in vs2012?
Not that I'm aware of.
What you could do is create a separate project for your integration tests and then in the test explorer, separate your tests by class. Or some other logical seperation.
the current implementation that exists seems to specifically have unit testing mainly in mind, but that should change with 2013 and a stronger push towards TDD and Agile development.
Have a look here :http://msdn.microsoft.com/en-us/library/ms243147(v=vs.80).aspx
Scroll down to "Attributes for Identifying and Sorting Tests". There might be something there that's useful that you can use.

Example of application covered with tests

is there sample/open_source application for download that is covered with tests(integration, unit, ...) and could be example how testing should be done? We want to learn our junior programmers how tests should be written(ok ok, and we(seniors) want to learn, too :))
Thanx
I would bet the JUnit framework is well covered with unit tests :-)
You can download the sources from here .
Have a look at public metrics of sonar. It scans a lot of open-source projects. Just pick the ones with the highest coverage ;)
Coverage list open-source projects

What are some of the best resources to learn MSBuild with?

I am looking for any and all suggestions of the best and effective resources that the StackOverflow community has used to better learn MSBuild with an emphasis on integrating unit tests and later static code analysis tools such as FxCop and StyleCop into the build process.
I have tried to find good clear documentation on adding unit tests into my build but I still am searching - even Google searches have come up empty or with just bits and pieces. Ideally I want to add unit tests, report results, and eventually add code coverage statistics, etc into the build results.
I know it has to be in MSDN somewhere but I seem unable to find anything which explains and teaches well. I am using Visual Studio Team System 2008.
Continuous Integration From Theory to Practice by Carel Lotz. It covers the entire scope of your problem, and then some. Well written, complete, and a full sample are all there.
Hands down best resource. Use it as a tutorial first, then use it as a guide, then use it as a reference.
MSDN and others are good for clarifying (or confusing) the details.
Edit: The guide by Carel Lotz uses MBUnit for unit tests (see his earlier document version for NUnit, though you can replace the MBUnit with NUnit pretty easily if you follow the NUnit help files).
Also, it is written to use Cruise Control.NET to run the MSBuild script in various configurations.
Personally, I run unit tests in a secondary MSBuild script, but have found that wrapping the NUnit calls in MSBuild gives more flexibility than running from CCNet directly.
Here's a book that might help: http://blogs.msdn.com/microsoft_press/archive/2009/01/31/sayed.aspx
I guess I need to ask if you are sure you want to use MSBuild directly? Might want to check out WIX as the MSI producing tool - there is an extensive manual and it is built on top of MSBuild.
As for the automating of your tests with reporting and integrating with NUnit, FxCop, NCover, FitNesse, etc - I think the best (free) tool out there is CruiseControl .Net. It works with all of these tools and more. Can do versioning, automated builds with automated testing, creates the reports for each...
Here is a sample of one of my builds...
http://img84.imageshack.us/img84/3664/cruisecontrolnetsamplezn0.jpg http://img84.imageshack.us/img84/3664/cruisecontrolnetsamplezn0.jpg