unit-testing

Debug/Run unittest-project in visual studio

I have some unit-tests within a Visual Studio project with the attributes: [TestMethod] [ExpectedException(typeof(..Exception))] When I run the tests from 'Test View' they pass because the exception is thrown. When I debug the project (F5 or start new instance) the tests are started and when the first exception is thrown the debugger ...

Visual Studio .NET unit test problem

When I run the Release build of my (VS 2008 .NET) unit tests, I get the following exception: System.IO.FileLoadException: Could not load file or assembly 'arcVegaORM, Version=1.0.3856.24327, Culture=neutral, PublicKeyToken=0dd85ae1d99ddbee' or one of its dependencies. The located assembly's manifest definition does not match the assemb...

What is the right java unit test library for http?

Hello all, I am developing a servlet application, I was using JWebUnit, to check all the basic responses, but now I have to start using other HTTP methods different to GET(POST,PUT and DELETE). So, I found HttpUnit, it looks that have support for what I need, POST and PUT methods are available there and I guess I can walk around the DE...

Dealing with PHPUnit path issues.

I am getting the following error when I try to run PHPUnit from within my current MVC framework application Fatal error: Cannot redeclare class PHPUnit_Util_FilterIterator in /usr/local/pear/PHPUnit/Util/FilterIterator.php on line 162 I've managed to trace that error to a combination of a few things. $paths = array(); $paths[] = '../...

JustMock vs. TypeMock vs. Other

With Telerik's JustMock product newly available, it has a lot of similarities to TypeMock, in the ability to mock concrete classes, not just abstract classes or interfaces. I was just curious your opinion on one or both of the products. What do you like or dislike? Seems like JustMock might be shy on some of the features (TypeMock has...

What specific issues are there to be aware of when attempting to use WatiN in .NET Framework 4.0 test projects?

My situation is this: I have an ASP.NET web application that I want to implement tests for. When I initially tried WatiN, I was able to get the Google search example working, and a small test for one of the pages of the web application. But once I added the WatiN assemblies to a shelveset so a co-worker could try out my tests, WatiN st...

Isolating units and writing tests in Android

My project has the run-of-the-mill HTTP calls to fetch XML files, parsing the XML files, and creating domain objects. Those objects are later used in the actions and services of the Android app. I'd like to isolate that code. I also want to write tests for it. What are some good ways of doing this? Creating an Android Library doesn't s...

Ensuring code coverage in unit testing?

We have noticed that even though we have a lot of doctests in our Python code, when we trace the testing using the methods described here: traceit we find that there are certain lines of code that are never executed. We currently sift through the traceit logs to identify blocks of code that are never run, and then try to come up with ...

Spring RestTemplate Behavior when handling responses with a status of NO_CONTENT

Okay, I have a class NamedSystems, that has as its only field a Set of NamedSystem. I have a method to find NamedSystems by certain criteria. That's not really important. When it gets results, everything works fine. However, when it can't find anything, and thus returns a null (or empty -- I've tried both ways) set, I get problems. Let...

How can I best monitor performance with unit tests?

I've been starting to write many more unit tests for my code (something I should have been doing for much longer,) as well as use code profilers such as EQATEC's to identify bottle necks. I'm wondering if there's a correct method for monitoring performance in unit tests? Obviously, a code profiler would be best for optimization, but wha...

Is the use of mocks a good programming practice or just a different way to do it?

Would you guys say that the use of mocks is better than not using mocks? Is mocking used only in unit testing or could it be used directly in the original project as the real object and switch it after? I've been reading here and there and the most attractive thing about mocking I found was the layer isolation. ...

rails testing helpers with instance variable?

hi, I want to test a helper where I use a instance variable inside. I'm using rails 2.3 with the default testing framework. Can please someone write my a simple test (I guess a Unit test) for this? thanks A simpler version of my code as example. # controller @bla = "some value" # view <%= foo %> # helper def foo @bla.reverse end ...

Using nMoq, how would one expect for a given Event?

Let's say I want to make a Unit-Test where I have this Tetris game and I want to start the game, do nothing, and wait for the game to be over (this is, to get a GameOver event): Tetris tetris = new Tetris(); tetris.GameOver += something; tetris.Start(); How should I make the test? This should probably be easy but I can't see how to do...

PHPUnit tutorial? Or more general - unit testing tutorial worth recommending?

I'm looking for a tutorial which explains why and how to write useful unit tests. Specifically I'm interested in PHPUnit, however any more general might be a good one to explain that. Please note that I'm not looking for technical information on how to use PHPunit - rather the tutorial on the way of thinking! ...

How do I make sure my website blocks automated tools like Selenium

I'd like to make sure that my website blocks automation tools like Selenium and QTP. Is there a way to do that ? What settings on a website is Selenium bound to fail with ? ...

How could I unit test this?

I am using the Mono and Lokad quality libraries to develop an API which does things like inspect the characteristics of methods to see if they throw exceptions, etc etc. One of my methods I have in this API looks like this: // Get all methods which have a NotImplementedException var throwingMethods = _codebase.Methods .Where(m => m...

CollectionAssert.AreEquivalent with Custom IEqualityComparer

I have two lists, I want to check whether the two lists are the same ( order not important), and whether it's the same depends on the IEqualityComparer instance I implement. The ideal case is that I can use CollectionAssert.AreEquivalent with Custom IEqualityComparer. However it seems that CollectionAssert.AreEquivalent doesn't take in ...

Refactoring phase of the TDD Traffic Light - how to get this right?

So I made the following test for a class Board that would to be born: [TestMethod] public void Set_The_Origin_As_Violet_And_The_Query_Confirms_It() { Board board = new Board(10, 10); Color expected = Color.Violet; board.SetColorAt(0, 0, expected); Color actual = board.GetColorAt(0, 0); Assert.AreEqual(expected, actu...

How to Test façade classes with no args constructors and no setters with TDD?

This question comes a bit as continuation of the following topic (you don't need to read it, though). It's just a game of Tetris I'm implementing with TDD. So here is the problem: I have a set of Acceptance tests. I have defined the following test in one of them: [TestMethod] public void I_Can_Query_Any_Piece_Of_The_Board_For_A_Color()...

Unit testing for stochastic processes?

Is there a sane way to unit test a stochastic process? For example say that you have coded a simulator for a specific system model. The simulator works randomly based on the seeds of the rngs so the state of the system cannot be predicted and if it can be every test should bring the system to a specific state before it attempts to test a...