unit-testing

Javascript Unit-testing?

What's the best way to go about running unit tests for Javascript? I've been playing around with Selenium IDE, but it's Firefox-specific. Selenium RC looks... difficult - but is it the best way to run tests in, say, IE6? Also, is it worth doing? I haven't seen much about automated tests for Javascript applications, but it seems to me...

XNA Unit Testing

So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic :-) ...

How to generate dynamic unit tests in python?

I have some kind of test data and want to create an unit test for each item. My first idea was to do it like this: import unittest l = [["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"]] class TestSequence(unittest.TestCase): def testsample(self): for name, a,b in l: print "test", name self.a...

How can I measure CppUnit test coverage (on win32 and Unix)?

I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report that tells me on a per-library or per-file basis, how much of the code was exercised. Here's the kicker: this has to run completely unnat...

What is the best way to unit test Objective-C code?

What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Xcode. ...

Simple test vs PHPunit

I was wondering if anyone that have experience in both these stuff can shed some light on the significant difference between the two, if any? Any specific strength of each that makes it suitable for any specific case? ...

What's the best way of unit testing private methods?

How do I use jUnit to test a class that has internal private methods? It seems bad to change the access modifier for a method just to be able to run a test. Thanks. ...

programmatically merge .reg file into win32 registry

What's the best way to programmatically merge a .reg file into the registry? This is for unit testing; the .reg file is a test artifact which will be added then removed at the start and end of testing. Or, if there's a better way to unit test against the registry... thanks. ...

FlexUnit component testing patterns: use addAsync or manually initialize?

We've been using Flex for about 6 months here at work, and I found that my first batches of FlexUnit tests involving custom components would tend to follow this sort of pattern: import mx.core.Application; import mx.events.FlexEvent; import flexunit.framework.TestCase; public class CustomComponentTest extends TestCase {...

Unit tests in Python

Does Python have a unit testing framework compatible with the standard xUnit style of test framework? If so, what is it, where is it, and is it any good? ...

Checking the results of a Factory in a unit test

I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a unit test for the factory. All you get back is an interface to the object. What is the best way to test that the factory has worked correctly?...

What C# mocking framework to use?

I want to start using mock objects on my next C# project. After a quick google I've found there are many: NMock EasyMock.NET TypeMock Isolator Commercial / Paid Rhino Mocks Moq So my question is: what one is your favourite .NET mocking framework and why? ...

How do I unit test a WCF service?

We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a little unsure on how to write unit tests that only test the WCF service layer. Should I just write unit tests for the DLLs, and integration t...

unit testing of dynamic fixtures

Is it possible to have a fixture change between test methods? If so, how can I do this? My syntax for this problem : In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to work in the same way that adding the "created" and "modified" fields will auto-populate...

UI and event testing

So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. The real thing is, I'm struggling to get my head around how to unit-test the UI and more generally objects that generate events: user controls, asynch...

When should I mock?

I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario here. ...

Can you recommend an alternative for NCover?

I'm looking for a good .Net code coverage alternative to NCover (insufficient .Net 3.5 coverage and now pay-for) or VSTS (way too expensive). We currently test with NUnit, but could switch to something with a similar 'layout' for its text fixtures if it were better integrated. ...

Are there any good C++ Mock object frameworks?

Does anyone have any experience with Mock Object frameworks in C++? I haven't been able to find much. It appears Google will be open sourcing theirs soon, so I guess it may be best to wait for that, but still interested to hear of others. Just an update the Google's gMock has been out for a while now. ...

How do you unit test business applications?

How are people unit testing their business applications? I've seen a lot of examples of unit testing with "simple to test" examples. Ex. a calculator. How are people unit testing data-heavy applications? How are you putting together your sample data? In many cases, data for one test may not work at all for another test which makes it har...

NUnit - How to test all classes that implement a particular interface

If I have interface IFoo, and have several classes that implement it, what is the best/most elegant/cleverest way to test all those classes against the interface? I'd like to reduce test code duplication, but still 'stay true' to the principles of Unit testing. What would you consider best practice? I'm using NUnit, but I suppose examp...