unit-testing

How do I test features that are not in the public interface?

I'm designing a library for myself that allows the chaining of streams of data. Let me paint the scenario: I create a SerialDatastream which is the bottom layer and reads from and writes to a COM port. I pass a pointer to this to the constructor of a ProtocolDatastream, which interprets the bytes when read from the serial datastream (...

How to write dynamically self balancing system for testability?

I am about to embark on writing a system that needs to re-balance it's load distribution amongst the remaining nodes once one of more of the nodes involved fail. Anyone have any good references on what to avoid and what works? In particular I'm curious how one should start in order to build such a system to to be able to unit-test it. ...

How do I skip a section of code when unittesting in Django?

In my Django application, I have a section of code that uploads a file to Amazon S3, and I would like to skip this section during unittests. Unittests happen to run with DEBUG=False, so I can't test for settings.DEBUG == True to skip this section. Any ideas? ...

Compact Framework Unit Testing via Microsoft.VisualStudio.TestTools.UnitTesting

I want to write Unit Test suite for my .netcf 3.5 C# application and I want it to run on device. How do I setup to do this? I am using Microsoft.VisualStudio.TestTools.UnitTesting. ...

How to make MATLAB xUnit work on MATLAB R2008b (7.7)?

I copied the matlab_xunit folder to C:\Program Files, and included it (and its subfolders) on the MATLAB path. Now MATLAB recognizes new commands such as runtests But this command does not find any tests on the current folder. What I have done wrong? What else can I do? >> runtests Starting test run with 0 test cases. PASSED in 0.0...

Moq - Ordered Setups (Expectations)

Hi All, I am fairly new to Moq and cant work out how I am to order setups. I have the following code: _orderRepository.Setup(r => r.Update(It.Is<Order>(a => ((int)a.OrderStatusReference.EntityKey.EntityKeyValues[0].Value) == 2))) .Throws(exception) .AtMost(5); I want this to be executed...

How can I raise an event on a mocked BackgroundWorker ?

I am trying to test how my class reacts on to what happens when the BackgroundWorker fires the RunWorkerCompleted event. I am using RhinoMocks (if there is another approach I am willing to try it as well) and the code is as follows: //arrange var bw1 = MockRepository.GenerateStub<BackgroundWorker>(); Action work1 = () => T...

Selenium's Open function waits until what?

When I call the Open("[some URL]") method in Selenium, it waits until all resources (images, CSS, JS) are downloaded. But how does it know that the browser is done requesting resources? Here's my snippet of driver code (in C#): DefaultSelenium selenium = new DefaultSelenium( "localhost", 4444, "*iexplore", "http://www.stackoverflo...

Comparison of arrays in google test?

I am looking to compare two arrays in google test. In UnitTest++ this is done through CHECK_ARRAY_EQUAL. How do you do it in google test? ...

Unit Testing iPhone - Linker Errors

I've followed the Unit Testing Applications guide from the iPhone Development documentation. I followed all the steps and it worked with the TestCase from the documentation. But as soon as I changed the TestCase to test real Code from my project I ended up with linker errors. All classes that are used in the TestCase are reported as miss...

File access, unit testing, dependency injection

Hello, I've recently asked a question regarding best ways of separating business logic from data access to make application testable (here). Thanks to Jeff Sternal, I've created interface for the data access and passing its concrete implementation from the application top level to BL. But now I'm trying to figure out how can I separate ...

Speeding up ASP MVC Unit Tests

How do people run their automated tests for ASP MVC ? Currently we're using native Visual Studio unit tests and running them linearly on a single machine. They're too slow to be useful currently. Switching to nunit? Distributing the unit tests with Incredibuild XGE? Anyone tried these or have other ideas? Thanks. ...

Java unit test coverage numbers do not match.

Below is a class I have written in a web application I am building using Java Google App Engine. I have written Unit Tests using TestNG and all the tests pass. I then run EclEmma in Eclipse to see the test coverage on my code. All the functions show 100% coverage but the file as a whole is showing about 27% coverage. Where is the 73% unc...

Where to write unit test code?

I thought it will be a common question so I searched for a while but couldn't find it. I am about to start a new project (C#, .net 3.5) and I was thinking about where I should I write the unit test code. I can create a unit test project and write all code there, or I can write the unit test code with the "class under test" itself. What...

introduction to unit-testing in javascript

I have never done any testing in javascript. I know, I know. But the reason is that I've never built big javascript applications before, so I've never seen any reason for getting into testing. But now I figured it's about time to get crackin'. The only problem is that everywhere I go, every testing framework seems to rely on the fact t...

Using IoC for UnitTesting

How can a Ioc Container be used for unit testing? Is it useful to manage mocks in a huge solution (50+ projects) using IoC? Any experiences? Any c# libraries that work well for using it in unit tests? ...

.NET persistence framework that supports test data

We are currently using SubSonic as our persistence layer because it's light but also because it allows us to feed in test data so our DAL can be tested without hitting the database. I absolutely love that about SubSonic. However, because we are also running into other issues with SubSonic, I'm now looking for an alternative while our p...

Has anybody integrated NCover with TFS?

Over the past year my group (some 50 engineers) moved onto Team Foundation Server and are now using it for source control, bug tracking and building. We have tens of thousands of lines of existing NUnit code that we continue to rely on and which we will never convert to MSTest. We have our builds set up such that NUnit posts results wi...

what exactly runs the quarz cron job in spring?

Hi! good people. i'm trying to use quartz with spring in a very simple project managed by maven.So in the module in which the mycron job class is i included a java main class to it just to see the job output some text and new date. here is my spring config: <!--Scheduling--> <!--Job--> <bean id="projUpdater" class="org.springframewo...

Specifying an empty or nil fixture in Rails

I have the ff. ActiveRecord which I use only for the ID it generates: class SomeTable < ActiveRecord::Base end I thought that one could specify fixtures for it through: one: two: Which I refer to in other fixtures as: other_one: some_field: some value some_table: one But when I run my tests, I get: Fixture::FormatError: Ba...