What is NCover and how does it relate to NUnit? - unit-testing

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.

Related

Do we have any tool to identify which codes has been covered by an automation test class(e.g: fitnesse test)?

Currently, I am using jacoco report tool to know how much coverage for my system. But this system is quite old and has many existing Fitnesse tests. I am newbie on this system and want to learn it by reading its Fitnesse test. My problem is I dont know what Fitnesse test is for what specific class.Beside that When I see a class is covered and I dont know which Fitnesse test covered this class. My system has more than 500 Fitnesse Tests.
JaCoCo does not provide this out of the box.
There are some third-party JaCoCo integrations such as SonarQube that allow to obtain information about relation between JUnit or TestNG test to code. Don't know much about Fitnesse, so can't tell whether this will work with it or not.
However referring to the same link: general principle to obtain such information using JaCoCo (and that's how SonarQube does) - is to measure coverage separately for each test and save data into place dedicated to this test.
Also IDEs are able to show coverage (there are EclEmma plugin for Eclipse based on JaCoCo and other tools for other IDEs), so if you're able to run Fitneese test in IDE, then this principle can be applied even manually by running one test after another within IDE.
Also have a look at another code coverage tool for Java that is commercial and named Clover.

TFS and Unit Testing

Firstly just let me explain my situation.
I am working on a legacy code. I try to cover a part of code with unit tests then refactor it. When every thing goes well, I will explain it for the manager and after approval, We will check in change sets to main solution.I use MSfakes to write unit tests. Nowadays I am trying to manage unit tests, for example I've wrote test cases in TFS for every unit test.
What is your idea about managing unit tests in TFS? If you are writing unit tests and refactor a legacy code, What is the best usage of TFS for you? Writing use cases and connect them to the unit tests? any more?
Please let me know if you had any experience that TFS helped you in managing your unit tests.
Thanks

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.

How to write a NUnit test for an NUnit add-in?

I'm working on a variation of this stack overflow answer that provides reliable cleanup of tests. How do you write unit tests for NUnit addins?
Examining how NUnit self tests, I have determined:
You can write tests, that pass, that verify correct behavior of NUnit for failing tests.
You write unit tests against test fixtures in a separate assembly (otherwise the fixtures under test will execute with your unit tests)
Use NUnit.TestUtilities.TestBuilder to create fixtures and call TestSuite.Run method.
What I don't see are any tests of the add-in process. I've got errors occurring sometime between install and execution. How would I unit test implementations the following?
IAddin.Install
ITestDecorator.Decorate
Here's an article by someone who hacked a way to do it: manipulating some of the singletons in the NUnit add-in implementation to swap his add-in in and out.
http://www.bryancook.net/2009/09/testing-nunit-addins-from-within-nunit.html
Sometimes, the easiest thing to do is run integration tests. It been a while since I played with the NUnit add-in API, so I can't really say regarding any existing unit tests for the extensibility mechanism. If you have looked through NUnit source code and haven't found any, then I guess that is not something that was tested or even written using TDD.
Like I said, sometimes it's easier to just run integration tests. Have your addon, for example, print something to the output stream, and have your test verify that the exact message was written. This way you could test that both the installation and initialization of your plugin succeeded.
Hope that helps...

Unit Testing in VB 6 with SimplyVBUnit

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.