unit-testing

Software task/project planning books?

Hiya, I'm looking for a book that tells you how to split up a software (or anything; doesn't have to be software-specific) task or project into discrete chunks, and helps elucidate all the issues and nuances that aren't apparent when you just start programming. Should I get a book on use cases? If so, what? What I'm looking for is a b...

verify object type with easymock

hello guys.i've just come into the world of easymock.i'll like to ask if easymock only does mock object for interfaces? So in my effort to understand i wrote a class to generate unique voucher in java.i obviously can't know which value it will generate to use in the assert stuff.So how to make sure the generated voucher is of the type l...

Why isn't assertRaises catching my Attribute Error using python unittest?

I'm trying to run this test: self.assertRaises(AttributeError, branch[0].childrennodes), and branch[0] does not have an attribute childrennodes, so it should be throwing an AttributeError, which the assertRaises should catch, but when I run the test, the test fails because it is throwing an AttributeError. Traceback (most recent call la...

Is there anything similar to Selenium IDE that would run on Internet Explorer 7?

I need to develop Web functional testing for an application that currently supports only IE 7+. I'd also like to have my tests exported in Java so that I can have them integrated with my Java codebase ...

dbUnit data types

I'm using dBUnit and am trying to assert a row of my pre-defined FlatXmlDataSet with the actual DB dataset. The problem is the getValue for my Verification Code field returns a string when that data originates from the FlatXmlDataSet and as an Integer when its from the actual live database. This is true with any data type that isn't a St...

Can any one suggest a step by step example for using moQ framework

Can any one suggest a step by step example for using moQ framework. any guidelines or thumbrules that has to be followed while mocking objetcs . can be much help. thanks. ...

Unit test fails, tested code works!

I have a simple unit test which tests that a validation function picks up a specific validation issue. The validation item returns a simple object with Item & Message properties. I've written a unit test for this function but this always fails even though I know the function works as expected. <TestMethod()> Public Sub ContractNote_Vali...

Unit tests in production release code?

Couple of questions: 1.) Do you unit test release code? 2.) If so, do you then leave those unit tests intact so that the tests themselves exist in the production environment? I see the value in #1, but is it a "good practice" to create dependencies in production to, for example, the NUnit assemblies? Give me your thoughts. ...

How do I assign shortcut to "exec my entire unit test project" in Visual Studio 2008 Professional Edition

Hi all, Attempting to do TDD, I often need to execute all my tests - in my case a single test project that tests all my assemblies. Currently I'm selecting the project in solution explorer, then pressing a shortcut to "run all tests in debug mode" (which effects the current selection in solution explorer or in code window). Can I do t...

How do unit tests work in django-tagging, because I want mine to run like that?

Few times while browsing tests dir in various Django apps I stumbled across models.py and settings.py files (in django-tagging for example). But there's no code to be found that syncs test models or applies custom test settings - but tests make use of them just as if django would auto-magically load them. However if I try to run django...

DOCTEST==argv[0] as a convention?

In a bit of Python I'm writing (a command line and filter testing tool: claft) I wanted a simple way to invoke the built-in test suite (doctest) and I decided on the following: if 'DOCTEST' in os.environ and os.environ['DOCTEST']==sys.argv[0]: _runDocTests() sys.exit() Thus if the DOCTEST variable is set for some other program...

Physical world examples of design for testability and test driven development

I'm going to be doing a presentation on unit testing and in doing so I will touch on "design for testability" patterns. In other words using IOC containers, Dependency Injection, avoiding static methods etc. I have a feeling my team will be cold to starting to code differently to accommodate for testing. So I was wondering if anybody ...

Is it possibile to use TDD with image processing algorithms?

Recently, I have worked in a project were TDD (Test Driven Development) was used. The project was a web application developed in Java and, although unit-testing web applications may not be trivial, it was possible using mocking (we have used the Mockito framework). Now I will start a project where I will use C++ to work with image proce...

Unit Testing Frameworks in SAS: FUTS vs. SASUnit

Dear Stackoverflow, Does anyone have experience using a third-party unit testing framework for SAS such as FUTS (http://www.thotwave.com/products/futs.jsp) or SASUnit (http://www.redscope.org/sasunit/en)? I'd really like to compare and contrast these options with each other and with any other known alternatives (I currently use my own ...

Organization of Unit Tests in Visual Studio

I'm currently creating a paired unit test assembly for every assembly in my project, both are in the same folder. MyProject/MyProject.csproj MyProject.Test/MyProject.Test.csproj Looking at open source projects, I've seen some smaller project put all tests in one assembly, and other split it out like mine. I'm dealing with a large so...

Moq Match and Verify Array / IEnumerable parameters in method setup

I'm having problems verifying Ienumerable / Array type parameters when setting up expectation for methods call on my mock objects. I think since it's matching different references it doesn't consider it a match. I just want it to match the contents of the array, sometimes I don't even care about the order. mockDataWriter.Setup(m => m....

When to use stubs and mocks?

I've this confusion all the time. If I write a code which uses fake code to assert some operation, how do i trust my real implementation when it is started really using the real objects instead of fake ones. For example, I've this code -- [Test] public void CanCreateContactsWithData() { using(ISession session = fact...

How to run explicit test cases of Nunit

Hi, My test suite project contains some explicit test cases, now i want to execute the test cases with the help of Nunit-console.exe. When i execute the test cases, the explicit test cases were excluded from the execution. So, i have tried to execute the test cases using the batch file in the following manner. nunit-console.exe test1.d...

Best way to structure your Unit Test assemblies?

I would like to optimize my unit test assemblies. Specifically, I would like to make sure that multiple developers can work concurrently without stepping on each others' toes. What is the best practice when creating unit tests? One unit test class per real class, unit tests broken up by concern rather than by class, one large unit test c...

How do i mock a method that accepts a handle as an argument in OCMock?

I'm trying to mock a method that has the equivalent of the following signature: - (NSDictionary *) uploadValues:(BOOL)doSomething error:(NSError **)error I want it to return a small dictionary so that my test can make sure the code uses the dictionary properly. however, no matter what i do OCMock always returns nil from the method, r...