unit-testing

Unit tests in Visual Studio 2010 will not run because "No agents are marked..."

With VS 2010 I generated some unit tests for some properties on a partial class. They fail to run with the following error message: "Failed to queue test run 'yvx7xcy@MDROAWKS0379 2010-06-23 18:21:08': Test run 'yvx7xcy@MDROAWKS0379 2010-06-23 18:21:08' could not be executed. No agents are marked online to execute test ru...

Unit tests in VS2010 (solution in release mode)

Hi there, I am trying to run my unit tests (Test->Debug->Tests in current solution) in VS 2010. The solution is built in Release mode. When I try to do that, VS is crashing. Do you have any ideas? Cheers ...

VS2008 Unit Test - Build Action Content not working

Hi, This is confusing me endlessly. I have an C# Unit Test project with some C# unit tests and some folders with content files (eg. sample data, captured xml messages) The Build Action on these content files is set to Content. I have done this in the past (VS2005?) and this has worked for me numerous times, the files used to be copi...

Zend_Test: Assert Controller Failed

Hello everybody, I use Zend_Test for unit testing in Zend Framework. I have configured the bootstrap and testing environment properly then I got this error output from test unit Failed asserting last controller used <"error"> was "index" This error happens when I call my DbTable class inside action method such as public function in...

Why "has_many :line_items, :dependent => destroy" in the cart.rb model file causing failed tests

Why has_many :line_items, :dependent => destroy in the cart.rb model file causing failed tests I have been working through the "Agile Web Development with Rails" book and am about half way through the depot application (I did skip around a bit). When I go to run the default test ("the truth") I get failed tests. Trace says "/Use...

Is it possible to make Nose only run tests which are sub-classes of TestCase or TestSuite (like unittest.main())

My test framework is currently based on a test-runner utility which itself is derived from the Eclipse pydev python test-runner. I'm switching to use Nose, which has many of the features of my custom test-runner but seems to be better quality code. My test suite includes a number of abstract test-classes which previously never ran. The ...

.net 4.0 Code Contracts. When to use? When are they a waste of time?

I have been studying .NET 4.0 Code Contracts and looking on stackoverflow as well at question regarding this. I still have never come across any sample code that uses code contracts so that gets me wondering.. is this really useful ? Or maybe its only useful one your code reaches a certain complexity? Anyone out there using Code Contra...

Robotium: searchText vs clickOnText

Hi all, I have a strange situation: On a screen, I have the following string to click on: "1 Year Basic License ($15.00)" But the following code give me some headache: assertTrue(solo.searchText("1 Year Basic License ($15.00)")); solo.clickOnText("1 Year Basic License ($15.00)"); The test fails on the clickOnText statements! saying (in...

Mock Objects vs Test Database

What's the advantage of using mock objects in comparison to a static test database that has known data and using transactions to make sure nothing changes when testing against the database. ...

Spring @Controller Unittest @RequestMapping

Having a basic Spring Contoller i'd like to Unittest the Request Mapping (not the Method itself), if the doCriticalStuff Method is indeed called package org.foo; @Controller public class HelloWorldController implements IHelloWorldController { @RequestMapping(value = "/b/c/", method = RequestMethod.GET) public void doCriticalStuff...

python/django unittest function override

Hi, I have a time-consuming method with non-predefined number of iterations inside it that I need to test: def testmethod(): objects = get_objects() for objects in objects: # Time-consuming iterations do_something(object) One iteration is sufficient to test for me. What is the best practice to test this method ...

How to test jquery ajax tabs with selenium?

Hello world! I'm testing a django app with selenium, and one of my pages uses the jquery ui tabs element. One of the tabs contains a simple table listing some users, and is loaded via ajax. When using the app, the tab works just fine, but when automating the test with selenium, the tab doesn't appear to load it's content! I'm writing th...

BDD and functional tests

I am starting to buy into BDD. Basically, as I understand it, you write scenario that describes well acceptance criteria for certain story. You start by simple tests, from the outside-in, using mocks in place of classes you do not implement as yet. As you progress, you should replace mocks with real classes. From Introduction to BDD: ...

How to setup a simple Unit Test with Moq?

I'm new to Moq and not quite sure why this won't run. Repository Interface using System.Collections.Generic; public interface IRepository { IEnumerable<string> list(); } Service Interface using System.Collections.Generic; public interface IService { IEnumerable<string> AllItems(); } Service Class using System.Collection...

NHibernate - different behaviour in application and unit test

Code public void SaveProduct(Product product) { using (var session = GetNewSession()) { using(var tran = session.BeginTransaction()) { session.SaveOrUpdate(product); tran.Commit(); } } } Product is an entity with parent/child relati...

Unit testing a time - based component?

So I'm writing a cache system (not too complicated, but it has very nice semantics) with a ttl (time to live) for items. Of course the ttl must be unit tested, but since one can't inject a new implementaton of "IDateTime" or "ITimeSpan" in C# (because there is no such thing), how would you go about that? Write a new component "IDateTim...

Android: test suite

Hi all, I have realize different tests extending the "ActivityInstrumentationTestCase2". Now, I want to structure my tests: group them and be able to run a subset. How to do this? Can I use the TestSuite class? Any idea? Regards, Alban. ...

How can I ensure good test-coverage of my big Python proejct

I have a very large python project with a very large test suite. Recently we have decided to quantify the quality of our test-coverage. I'm looking for a tool to automate the test coverage report generation. Ideally I'd like to have attractive, easy to read reports but I'd settle for less attractive reports if I could make it work quic...

Introduction to unit testing for C#

I'm looking for a good introduction/tutorial for unit testing C#. Most tutorials I've come across so far have either been too basic to be useful or too complex for someone new to unit testing. (Using Visual Studio 2008 Professional for Windows applications) ...

How do I perform automated testing of XSLT stylesheets?

I have some increasingly complex XSLT stylesheets and it would be helpful if I could run some tests on them as part of my CI build process, and even use TDD to develop them in the first place. I'm currently using Visual Studio to run fragments of XML through the stylesheets and I am manually checking the results. What would everyone rec...