unit-testing

What should be the strategy of unit testing when using IoC ?

After all what I have read about Dependency Injection and IoC I have decided to try to use Windsor Container within our application (it's a 50K LOC multi-layer web app, so I hope it's not an overkill there). I have used a simple static class for wrapping the container and I initialize it when starting the app, which works quite fine for ...

Error using JsUnit with Hudson

I've just started using the JsUnit plugin with Hudson. The JsUnit tests are passing, but when the JsUnit plugin runs against the test output it's creating this error: [xUnit] [ERROR] - Couldn't split JUnit testsuites for the file 'tests/jsunit/logs/JSTEST-1266764410175-0.xml' into JUnit files with one testsuite. I'm not sure what I ne...

Accessing AlertDialog in AndroidTestCase

I'm using ActivityInstrumentationTestCase2 to do automated black-box testing on my GUI. Is there a way to click on a dialog, or get Views belonging to the Dialog in unit tests? The only way I could come up with is to keep a reference to the dialog and have my Activity implement a getter method to let testcases access the dialog. Is ther...

Getting DUnit Test Coverage stats using FinalBuilder and AQTime

We have a large Delphi project (1.5 million lines of code), and we're moving to using agile processes. We already have a continous integration environment (FinalBuilder) which I've updated to include unit tests (dUnit) and code metrics (CodeHealer) in the e-mails to everyone in our development team. Our unit test coverage isn't great...

TDD on client-server application

Currently I'm creating a server application to receive protocol-specific messages. I need to create tests to ensure that I've implemented the protocol correctly. Is this some kind of integration testing? If positive, can I make an integration testing with unit testing tools? And finally, what is the best way to create these kind of tests...

Junit 4 test suite and individual test classes

I have a JUnit 4 test suite with BeforeClass and AfterClass methods that make a setup/teardown for the following test classes. What I need is to run the test classes also by them selves, but for that I need a setup/teardown scenario (BeforeClass and AfterClass or something like that) for each test class. The thing is that when I run the...

Does derby support replace into of mysql?

Does derby support REPLACE INTO of mysql? ...

Visual Studio Unit Test failure to start

Hi, I am having an issue when starting the tests under debug mode in Visual Studio 2008 Team Test where it gives the following error: "Failed to queue test run '{user@machinename}': Object reference not set to an instance of an object." I googled for the error but no joy. Don't even understand what it means as it is too brief. Has any...

Check For Updated Instance in Mock

I have a method that calls a service to retrieve an instance of an object, updates the instance then saves the instance back to the service (the code for this is below). What I want to know is if there is a nice way in Moq to check the following:- That the instance that is being saved back to the service is a modified version of the o...

Do we only test the Contoller classes in an ASP.Net MVC application?

I guess the title says it all. I want to do this web application I am creating in the best possible way. All the unit testing examples I have come across are for contollers only. I understand the views would be quite hard to test and perhaps the model layer would need something like DBUNit. What are your thoughts? ...

Rollback of nested transactions while unit testing stored procedures

I am trying to write some integration tests for some SQL server stored procedures and functions. I'd like to have a database that has a known set of test data in it, and then wrap each test in a transaction, rolling it back when complete so that tests are effectively independent. The stored procedures/functions do anything from fairly ...

Why does the "Assert" class have so many seemingly redundant methods? When should each be used?

So I see that Assert has dozens of methods that seem to do essentially the same thing. Assert.IsFalse( a == b ); Assert.IsTrue( a != b ); Assert.AreNotEqual( a, b ); Why? Is it just to be more explicit? When should the various methods be used? Is there an offical best practices document? ...

Testing Spring @MVC annotations

I ran into a problem the other day where a @Valid annotation was accidentally removed from a controller class. Unfortunately, it didn't break any of our tests. None of our unit tests actually exercise the Spring AnnotationMethodHandlerAdapter pathway. We just test our controller classes directly. How can I write a unit or integration...

unit testing asp mvc view

How can i unit test the view of an ASP MVC application? I have tried the mvc contrib test helper... _controller.Index().AssertViewRendered(); but this doesn't actually test the view. for example i can happily insert some bogus code in the view, and get the dreaded yellow screen of death, without my unit test ever knowing about it. ...

what's the best Web testing tool have you found for C#?

I've been investigating a few of them. What I have found so far that seems usable. Windmill Selenium Watin Windmill looks like it has the basics (still not sure if I can write C# unit tests with it) Watin seems awesome with Unit tests.. of the 3, it looks like Selenium is trying to be the most fully featured af the 3 (most recent v...

Nondeterminism in Unit Testing

It seems that in many unit tests, the values that parameterize the test are either baked in to the test themselves, or declared in a predetermined way. For example, here is a test taken from nUnit's unit tests (EqualsFixture.cs): [Test] public void Int() { int val = 1; int expected = val; int actual = val; Assert.IsTr...

CGFloat causes iPhone Unit Testing Bundle to fail build

I'm having problems getting an iPhone Unit Testing Bundle to compile when the code it references uses CGFloats. If I recall correctly, CGFloat is just a pre-processor macro so I'm guessing it's not getting replaced properly, but as I am relatively new to this iPhone caper I have no idea where to start looking to fix it. I've already comp...

Is it important to deal with query caching in ActiveRecord unit tests?

In the Hibernate world, you can often have unit tests that appear to pass but there are actually bugs that don't show up because you're dealing with cached data. For example, you may save a parent with its children thinking it's cascading the save. If you re-query for the parent after the save and test the size of the child collection,...

How to test binders/property editors used on spring 2.5 controllers

I have an annotated controller with a method that expects a model and a binding result @RequestMapping(method = RequestMethod.POST) public ModelAndView submit(@ModelAttribute(“user”) User user, BindingResult bindingResult) { //do something } How do I test the binding result? If I call the method with a user and a binding result...

In Python, what's a good pattern for disabling certain code during unit tests?

In general I want to disable as little code as possible, and I want it to be explicit: I don't want the code being tested to decide whether it's a test or not, I want the test to tell that code "hey, BTW, I'm running a unit test, can you please not make your call to solr, instead can you please stick what you would send to solr in this s...