unit-testing

How do you unit test JEE code?

I want to ask for your prefered way to test JEE code? I found only three project, that are trying to help to code unit tests in JEE environment: http://jakarta.apache.org/cactus/ : Last Published: 2009-01-18 http://www.junitee.org/ : Last Release: 2004-12-11 http://ejb3unit.sourceforge.net/ : Last Release: 2008-05-17 So I wonder, ...

Is anyone actually succesfully using MSTest across the team??

Hi, I've been using MSTest so far for my unit-tests, and found that it would sometimes randomly break my builds for no reason. The builds would fail in VS but compile fine in MSBuild - with error like 'option strict does not allow IFoo to cast to type IFoo'. I believe I have finally fixed it, but after the bug coming back and struggling...

Is it possible to automate Siebel testing behind the GUI?

My test team currently uses QTP to test through the GUI, but like any automated test suite that relies on the interface, it is more fragile than automating tests that directly interact with the code. I am attempting to learn more about Siebel and Siebel Tools to better understand how we might be able to test below the GUI, but would like...

Python: intercept a class loading action

Summary: when a certain python module is imported, I want to be able to intercept this action, and instead of loading the required class, I want to load another class of my choice. Reason: I am working on some legacy code. I need to write some unit test code before I start some enhancement/refactoring. The code imports a certain module ...

How to improve roundtrip time doing TDD

I want to improve the roundtrip time when doing TDD. I guess the total compile time for the solution will be longer, but that is not important. Background: When I watch the output window during compiling when I wait for my unittest to run, I see that some time is spent only verifying that depended projects does not need to be build. St...

Visual Studio 2008 Test Run taking long to Complete

I have a bunch of test projects in my solution. Most of them run instantly and finish instantly. One however takes a long time to complete. The actual tests run fast, but for a long period after all the tests have passed the interface still says "Test Run Completing...". The test run eventually finishes after 10-20 seconds. Has anyone ex...

How to test Webservices with PHPUnit?

I neet to test a couple of SOAP webservices. What types of tests can I run? ...

Using callback triggers with RhinoMocks

I'm writing unit tests using RhinoMocks for mocking, and now I'm in need of some new functionality which I haven't used before. I'd like to call a function, which again will call an async function. To simulate that the async function finishes and triggers the given callback with the result from execution I assume I can use the Callback...

How to unit test a method with a `using` statement?

How can I write a unit test for a method that has a using statement? For example let assume that I have a method Foo. public bool Foo() { using (IMyDisposableClass client = new MyDisposableClass()) { return client.SomeOtherMethod(); } } How can I test something like the code above? Sometimes I choose not to use u...

Unit testing device drivers

I have a situation where I need to write some unit tests for some device drivers for embedded hardware. The code is quite old and big and unfortunately doesn't have many tests. Right now, the only kind of testing that's possible is to completely compile the OS, load it onto the device, use it in real life scenarios and say that 'it works...

GUI runner in Eclipse for Python/IronPython

As much as the console runner is nice, I enjoy the instant red/green view of a graphical runner such as NUnit or MSTest for quickly glancing at broken tests. Does such a tool exist for Eclipse? I've tried Google but only found some awful standalone versions. ...

Start a "throwaway" MySQL session for testing code?

Hi, If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10. ...

test php functions (not classes) with netbeans and PHPUnit

I'd like to run unit test for a functions library file... that is, I don't have a class, it's just a file with helper functions in it... for example, I've created a php project at ~/www/test and a file ~/www/test/lib/format.php <?php function toUpper( $text ) { return strtoupper( $text ); } function toLower( $text ) { return st...

Hamcrest equal collections

Hello! Is there a matcher in Hamcrest to compare collections for equality? There is contains and containsInAnyOrder but I need equals not bound to concrete collection type. E.g. I cannot compare Arrays.asList and Map.values with Hamcrest equals. Thanks in advance! ...

For me to use Moq, do all my classes have to implement an interface?

I want to use Moq, but I am using Nhibernate and I didn't create interfaces for all my Model classes (POCO classes). Do I have to create an interface for each class for me to be able to moq my POCO classes? ...

Balancing Design Principles: Unit Testing

I am writing a simulation of Bananagrams. Currently, I have a GameMaster class that maintains the common collection of pieces. The deal(Player) method deals a certain number of pieces to that player. I want to write unit tests for this. However, at this point, I have no getters, and thus no way to check the status of the objects. Why n...

Not run some tests in PHPUnit?

Hi, I don't want to run all the tests sometimes to save time. I know I can comment the tests. But this method isn't elegant. I'm wondering whether there is some simple way to do that. All advice is appreciated. Thanks for your time and best regards, Box He ...

PHP and unit testing assertions with decimals

I have a method that returns a float like 1.234567890.I want to test that it really does so. However, it seems that this returned float has different precision on different platforms so how do I assert that the returned value is 1.23456789? If I just do: $this->assertEqual(1.23456789, $float); Then that might fail on some platforms wh...

Unit test using Moq doesn't pass, object is null, did I miss something?

The class I want to test is my ArticleManager class, specifically the LoadArticle method: public class ArticleManager : IArticleManager { private IArticle _article; public ArticleManger(IDBFactory dbFactory) { _dbFactory = dbFactory; } public void LoadArticle(string title) { ...

Dynamic Testing Tools

I am looking for some sort of dynamic testing tool. Let me explain what I mean. I have a modular application and part of my business strategy is to license each module independently. I would like to test things such as the fact that one module's tests all still pass even when the other module is not present on the file system. Another t...