We are developing a VB.Net Thick Client.
Our Business Objects get filled from Services which make calls through iBatis to the DB. These BOs obviously hold information about the object in variables. I am curious on how far to take unit testing? Do you go as far as to do create a new object, fill all of the properties and then verify that...
I need to mock a GrailsControllerClass interface. Instance should have a static variable defined. The problem is that MockFor and StubFor don’t give you an option for adding static members.
So, I write my abstract class that extends GrailsControllerClass
abstract class MyController implements GrailsControllerClass {
static myDefiniti...
All in the question really, but I'm looking for real world experience of using Nester beyond simple cash-machine sample programs.
Does it really help improving the quality of tests?
Do you end up with fewer bugs in production?
Do you get many false alarms (say both paths through a condition can end up giving the same result for more c...
OK, so the @Ignore annotation is good for marking that a test case shouldn't be run.
However, sometimes I want to ignore a test based on runtime information. An example might be if I have a concurrency test that needs to be run on a machine with a certain number of cores. If this test were run on a uniprocessor machine, I don't think ...
In my application I have a custom model binder that I set to the DefaultBinder in the global.asax:
ModelBinders.Binders.DefaultBinder = new XLDataAnnotationsModelBinder();
When writing unit tests for controllers I need to make sure the controller uses the custom model binder but I don't know how to do this.
My test looks like this:
...
I'm trying to unit test some iphone code that instantiates fonts. I've narrowed it down to the following crashing unit test:
#import "test.h"
#import <UIKit/UIKit.h>
@implementation test
- (void)testFonts {
[UIFont systemFontOfSize:12];
}
@end
This crashes with the error:
Test Case '-[test testFonts]' started.
/Developer/Tools...
I have a class called "Session" which exposes several public methods. I'd like to Unit Test these, however in production I need to control instantiation of "Session" objects, so delegate construction to to a SessionManager class and have made the Session's constructor internal.
I'd ideally like to test the Session class in isolation fro...
I have a test method that tests the ToString() method of a class against known good outputs.
/// <summary>
///A test for ToString
///</summary>
[TestMethod()]
public void ToStringTest()
{
string input = System.IO.File.ReadAllText(@"c:\temp\input2005.txt");
MyClass target = new MyClass(input);
...
Can anybody recommend a Javascript unit testing framework. I've found JsUnit (http://www.jsunit.net/) and will start evaluating it. I just thought it would be good to get some input from the community.
...
I'm at a point where I'd like to start writing unit tests for my MVC application. I've already figured out how to unit test the controller and I can unit test my underlying business libraries without any problem. I'm coming unstuck on a couple of items though:
How do I unit test my views? That is, after a controller has returned the...
I am trying to apply some WatiN UI tests to my new ASP .Net MVC application, running the WatiN tests through MbUnit, but am having some difficulties.
If I follow the instructions (exactly) on this page, then the google homepage loads, up the text is inserted, the search is done and the test passes. (no problem here).
However, when I si...
Since a short time my rails applications yields the following runtime error in the test suite:
RuntimeError: Declare either attr_protected or attr_accessible for User, but not both.
This was probably introduced by an update to restful_authentication. But scanning the code for "attr_protected" only shows me it is never called. So why t...
Testing the Equals method is pretty much straight forward (as far as I know). But how on earth do you test the GetHashCode method?
...
I understand that the database log feature is supported in 3.3 version and not released in 3.4 is there any way I can use the database feature in 3.4
...
I have a C++ legacy codebase with 10-15 applications, all sharing several components.
While setting up unittests for both shared components and for applications themselves, I was wondering if there are accepted/common file structures for this.
Because my unit tests have several base classes in order to simplify project/customer speci...
Say you have this shell of a class:
public class Number
{
private int value;
public Number()
: this(0) {}
public Number(int initialValue)
: this(initialValue, 0, 100) {}
public Number(int initialValue, int minimumValue, int maximumValue)
{
if (minimumValue > maximumValue)
throw ...
The Dojo Toolkit used to come with a testing facility called "Doh". It was in the /utils directory.
Now when you download dojo-release-1.3.2 the /utils directory is nowhere to be found.
Is Doh dead and gone?
...
I am trying to test a Controller
that has a Command object with data binding.
The Command Object has a Service injected into it.
But When I try test the command object the injected service method
is never found as it is never "injected"
Is there a way to mock a service inside a command object?
Test method
void testLoginPasswordInv...
I am trying to unit test a controller action that uses UpdateModel but I am not correctly mocking the HttpContext. I keep getting the following exception:
System.InvalidOperationException: Previous method 'HttpRequestBase.get_Form();' requires a return value or an exception to throw.
To mock the HttpContext I am using some thing ...
I have a system that has many components interacting with each other. It occured to me to run tests as part of the installation process to make sure it works correctly in the client machine.
Does this sound like a reasonable idea? Have you seen it done? What framework would you use to run the tests?
...