What is your favourite Code Coverage tool(s) (Free/non-free) and how do you use them effectively?
There are several options available, such as:
CodeCover
Coverlipse
Emma / EclEmma
Atlassian Clover (commercial)
Cobertura
Crap4j
I have CodeCover telling me various chunks of my code are 58% covered etc. But how does this help me write ...
What are some good resources to learn best practices for Javascript? I'm mainly concerned about when something should be an object vs. when it should just be tracked in the DOM. Also I would like to better learn how to organize my code so it's easy to unit test.
...
I read the question on 'The best way to unit text objective-C' and followed the instructions , but no matter what I do, the Unit tests do not run. Actually the entire program does not run, I get the following message.
dyld: Library not loaded: @rpath/SenTestingKit.framework/Versions/A/SenTestingKit Referenced from /Users/garethlewis/wo...
Hi guys, this kind of follows on from another question of mine.
Basically, once I have the code to access the file (will review the answers there in a minute) what would be the best way to test it?
I am thinking create method which just spawns lots of BackgroundWorker's or something and tells them to all load/save the file, and test wi...
I have a Singleton/Factory object that I'd like to write a JUnit test for. The Factory method decides which implementing class to instantiate based upon a classname in a properties file on the classpath. If no properties file is found, or the properties file does not contain the classname key, then the class will instantiate a default im...
.NET Framework: 2.0
Preferred Language: C#
I am new to TDD (Test Driven Development).
First of all, is it even possible to unit test Windows Service?
Windows service class is derived from ServiceBase, which has overridable methods,
OnStart
OnStop
How can I trigger those methods to be called as if unit test is an actual service t...
Do you have any strategies for retrofitting unit tests onto a code base that currently has no unit tests ?
...
I've got some (C#) code that relies on today's date to correctly calculate things in the future. If I use today's date in the testing, I have to repeat the calculation in the test, which doesn't feel right. What's the best way to set the date to a known value within the test so that I can test that the result is a known value?
...
I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32_LogicalDisk object fo...
I would like to be able to add a "message" to a unit test, such that it actually appears within the TestResult.xml file generated by NUnit. For example, this is currently generated:
<results>
<test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" />
</results>
I would like to be able to...
I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best.
EDIT NUnit
...
I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success.
The error I get is the following :
[nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests.
Of course, the assembly contains tests that I can run from any runn...
I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework.
I would like to start using TDD in new projects but I'm really not sure where to begin.
What recommendations do you have for a PHP-based unit test...
Looking to get your take on an automated testing tool (voting should bring good ones to the top)
Ideal tool would:
Eliminate the need to present a set
of values to a method.
employ techniques such as Interactive
Exploratory Testing where the code
is examined to determine what values
are required to exercise all code
paths. i.e. the ...
With the code, forms and data inside the same database I am wondering what are the best practices to design a suite of tests for a Microsoft Access application (say for Access 2007).
One of the main issues with testing forms is that only a few controls have a hwnd handle and other controls only get one they have focus, which makes autom...
If unit-test names can become outdated over time and if you consider that the test itself is the most important thing, then is it important to choose wise test names?
ie
[Test]
public void ShouldValidateUserNameIsLessThan100Characters() {}
verse
[Test]
public void UserNameTestValidation1() {}
...
I've been trying to implement unit testing and currently have some code that does the following:
query external database, loading
into a feed table
query a view,
which is a delta of my feed and data
tables, updating data table to match
feed table
my unit testing strategy is this:
I have a testing database that I am free to manipula...
Assume an interface, for example:
public interface ISimple
{
void GetBytes(byte[]);
void GetNonZeroBytes(byte[]);
}
Then one or more implementation of that interface. What is the best way to test those implementations wile still adhering to DRY?
What I have been doing so far is creating a base test fixture will all the test ...
I keep reading about people who are "test infected", meaning that they don't just "get" TDD but also can't live without it. They've "had the makeover" as it were. The question is, how do I get like that?
...
A while ago I read the Mocks Aren't Stubs article by Martin Fowler and I must admit I'm a bit scared of external dependencies with regards to added complexity so I would like to ask:
What is the best method to use when unit testing?
Is it better to always use a mock framework to automatically mock the dependencies of the method being t...