unit-testing

Silverlight MVVM Unit-Testing Explanation

Can anyone explain why, when I step through my unit tests with the debugger, that I get null references whenlooking at objects or properties. For example: 1 [TestMethod] 2 [Description("Test to confirm that upon initial class creation, the login view is loaded as the default content for the TaskRegion.")] 3 pu...

Is Unit Testing your SQL taking TDD Too far?

There is an article out on www.sqlservercentral.com about unit testing your SQL. The TDD Guy in me said good, we can test the database stuff. The System Architect in me said, what logic are we testing? There shouldn't be any logic in the database, the only thing you should be doing in the data base is selecting, updating, or inserting....

Visual Studio Test Project - Does not copy folder on deployment

Here is the problem: 1. Create a TestProject in your Visual Studio solution. 2. Open the .testrunconfig file and under the 'deployment' menu item, select the 'Enable Deployment' checkbox. 3. Now click on 'Add Directory...' button and add a folder which has some files in it. 4. Run the test project (use a dummy test). Ok, now go check th...

NMock2, Rhino mock. Which one to choose?

I'm using Visual Studio unit testing framework and have the need to using a mocking framework. And I'm not sure which of the mocking frameworks NMock2, Rhino mock that I should choose. Would you please share your experience? Thanks! ...

externalizing junit stub objects.

Hi!    In my project we created stub files for testing junits in java(factories) itself. However, we have to externalize these stubs. After seeing a number of serializers/deserializers, we settled on using XStream to serialize and deserialize these stub objects. XStream works like a charm. Its pretty good at what it claims to be. Previ...

How to i unit test this method?

I need to unit test this method. I'm using moq as my mocking framework, if that helps. [AcceptVerbs(HttpVerbs.Get)] public RedirectToRouteResult LogOff() { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Post"); } cheers :) EDIT: It was mainly the FormsAuthentication i was wondering. Should I even be testing ...

ASP.NET MVC Utilize Test Controller or Test Model

In a new MVC application, I am building out all of the models, controllers, views etc. without my backend DB setup yet. I have an idea of what the backed will look like, but for now I'm focusing on the application. I know that I can mock up a dummy model within the controller like: public ActionResult Pictures() { MyMVCApp.Models....

Multiple assertions when unit testing constructor?

I'm trying to unit test a class with 2 constructors. Each constructor has multiple parameters that set public properties. My question is, should I have only 2 unit tests with multiple asserts to check that each property was set OR a test for each parameter for each constructor? Public Person(string name, string phone, string birthday)...

Unit testing against large databases

I would like to ask about your suggestions concerning unit testing against large databases. I want to write unit tests for an application which is mostly implemented in T-SQL so mocking the database is not an option. The database is quite large (approx. 10GB) so restoring the database after a test run is also practically impossible. T...

Which free unit testing framework for C#?

I'm rather beginner in C# world (and .Net as well), so I decided to get some advices from more experienced developers. Which free unit testing framework for C# would you advise? I came across NUnit, which seemed to look interestingly, but in it's documentation I found out, that there were versions for .Net 1.1 and .Net 2.0. I need to use...

What are the best tools for unit testing iphone applications?

Wondering which tool is considered the best/standard and what the pros/cons are for the various unit testing tools that are available. The tools I'm aware of so far are: Google Toolbox for Mac OCUnit which seems to be the winner for objective-c, but some folks have had trouble with on the iphone rbiphonetest which Dr Nic comments on he...

Continous Integration: Unmanaged C++ on Visual Studio 2008

I've spent 4 years developing C++ using Visual Studio 2008 for a commercial company; it's now time for me to upgrade my development process. Here's the problem: I dont have a 1 button build automation. I also dont have a CI server that automatically builds when a commit happens, and emails me whether a build is broken or not. Worse we d...

Decluttering a libaries API

Hi all, I am currently writing a wrapper library in C# that wraps a COM object that has a very small and painful to use API and am having a bit of problem with clutter. This is the first project that I have used TDD and mocking on, so sorry if this isn't really a big problem. I gave a copy of my library to one of my work mates and t...

Tools for keeping unit tests organised and named correctly

I have been trying to clean up the naming and organisation conventions of our projects' unit and integration tests. We are using C#, NUnit, Visual Studio and Resharper. It seems that if there is one best practice for unit test organisation it is that the layout and naming of the test classes and namespaces should mirror those of the cod...

Testing exceptions

do you thing this is a good way for testing exception? any suggestions ? Exception exception = null; try { //I m sure that an exeption will happen here } catch (Exception ex) { exception = ex; } Assert.IsNotNull(exception); Im using MS Test ...

Testing a Concrete class with Jmock

I have class with a forwarding method foo: void foo( Concrete c, String s ) { c.bar( s ); } I wish to test that foo in fact forwards. Unfortunately for me, Concrete is a class in a third-party library, and is a Concrete type, not an interface. Thus I must use ClassImposterizer in Jmock to mock Concrete, so in my testcase I do this: @...

Unit testing Scala

Hi! I just recently started learning the Scala language and would like to do it in TDD-way. Could you share your experiences on the unit testing frameworks there are for Scala and the pros/cons of them. I'm using IntelliJ IDEA for Scala development, so it would be nice to be able to run the tests with IDE-support. ...

Unit Testing HTTP-actions

I'm writing Yet Another PHP Framework, and now that I've coded a good deal of stuff, I'm starting to think about unit tests (yes, I know, bad form). Some actions make the framework to modify HTTP behavior, such as create cookies, redirect the browser. Another major feature is that the the visited URI can affect the way the framework sho...

How do you unit-test a TCP Server? Is it even worth it?

I'm developing a small TCP server, which will process some TCP packets and behave differently based on the request. How can I write unit test for this? If it's really hard to write, is it even worth the effort? ...

Tagging unit-tests

I'm working on a PHP project with solid unit-tests coverage. I've noticed, that last time, I'm making very tricky manipulations with unit-tests Command-Line Test Runner' --filter command. Here is this command's explanation from official documentation: --filter Only runs tests whose name matches the given pattern. The ...