unit-testing

Pro's and Con's of unit testing after the fact.

I have a largish complex app around 27k lines. Its essentially a rule drive multithreaded processing engine, without giving too much away Its been partially tested as it's been built, certain components. Question I have, is what is the pro's and con's of doing unit testing on after the fact, so to speak, after its been implemented. It ...

Multithreaded Unit Testing

Hi, Can anybody recommend any good books on unit testing for multitesting applications. Also can any body recommend appplications or utilities which can be used for multithreaded testing, similar to the java tool ConTest, (which i've not used but a fried recommended) Any help particularly related to C# unit testing for multithread...

Can rails test speed be increased?

Hi all, I'm a recent convert to TDD but as my codebase grows in size and complexity, I find myself waiting longer and longer periods for the framework to load every time I want to run a test. I am aware of rspec's spec_server but I'm using Test::Unit with shoulda. I tried Snailgun (http://github.com/candlerb/snailgun) but noticed very l...

Optimal Eclipse CDT (C++) experience in March of 2010

I am a student who will be using C++ next quarter. I really enjoyed using the Galileo release of Eclipse with Java and I would like to continue using Eclipse for for C++ development. I am now experimenting with C++ development on Eclipse. I am running Eclipse 3.5 SR2 with CDT 6.02. My operating system is Windows 7 and I have installed M...

How to Unit Test HtmlHelper with Moq?

Could somebody show me how you would go about creating a mock HTML Helper with Moq? This article has a link to an article claiming to describe this, but following the link only returns an ASP.NET Runtime Error [edit] I asked a more specific question related to the same subject here, but it hasn't gotten any responses. I figured it was ...

PHPUnit - multiple stubs of same class

I'm building unit tests for class Foo, and I'm fairly new to unit testing. A key component of my class is an instance of BarCollection which contains a number of Bar objects. One method in Foo iterates through the collection and calls a couple methods on each Bar object in the collection. I want to use stub objects to generate a serie...

Is it against best practice to throw Exception on most JUnit tests?

Almost all of my JUnit tests are written with the following signature: public void testSomething() throws Exception My reasoning is that I can focus on what I'm testing rather than exception handling which JUnit appears to give me for free. But am I missing anything by doing this? Is it against best practice? Would I gain anything ...

Simplifying Testing through design considerations while utilizing dependency injection

We are a few months into a green-field project to rework the Logic and Business layers of our product. By utilizing MEF (dependency injection) we have achieved high levels of code coverage and I believe that we have a pretty solid product. As we have been working through some of the more complex logic I have found it increasingly difficu...

ASP.NET MVC unit test controller with HttpContext

I am trying to write a unit test for my one controller to verify if a view was returned properly, but this controller has a basecontroller that accesses the HttpContext.Current.Session. Everytime I create a new instance of my controller is calls the basecontroller constructor and the test fails with a null pointer exception on the HttpC...

Tips Unit testing modal class in passive view pattern

Hello All, I am new to unit testing. I have done unit testing on controller classes but have never tested modal class. I am using passive view pattern for my application. I am using Cpp Unit test framework. Any tips would be highly appreciated. Thanks Rahul ...

TeamCity stopped working once I added NUnit to the mix

I'm struggling a lot trying to get our build server going. I am currently running tests in a Windows XP virtual machine, and have installed TeamCity v5.0.3, build 10821. I am using NUnit v2.5.3. I finished the initial setup with TeamCity without any issues at all, provided that I use the sln2008 build runner that makes the entire proc...

Could model unit tests be truly independent and how [ASP.NET MVC]

I am new to the whole unit testing stuff, so please excuse my lack of experience. I've read a lot of materials saying that no test should depend on others to do, i.e unit tests be completely independent form each other. Can you really do that in reality? I am having the following example: I have a few entity classes depending on each oth...

Zend_Test_PHPUnit_ControllerTestCase: Test view parameters and not rendered output

Hi, I'm using Zend_Test_PHPUnit_ControllerTestCase to test my controllers. This class provides various ways to test the rendered output, but I don't want to get my view scripts involved. I'd like to test my view's vars. Is there a way to access to the controllers view object? Here is an example, what I'm trying to do: <?php class Contr...

Unit testing Monorail's RenderText method

I'm doing some maintenance on an older web application written in Monorail v1.0.3. I want to unit test an action that uses RenderText(). How do I extract the content in my test? Reading from controller.Response.OutputStream doesn't work, since the response stream is either not setup properly in PrepareController(), or is closed in Ren...

Corrupted DataSet in .NET for failure testing

Does anybody know of a way to create a DataSet such that when I call GetXml() on the DataSet I will get an exception? I'm trying to write some failure testing for this scenario and am having a hard time. Is it possible? ...

Applying Test Driven Development to a tightly coupled architecture

Hi all, I've recently been studying TDD, attended a conference and have dabbled in few tests and already I'm 100% sold, I absolutely love it TDD. As a result I've raised this with my seniors and they are prepared to give it a chance, so they have tasked me with coming up with a way to implement TDD in the development of our enterprise...

How do I mock/fake/replace/stub a base class at unit-test time in C#?

UPDATE: I've changed the wording of the question. Previously it was a yes/no question about if a base class could be changed at runtime. I may be working on mission impossible here, but I seem to be getting close. I want to extend a ASP.NET control, and I want my code to be unit testable. Also, I'd like to be able to fake behaviors of...

MbUnit (gallio) and Visual Studio.Net Tests Not Completing or Debugging

Hi I'm using Gallio\MbUnit 3.1 with ReSharper and Visual Studio 2008. Everything is working well except this type of test: [Test] [Row("test@badEmail@_test.com")] [Row("test@badEmail@_test.")] public void IsValidEmail_Invalid_Emails_Should_Return_False(string invalidEmail) { Assert....

Is this a good or bad way to use constructor chaining? (... to allow for testing).

My motivation for chaining my class constructors here is so that I have a default constructor for mainstream use by my application and a second that allows me to inject a mock and a stub. It just seems a bit ugly 'new'-ing things in the ":this(...)" call and counter-intuitive calling a parametrized constructor from a default construct...

How to assert/unit-test servers JSON response?

My current project uses JSON as data interchange format. Both Front-end and Back-end team agree upon a JSON structure before start integrating a service. At times due to un-notified changes in JSON structure by back-end team; it breaks the front-end code. Is there any external library that we could use to compare a mock JSON (fixture) w...