unit-testing

How do I test a ruby Mixin Module?

I'd like to know the best way to approach testing ruby mixin modules, in this case for use with ActiveRecord models, but really this is a general quesiton that applies to any class that you are extending with a mixin. Is it better to attempt to stub all of the necessary functionality of the Class that your mixin is extending, or just te...

Testing VSTO Applications?

I'm developing a Word 2007 VSTO application in VS2008. The part of the application that interacts with VSTO is difficult to test. VSTO objects behave differently than most class libraries. Their state and behaviors depend on how the user is interacting with Word, where they clicked, what's around the insertion point, etc. Mock objects co...

Can Rails unit tests be run on a different environment than test?

Hi, We have a large multi-developer project under Rails in which we are using tests for both models and controllers. Right now the developers have to switch the DB parameters for the 'test' environment to match their local dev environments before running tests. I am wondering if there is a way to run those tests on any environment other...

Why is ContextConfiguration location different in idea and eclipse

Hello experts. In my team we work both in Eclipse and Idea. That works pretty good, except for one minor issue that I can't figure out how to solve. When setting the ContextConfiguration location in our tests and running them inside Eclipse everything works like a charm: @Test(groups = { "database" }) @ContextConfiguration(locations ...

Unit Testing something that returns nothing, how to assert?

How would you assert code like this? What would be the best approach to do so? public void doSomething(int myProperty){ if (myProperty == 0) return; // If myProperty is not zero, do something in the method } ...

Configure JNDI names with Open EJB

I'm trying to (unit) test my EJB class without having to startup my websphere environment. Now I'm using Open EJB, but there are some issues with resolving the JNDI Names for other EJBs that are used within my EJB... and there is no way for me to inject mocked classes from my test right now. Getting the InitialContext final Properties ...

Integration testing - can it be done right?

I used TDD as a development style on some projects in the past two years, but I always get stuck on the same point: how can I test the integration of the various parts of my program? What I am currently doing is writing a testcase per class (this is my rule of thumb: a "unit" is a class, and each class has one or more testcases). I try ...

Mock Repository vs. Real Repository w/Mocked Data

I must be doing something fundamentally wrong. I am implmenting my repositories and then testing them with mocked data. All is well. Now I want to test my domain objects so I point them at mock repositories. But I'm finding that I have to re-implement logic from the 'real' repositories into the mocks, or, create 'helper classes' that ...

Am I just not understanding TDD unit testing (Asp.Net MVC project)?

I am trying to figure out how to correctly and efficiently unit test my Asp.net MVC project. When I started on this project I bought the Pro ASP.Net MVC, and with that book I learned about TDD and unit testing. After seeing the examples, and the fact that I work as a software engineer in QA in my current company, I was amazed at how aw...

How to test chrome extensions?

Is there a good way to do this? I'm writing an extension that interacts with a website as a content script and saves data using localstorage. Are there any tools, frameworks, etc. that I can use to test this behavior? I realize there are some generic tools for testing javascript, but are those sufficiently power to test an extension? Uni...

How best to organize projects folders for unit tests in .NET?

So I'm trying to introduce unit testing to my group. I've successfully upgraded a VS'05 web site project to a VS'08 web application, and now have a solution with the web app project and a unit test project. The issue now is how to fit this back into the source repository such that we don't break the build system and the unit test proje...

ClassCleanup in MSTest is static, but the build server uses nunit to run the unit tests. How can i adjust?

Hi All, MSTest has a [ClassCleanup()] attribute, which needs to be static as far as I can tell. I like to run through after my unit tests have run,and clean up my database. This all works great, however when I go to our build server and use our Nant build script, it seems like the unit tests are run with NUnit. NUnit doesn't seem to lik...

Getting Unit Tests to work with Komodo IDE for Python

I've tried to run the following code on Komodo IDE (for python): import unittest class MathLibraryTests(unittest.TestCase): def test1Plus1Equals2(self): self.assertEqual(1+1, 2) Then, I created a new test plan, pointing to this project(file) directory and tried to run it the test plan. It seems to run but it doesn't seem ...

Performance Testing Versus Unit Testing

I'm reading Osherove's "The Art of Unit Testing," and though I've not yet seen him say anything about performance testing, two thoughts still cross my mind: Performance tests generally can't be unit tests, because performance tests generally need to run for long periods of time. Performance tests generally can't be unit tests, because ...

Unit testing with JMS (ActiveMQ)

How to do unit testing with JMS ? Is it some de-facto for this ? I googled something - Unit testing for JMS: http://activemq.apache.org/how-to-unit-test-jms-code.html - jmsTemplate: activemq.apache.org/jmstemplate-gotchas.html - mockRunner : mockrunner.sourceforge.net/ Do you have any good experience on those and suggestion for me ? ...

Why don't I get code coverage results for C++/CLI project in Visual Studio 2010?

I've recently upgrade my solution to Visual Studio 2010. I have 4 projects I want to cover using unit tests - 3 C# and 1 C++/CLI. I get coverage for the C# projects but not for the C++/CLI project. I did get for all of them in Visual Studio 2008. I've configured the assemblies using testrunconfig -> Data and Diagnostics -> Code Cover...

What is the best way to test using grails using IDEA?

I am seriously having a very non-pleasant time testing using Grails. I will describe my experience, and I'd like to know if there's a better way. The first problem I have with testing is that Grails doesn't give immediate feedback to the developer when .save() fails inside of an integration test. So let's say you have a domain class wi...

Unit Testing a CSV Parser and Column Mapping Tool

I am really starting to enjoy unit testing and have the following question to the gurus of unit testing. Let's for example say I have the following class public class FileMapper { public Dictionary<string, string> ReadFile(string filename, string delimeter){} } How do you guys generally go about unit testing a Parser or ReadFile m...

What is the correct way to unit test areas around exceptions

Hi, Looking at our code coverage of our unit tests we're quite high. But the last few % is tricky because a lot of them are catching things like database exceptions - which in normal circumstances just dont happen. For example the code prevents fields being too long etc, so the only possible database exceptions are if the DB is broken/...

Expected specifier-qualifier-list before 'CGPoint'

My project compiles and runs fine unless I try to compile my Unit Test Bundle it bombs out on the following with an "Expected specifier-qualifier-list before 'CGPoint'" error on line 5: #import <Foundation/Foundation.h> #import "Force.h" @interface WorldObject : NSObject { CGPoint coordinates; float altitude; NSMutableDicti...