Am I a bad person if I use use Test::More qw(no_plan)?
The Test::More POD says
Before anything else, you need a testing plan. This basically declares how many tests your script is going to run to protect against premature failure...
use Test::More tests => 23;
There are rare cases when you will not know beforehand h...
Let's say I have the following function I want to test:
public void CancelOrder(Order order)
{
order.Status = "Cancelled";
_emailService.SendEmail(order.User.Email, "Your order has been cancelled!");
}
Now, the Order class is a SubSonic generated class and the User property on it is lazy-loaded, meaning that when I call order...
Background:
My team is dedicated to ensuring that straight from checkout, our code compiles and unit tests run successfully. To facilitate this and test some of our NHibernate mappings, we've added a SQLite DB to our repository which is a mirror of our production SQL Server 2005 database. We're using the latest versions of: MbUnit3 (p...
In .net, unlike in Java, methods are not virtual by default. In order to use most mock object frameworks, you either have to mark the methods that you want to use on your mock as virtual on the `real' object, or you have to have an interface that you can mock that the class under test will accept in lieu of the implementation.
It seems...
When using Rhino Mocks, when is it appropriate to use "VerifyAll" and when should I do "Asserts"?
...
I am writing views, not so keen to write templates right away.
But I need to test my program by submitting post requests.
How do i simulate HTTP Post from within a django view
I am aware that urllib2 and httplib modules of python allow a lot of options, but I am looking for something that elegantly integrates into the django views.
...
New to unit testing and have an app that is spread out over several dlls. What are some suggestions for unit testing the app? If I put the unit tests in their own project, i can only test the published interface for each dll. Is that what most people do? Or should I put the unit tests in with the code in the dlls and test there? Wha...
Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up the data in the datab...
Hello C people.
I'm looking for a static analysis tool with the maturity of splint that also produces test coverage analysis of the code. For instance, all non-static functions in libfoo.c should be present in libfoo.h, by that token all functions in libfoo.h should have unit tests.
Of course, such behavior would need some kind of gran...
I'm looking for real world examples of some bad side effects of code coverage.
I noticed this happening at work recently because of a policy to achieve 100% code coverage. Code quality has been improving for sure but conversely the testers seem to be writing more lax test plans because 'well the code is fully unit tested'. Some logical ...
Hello,
it is me again...too much question, I know, but in this I'm kind of a newbie...
Well, I have a problem creating test for a project that is built using Microsoft's Web Client Software Factory: I get a error that says:
Unable to set TestContext property for the class MyClassName. Error: System.ArgumentException: Object of typ...
I have a custom collection type of data. This data is sorted by three properties in their order, e.g. take the following example:
class Data
{
public int PropertyA() { get; set; }
public int PropertyB() { get; set; }
public int PropertyC() { get; set; }
}
The collection must maintain the order of A, B, C, e.g.:
[A, B, C]
[1, 2,...
What are some of the tricks or tools or policies (besides having a unit testing standard) that you guys are using to write better unit tests? By better I mean 'covers as much of your code in as few tests as possible'. I'm talking about stuff that you have used and saw your unit tests improve by leaps and bounds.
As an example I was tryi...
I recently received as a new task to maintain and improve existing code written in C++ with MS Visual Studio. The code builds into an exe file (not a dll). I would like to add unit tests for the code and the problem I encountered is how to organize my testing projects. Basically I want to have 2 projects, one would be the original projec...
When I run "rake", it's loading up one of the models among all of the classes I have in my app/models directory. The thing is, it's not one I have a test for, it's just a model I have in there that is actually used with script/runner to run in the background and perform tasks for my main Rails application. At the end of the file I've got...
I'm a little confused as to the purpose of the ExpectConstructor() method on the Mock class in TypeMock 3.5.
I would have thought that calling ExpectConstructor would cause the MockManager to fail upon Verify() if the constructor is not called, i.e. if an instance of the mocked type is not instantiated.
However, calling ExpectConstruc...
For writing unit tests, I know it's very popular to write test methods that look like
public void Can_User_Authenticate_With_Bad_Password()
{
...
}
While this makes it easy to see what the test is testing for, I think it looks ugly and it doesn't display well in auto-generated documentation (like sandcastle or javadoc).
I'm interest...
Hi – I wanted to automatically sweep JUnit tests into suites as part of my continuous builds, so I derived a runner from JUnit's Suite which finds all test classes in a package. The runner works just fine, but the results display is less than expected.
I have one class in my testing support package with a @RunWith annotation for my runn...
I know that TDD style is writing the test first, see it fails then go and make it green, which is good stuff. Sometimes it really works for me.
However especially when I was experimenting with some stuff (i.e. not sure about the design, not sure if it's going to work) or frantically writing code, I don't want to write unit tests, it bre...
Which do you prefer?
What are the advantages and disadvantages of each for Unit Testing?
EDIT: I will admit that Team System offers a lot more than just Unit Testing, such as performance and load testing of applications and databases. This question was centering around writing unit tests and which do you prefer.
...