unit-testing

How to run django unit-tests on production database?

Hi, i'm starting the TDD development attitude and am writting unit-tests for my django application. I'm aware of fixtures and know that's the way tests should be executed, but for a given test i do need to execute it on the whole database, and json fixture for 10+ million row database is not something i'd like to handle, moreover, this ...

Is it possible to programmatically generate JUnit test cases and suites?

I have to write a very large test suite for a complex set of business rules that are currently captured in several tabular forms (e.g., if parameters X Y Z are such and such, the value should be between V1 and V2). Each rule has a name and its own semantics. My end goal is to have a test suite, organized into sub test suites, with a tes...

is there a code-coverage tool for the TSQL sproc unit tests?

I am looking for a unitttest and code-coverage tool for TSQL sprocs. Can anyone recommend a good one? Commercial or free. ...

How to unit test a jQuery selector?

Hi all: Just a quick question... I currently have the following jQuery code with a selector in it. var ID = "idControl" function doesTreeViewExist() { if($('#' + ID).length == 0) { return false; } else { return true; } } I was wondering how do I write the test to test the selector using QUnit? ...

Integrate Silverlight Unit Tests in TFS Build

Hi, We have been creating silverlight unit tests by creating a plain vanilla .net unit test project, removing all references except for the unittestframework one, and then adding references to the SL assemblies we need (system, System.Core, ...). For more information, look at this blog post. We can do this, as we are adhering to the ...

How can I make a unit test run in DEBUG mode only?

I have a unit test that tests if an Exception is throw, but this Exception is only throw in Debug mode (via the [Conditional("DEBUG")] Attribute). If I run this test in Release mode, it fails. I tried to apply the same Attribute on the test but it's no taken into account. How can I exclude a test in Release mode? Does it even make sense...

What is Robot Army Testing?

What is Robot Army Testing? Where is it used? How can I learn it? ...

Debugging unit test in C using check

I'm trying to use check unit testing framework for my C application. But I can't use the debugger (gdb) with it because of two points: first, check use some complex macros (START_TEST et END_TEST) and the debugger has trouble to put a breakpoint in my code between these two macros (in fact, I can put a software breakpoint but It is ne...

PHPUnit, Testing "Behaves Like A..."

I have a series of PHPUnit tests to validate a class, "Class A". I have another class, "Class B" which extends Class A. Is there a good way to test that "Class B passes Class A's tests", or in other words "Class B behaves like Class A" without duplicating the test code? I could test for the extends (using instanceof), but that seems li...

how to unit test for laziness

I have a function that is supposed to take a lazy seq and return an unrealized lazy seq. Now I want to write a unit test (in test-is btw) to make sure that the result is an unrealized lazy sequence. ...

What is a simple example of using Seam's MockExternalContext to unit test?

I'm trying to unit test my seam components, and so far I've been doing pretty well with the EasyMock that my team has been using. However, I have run into a wall with javax.faces.context.ExternalContext. Since it's not an interface, I can't run EasyMock.createMock() on it. Seam has a MockExternalContext, but I have no idea how to use ...

Dealing with path issues with PHPUnit

I've just started to use PHPUnit, but I've run into a bit of a snag. My code uses $_SERVER['DOCUMENT_ROOT'] to compute paths for includes, which works when my apache server is the one running PHP, but DOCUMENT_ROOT is not set when I run phpunit from the command line with "phpunit Tests", so these includes don't work. Am I missing somet...

Using OCMock to expect category methods yields "[NSProxy doesNotRecognizeSelector"...]"

I'm using OCMock trying to test the behavior of NSURLConnection. Here's the incomplete test: #include "GTMSenTestCase.h" #import <OCMock/OCMock.h> @interface HttpTest : GTMTestCase - (void)testShouldConnect; @end @implementation HttpTest - (void)testShouldConnect { id mock = [OCMockObject mockForClass:[NSURLConnection class]]; ...

How to unit test ModelBind with Data Annotation validation ?

I am working on asp.net mvc application using the mvc2 framework. Here is the view. <% using (Ajax.BeginForm("CreateMenuCategory", "Admin", new AjaxOptions { UpdateTargetId = "tabs-MenuCategories", })) { %> <fieldset class="fields"> <legend> Add Menu Categories ...

How to debug unittest failures in Visual C# 2008?

This is nearly my first experience with unit testing. I added a unittest to my solution, and selected Test->Run->All Tests in Solution. My test failed due to an exception which got thrown in the tested code. Normally, I would then go to the stacktrace toolwindow, click my way through it, looking at the values of locals in every stackfr...

Is there any free mocking framework that can mock static methods and sealed classes?

Typemock can do this but it is $799USD and that is a lot to pay for two features. Please no conversations about avoiding using static and sealed things or encapsulating them. When using a large 3rd party API it is not possible and/or practical. Thanks ...

how can I view Console Output whilst my Unit Tests are running in Visual Studio 2008?

Hi, How can I view Console Output whilst my Unit Tests are running? I'm using the Visual Studio 2008 unit testing framework. So I know that after a test is finished I can go to the results page for the test and click on output, however I'm after a way that I can effectively watch the console output for tests as the unit tests are exec...

What is a good, free C# unit test coverage tool?

I'm looking for a tool that I can run against my code base to determine which areas of my code are covered by NUnit tests I've written. I would appreciate any suggestions at all, and example usage if needed. Thanks! ...

Does Django's Unit Testing Raise Warnings to Exceptions?

I am using Django's unit testing apparatus (manage.py test), which is throwing an error and halting when the code generates a warning. This same code when tested with the standard Python unittest module, generates warnings but continues code execution through them. A little research shows that Python can be set to raise warnings to exc...

How to test function that produce binary file?

Hi, I was trying to learn unit test with PHP. I know it's a bit too far for someone who just jump into unit test in PHP. Anyway, here's the case: function doresize(&$mp3file) { global $tmpdir, $mp3info, $ffmpeg; if(dirname($mp3file) != $tmpdir ) { copy($mp3file , $tmpdir . '/' . $mp3file); $mp3file = $tmpdir . '/'...