unit-testing

GWT JUnit test in NetBeans

I have written application in GWT using NetBeans. Now I want to test my application with JUnit. I have never used JUnit before but I have basic concept of how it works. Now the question is how do I setup basic Unit test to test some of my GWT Widgets. I found THIS simple example but don't know how it can be ran in NetBeans. ...

Code Coverage and Silverlight 4

Is there any way to get Code Coverage metrics for Silverlight 4? I have been trying to get this up and running for some time. For a while there was code coverage in the Silverlight Unit Test Framework, but to my understanding it is now broken. Any ideas on how I can pull off some code coverage metrics in my application? ...

Extra error on unit test in Xcode

I always have a extra error when I try check if my expected error appear in my unit test. First appear this error: "command /bin/sh failed with exit code 1" then my expected error. Is this normal, I'll always see the first error? ...

Moq - verify that no methods were called

This is a unit-test from one of my controllers in an ASP.NET MVC project, using NUnit and Moq: [Test] public void Create_job_with_modelstate_errors_fails() { var job = new JobDto(); this.controller.ModelState.AddModelError("", ""); ActionResult result = this.controller.Create(job); this.jobS...

Authlogic and RSpec, errors only running all examples

I have a Profiles Controller that acts_as_authentic with AuthLogic and I am trying to test this action: class ProfilesController < ApplicationController before_filter :require_user, :except => ['new', 'create'] def index redirect_to(current_user) end end The following example is in a spec file with 18 other pending examples...

MVC Testing using a mocking framwork (Moq)

Hi I'm using Moq to help in testing my ASP.NET MVC2 application. Problem: ArgumentException was unhandled by user code. Unable to obtain public key for StrongNameKeyPair This code has been adapted from Scott Hanselman's NerdDinner1. HomeController CreateHomeControllerAs(string userName) { var mock = new Mock<Controller...

Multiple application entry points

Hi, Recently I was trying to add unit tests to an existing binary by creating a extra (DLLMain) entry point to an application that already has a main entry point (it is a console exe). The application seemed to compile correctly although I was unable to use it as a DLL from my python unit test framework, all attempts to use the exe as a...

Mock objects - Setup method - Test Driven Development

I am learning Test Driven Development and trying to use Moq library for mocking. What is the purpose of Setup method of Mock class? ...

Hello, I have a question about an error on shoulda macros

Hello I have a question about this error. I dont know why it happened to me, but in another pc it worked well. I've try this method class BookTest < ActiveSupport::TestCase should_validate_presence_of(:author_id) should_have_many(:customer_reviews) should_belong_to(:author) end And I got an error lik this 1) Error: test: Book...

Storing test data

Hi all, I'm currently in the early stages of designing a system that will end up having lots of tests. The application will be handling various XML data, and knowing the type of classes/functions that will go into this, I know that many tests (we're talking 100+) will need to load small XML documents that will then be used to test the p...

Ruby Unit test framework Question...Can i instantiate a test object from a normal ruby data object

Hi All I am trying to pass my test data to the test object. I have a data object which has the parameters/hash that i need to pass to the test object.I just need to use the test framework for 1) running assertions on data in my data object 2) and to be able show a cumulative results for a large number of these test objects through ...

Using gaetestbed within virtualenv

I'd like to give GAE Testbed a try, but am running into the following error after completing the instructions on its homepage. $ nosetests --with-gae ... ImportError: No module named dev_appserver I've confirmed that this happens in both a virtualenv and outside of one. ...

Boost.Test output_test_stream fails with templated output operator

I have a class: class foo { private: std::string data; public: foo &append(const char* str, size_t n) { data.append(str,n); } // for debug output template <typename T> friend T& operator<< (T &out, foo const &f); // some other stuff }; template <typename T> T& operator<< (T &out, foo const &f) { return out...

How to create an in-memory icon for my unit test

Hi, I have a resource assembly that contains various strings, icons, and bitmaps that my application uses. I have written a Resource Manager class that I would like to unit test. I have managed to create unit tests that have in-memory strings (duh) and bitmaps but I am struggling with how to handle the icon resources. Bitmaps can be ...

Unit testing ASP.NET MVC Controller methods through concrete class or interface

Hey everyone, I'm writing some unit tests for some controller methods in my project and am wondering whether to test against the controller class itself or an interface of that controller. Should I be creating an interface for each controller and run my unit tests against that? ...

make javascript function callback-ish

Hi, i'm having a javascript function using jquery: my.namespace.loadSomeStuff = function() { $.get('/Services/loadStuff', function(c){ $("#stuffDiv").html(c); }); }; and am trying to write unit tests for this. now, since this function is not really returning anything and loading some stuff asynchronous using jquery's...

Unit testing mathematical code

Hi, I am writing a small utility for calculating a complicated mathematical formula (using commons-math library for integration and root finding). I was trying to write it in the same way as a normal business application, however I found that I am getting a quickly increasing number of classes. To get the first step of the calculations ...

How to test whether any non-header cell in Excel file is bold or italic.

We use an Excel sheet which contains some business logic (and so it is often edited by non-IT). Some C++ code is generated in VBA from the same sheet - silly, I know. I plan to write a bunch of unit tests against this worksheet, ensuring strict format for the benefit of all. For instance, things should be sorted alphabetically. I have no...

Test of an unobtainable value in JSSpec

I am learning JSSpec. Here's my problem. In this code : describe("Buttons' events", { 'when I click on a button with an id of #b1...': function() { click_me(document.getElementById("b1")); }, '...then URL should have a parameter b with the value someURL1 and a parameter ui with the value 527bd5b5d689e2c32ae974c6229ff785), because...

Mocking wcf in silverlight

I thought that I could create a WCF in and call it in Silverlight. I would inject an interface to the WCF. Then in my unit test I would mock the wcf.... However when I actually got to do this I notice that the interface does not actually have the methods that I am calling. ie myWCF.myfunctionCompleted(myhandler); myWCF.myfunctionAsy...