unit-testing

How to properly unit test calling UI method on another thread?

Having coded an extension method (based on http://stackoverflow.com/questions/723532/gui-update-when-starting-event-handler-class-on-separate-thread/723584#723584): public static class ControlExtensions { public static TResult InvokeEx<TControl, TResult> (this TControl control, ...

Using MSTest in an open source project

A colleague and I are writing an application that we intend to go Open Source with and are trying to decide on a testing framework. Without integration of NUnit (one of us has resharper while the other does not) we are leaning toward MSTest. However, if the majority of people that work on opensource .net applications only have the expres...

Xcode 3.2 in Snow Leopard hangs running unit tests

So I have some unit tests that pass in Xcode 3.1 / Leopard. These use SenTestingKit in an iPhone app project and are built/run in a separate "Test" target. I just upgraded to Xcode 3.2 on Snow Leopard and the tests seem to run (I get logs in Console.app and see them passing), but Xcode beachballs and must be force quit'd after they are r...

How can you create a test project to debug (with stepping into) a web service?

I hope this I can explain what I am trying to achieve: I want to be able to create a unit test in the same solution as my web service, have it fire up the web service environment and be able to set breakpoints in the unit test code and in the web service code and have the debugger stop on both of them. Is this possible? ...

Unit testing and the scope of objects - how to test private/internal methods etc?

Let's say I have a project that is a class library. I have a class in that library and this class has some methods that are used inside the class only. Like this: public class MyClass { public void MyPublicMethod { int k // do something ... int z = MyInternalMethod(k); // do something else ... } internal int ...

"test case" - what "case" actually stands for?

The term test case used a lot, but what does it actually mean? Test case as Fixture: http://en.wikipedia.org/wiki/Test_case A test case in software engineering is a set of conditions or variables under which a tester will determine whether an application or software system is working correctly or not. http://www.junit.org/junit/javad...

How to start unit testing or TDD?

I read a lot of posts the convinced me I should start writing unit test, I also started to use dependency injection (Unity) for the mater of easier mocking, but I'm still not quite sure on what stage I should start writing the unit tests and mocks, and how or where to start. Would the preferred way be writing the unit tests before the m...

How to test WPF components in VS08 unit testing framework?

I have created some tests in my WPF application. Right now I am working on testing single components, for example images and text blocks. If I run a single test in my unit tests, they all pass without a hitch. The problem occurs when I try run all the tests, I get the following errors in the tests that create and modify WPF components: ...

Rhino Mocks: How to verify that a constructor was called

Is it possible in Rhino.Mocks to verify whether a specified constructor was called? Consider the following code: public interface IFoo { void Bar(); } public class FooFactory { public IFoo CreateInstance(int x, int y) { return new Foo(x, y); } } public class Foo : IFoo { public Foo(int x, int y) { // ... blah ...

Testing a web service wrapper

I have an assembly which wraps the functionality of an external live web service. How do I go about testing this web service effectively. Should I create a stub of the web service or should I write tests that send and receive live data to the web service? The problem I have with the second approach is that if I send and expect real ...

Unit-testing iPhone rotation

Hello, world! My iPhone application has several views and some viewControllers for that views. I need to test how viewControllers react to device rotations (switch between Portrait and Landscape device orientations). I found some info about OCMock and google-toolbox-for-mac frameworks but not found any answers on this topic. Some vie...

How do I test helper methods using Shoulda and set the params and request values?

I'm using rails 2.2.2 and wondering how can I set the params values to test my helper methods. I found some examples to let you run tests with helper methods but it doesn't work for me when I use the request or params value directly in the method. require 'test_helper' class ProductHelperTest < Test::Unit::TestCase include ProductHe...

How to unit test django views? Or maybe and MVT question.

I've been using django for a couple months now and I'm starting to get comfortable with it. At this point in my development I want to begin integrating unit testing and I've discovered unit testing a view to be tricky because of the way that django implements views with functions. For example, each function is a view/page in django if t...

Is Mocking able to replace functionality wrapped inside a method?

I'm trying to define a way to simulate an case on accessing into a database without accessing... That's probably sounds quite crazy, but it's not. Here is an example about a method i would like to test: public IDevice GetDeviceFromRepository(string name) { IDevice device = null; IDbConnection connection = new Sq...

Should I start with Unit testing when teaching a new developer?

I'm currently working on a project that is using technologies like Silverlight, WCF, EnterpriseLibrary, Unity, LinqToSql, NUnit, RhinoMocks in .Net 3.5 I'm training up a new developer who has some experience with VB script and SQL, but no exposure to .Net Almost 100% of the codebase has unit test coverage, but it just seems that gettin...

Unit Testing - Is it bad form to have unit test calling other unit tests

I have a unit test called TestMakeAValidCall(). It tests my phone app making a valid call. I am about to write another test called TestShowCallMessage() that needs to have a valid call made for the test. Is it bad form to just call TestMakeAValidCall() in that test? For reference this is my TestMakeAValidCall() test. [TestMethod...

Is there a jUnit for Perl?

I've created some business classes using OO Perl and I want to make sure I don't break them when I change the code. Sounds like unit testing is the way to go. Is there anything like jUnit for Perl? Feel free to elaborate on how you've implemented unit testing in Perl projects. ...

Equivalent of assert.warning in mstest ?

is there a MsTest Equivalent of Assert.Warning in MbUnit ? ...

Simpletest TestFixture

Hi, We are using Simpletest to do some integration testing on my website. Question: How can we use the TestFixtures to test my controller code? Basically we want to control the initial state of the Model by using the TestFixtures and populating the $fields and $records, and then use WebTest functionality to test on the supplied record...

ASP.NET MVC - Unit testing overkill? (TDD)

So I'm starting to catch the TDD bug but I'm wondering if I'm really doing it right... I seem to be writing A LOT of tests. The more tests the better, sure, but I've got a feeling that I'm over doing it. And to be honest, I don't know how long I can keep up writing these simple repetitive tests. For instance, these are the LogOn action...