I am unittesting a bit of code that can fetch files either from the local file system, or from http or ftp. To unittest it I created a simple method that uses the HTTPListener class from the BCL to run a one-off webserver on a different thread, it just serves a byte array that I send in and then shuts down. (See code for this below).
I...
Using RhinoMocks - how can I say "whenever some function is called from now on - it should return some value".
I'd like to say something like this:
fakeCalculator.WhenCalled(factory => factory.AddNumbers(1, 2)).Return(3);
And then - when the AddNumbers function is called with 1 and 2 - it will return 3. I.e. I want to define this ...
If I write test code to test my code, the test code might have bugs so it needs to be tested and when my code changes my test code may have to change. Repeat ad infinitum.
How is this problem solved (in practice and in theory)?
...
In the following code sample I have an Async Calculator class. This is injected with an ICalc, which will be a syncronous calculator. I use dependency injecting and mock the ICalc because this resembles my true scenario, though I guess the mocking isn't really of relevance to the question. The AsyncCalc has a function which will call ano...
I've just started to explore BDD for my current project. I'm using moq with mspec to get nice test outputs.
However, i can't find enough examples of what i'm trying to do, maybe i'm using the wrong approach or perhaps just don't understand the syntax enough, please advise.
The problem is i'm trying to verify whether a property has been ...
I have been using autotest for unit testing in ruby. Is there an equivalent for PHP that will run my unit tests after my code has been updated? I am using PHPUnit and Eclipse.
...
I need help testing! :)
I work at a small webdev company and am responsible for the quality of our applications.
We build e-commerce sites every now and then, and since our customers rely on the site to make money, the have to be completely bug free. Sadly, we've had issues with that in the past and we're looking to tighten up our tes...
I'm just starting to practice BDD using the GWT approach to the following code exert and just realised that I can't do the second test.
My GWT goes something like
Given there exists an open query
When the user replies to the query
Then it should save the reply if the reply is not blank
Then it should notify the user and not save the ...
How do I go about integrating Simpletest with Kohana 3? I have checked out this answer but I like to use the autorun.php functionality from SimpleTest.
...
I compile my programm against javaee-api. But for Junit testing I must use a specific implementation like glassfish's javaee.jar to avoid errors like java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence (see also 1).
So avoid using methods, that are only a...
I am using the Boost 1.34.1 unit test framework. (I know the version is ancient, but right now updating or switching frameworks is not an option for technical reasons.)
I have a single test module (#define BOOST_TEST_MODULE UnitTests) that consists of three test suites (BOOST_AUTO_TEST_SUITE( Suite1 );) which in turn consist of several ...
We have an application that now has a 64 bit target, as well as the old 32 bit target. My question concerns our Unit Tests. Should we compile and run our Unit Tests in both as well? Is there any chance we will find flaws this way? Am I being overly paranoid?
...
We are trying to write Unit Tests in our ASP.Net MVC project.
Some of the methods in the controller contain a call to Server.UrlDecode
This fails with a null reference exception when called from a unit test.
Anybody have a solution for this?
...
I'm using Visual Studio 2008.
I have a solution with two projects. One builds a DLL, which is my "production code". The other builds a console app exe, which is my unit test suite.
For my unit test project, I have listed as linker inputs the names of the source modules from the DLL. I.e., I have a DLLMain.cpp in the DLL project, and...
I'm trying to create a test that simulates a system failure to ensure the integrity of a Oracle Berkeley DB XML database. Data loss is currently being experienced during an insert operation so I'd like to setup a test that starts inserting an arbitrary number of documents and sack the process along the way (akin to someone yanking the po...
I was wondering if there are any tools similar to Pex that analyze T-SQL stored procedures and functions (instead of managed code) in order to generate meaningful and interesting input values for parameterized unit tests.
...
I am writing a Java program that downloads and then processes many webpages. What is the best practice for testing a component of the program that downloads a page without hitting the remote servers?
...
I have a method that I'm trying to unit test that uses a query object, I would like to Stub this query object for my unit tests. This query object does has a dependency (UnitOfWork). I am using a IOC/DI container to instantiate my objects in the app. However I DO NOT want to use the container while TDD. The way I see it is I have 2 optio...
I'm currently working on a project where I'm unit testing with NUnit, mocking with Moq, writing specifications with MSpec and playing around with testing the UI with WebAii.
While I'm enjoying the experience on the whole and learning plenty about what and how to test, I can help wondering if all four of these tools is going a bit overbo...
I'm currently working on a large BPM project at work which uses the Global 360 BPM tool-set called Process 360. Just to give some background; this product works like a lot of other BPM solutions in that you design multiple "process maps" which define the flow of a particular business process you're trying to model, and each process map ...