unit-testing

"Monolithic" page classes - Is this a code smell?

I'm new to PHP and I'm trying to build a site for the first time without using a framework (n.b. I have nothing against frameworks, I just think I should learn to code from scratch before learning a framework on top of it. Sort of like learning Javascript before learning JQuery). I like OOP in concept, so I started there. I'm thinking o...

Testing view helpers

I'm currently working on a Rails plugin used for generating iPhone specific HTML meta-tags. I'm trying to use ActionView::TestCase for unit tests but keep getting the same error. See file contents and error below. Any ideas or help would be much appreciated. test_helper.rb require 'rubygems' require 'test/unit' require 'active_support'...

Looking for a tutorial to start with Unit Test and Visual Studio 2010

Hi everyone, What are the tutorial best suit for us to get start with Unit Test in Visual Studio 2010? Hope to hear from you. ...

What do you test with Unit tests?

I am new to unit testing. Suppose I am building a web application. How do I know what to test? All the examples that you see are some sort of basic sum function that really has no real value, or at least I've never written a function to add to inputs and then return! So, my question...on a web application, what are the sort of things th...

Is there an interface wrapper around the Task Parallel Library so that I can swap it out for unit testing?

I asked this question a while ago. I now know it is a Bad Idea and that encapsulating the scheduling and running of tasks should be abstracted so that one can pass in a synchronous scheduler from the unit tests. I've currently got code that uses the Task Parallel Library (TPL) and I'd like to inject something like ITaskScheduler into ...

Assert.Fail does not fail test ????

I am using VS 2008 for unit testing. Even if my code calls Assert.Fail("some message"); Test passess ?? and even Assert.IsTrue(false); this also passes test. How is this possible. I am expecting test to fail . i want to forcefully fail it . Please help ! ...

junit ant task: how to output stacktrace if timeout reached?

How to archive that the junit ant task runner will output the stacktrace if the timemout attribute is set? Thank you. ...

Is there a way to throttle the threads used by Task Parallel Library?

I'm using the TPL but I'm finding it tricky unit testing code that uses it. I'm trying to not introduce a wrapper over it as I feel it could introduce issues. I understand that you can set processor affinity in the TPL, but what'd be really nice is to set a thread maximum (probably per app-domain). Therefore, when setting the thread m...

Unbound error using python's unittest module

Hello, everyone. I would like a seperate class to run all of my tests, and then call that class from main to display the results. Unfortunately, I am getting an error like this: Traceback (most recent call last): File "/home/dhatt/workspace/pyqt_DALA_ServiceTracker/src/Main.py", line 21, in <module> allsuite = unittest.TestLoade...

Argument Exceptions should be Unit Tested?

I know this question is pretty similar to others that have been posted before but I would like to discuss this topic in a proper way. Do you think that the "obvious" exception should be unit tested? With obvious exception I mean for example exceptions due to null arguments or empty strings or negative numbers in situations where we the...

NUnitForms and 64-bit

Has anybody had any luck getting NUnitForms working in a 64-bit environment? I'm particularly interested in Windows Server 2003 x64. Whenever I try to run my unit tests I get the following error: System.ComponentModel.Win32Exception : The parameter is incorrect This seems to be related to the MouseController.Press() method. ...

Can you have MsTests and Windows-forms functional tests live in the same project file?

I've been asked to investigate the possibility of using a single .csproj file to run both interactive and unit tests. I've been able to get the windows forms project changed over to run msTests but now I'm not finding a way to run the windows forms/interactive side. Is there a way to do this? ...

Asynchronous Unit Tests in Ruby

I'm testing some javascript libraries I've built by using ruby's harmony. Everything is working perfectly except AJAX calls — does anyone have any ideas how to achieve this? My code looks something like this (I'm using RightJS): my.js function makerequest(argument) { new Xhr('http://mysite.com/some/jsonp'),{ jsonp: true, ...

How to test code easily?

Hi guys, I'm learning Java by reading "Head First Java" and by doing all the puzzles and excercies. In the book they recommend to write TestDrive classes to test the code and clases I've written, that's one really simple thing to do, but by doing this I think I can't fully test my code because I'm writing the test code knowing what I wan...

Someting like Xml asserts for NUnit

Does NUnit support (perhaps by using a third party libraries) a smart comparison for xml data. Let's say we need to compare two xml files - the simplest way would be to compare xml content using the no-case sensitive string comparison, but that would only work in a trivial cases. Is there any library around which could simplify xml com...

Change to app.config while running unit test

I want to run some unittests. For this tests I need to use another value from the app.config file then the default value. In this post "Reload app.config with nunit", I found a solution. However when running multiple test at once, some test fail, because the old configuration file (app.config) is not called after disposing the function...

Perl - Test::Unit::Lite, how to use multiple folders for test files.

I use Test::Unit::Lite for unit testing in Perl. Now, this module looks for .pm files in t/tlib. However, I have several tests for the project and I would like to separate them in folders like: t/tlib/Unit_Tests/...pm, t/tlib/Functional_Tests/...pm and so on. How can I tell to the unit test module to look for files in subdirectories of ...

How can I force all tests to have a single category in NUnit?

I'm using NUnit 2.5.3, but if a more recent version of NUnit solves my problem, it won't be an issue to upgrade. We have a couple of different categories for tests. Different categories of tests will be run during different flavours of build (fast running unit tests for checkins, all unit tests and other tests with external dependencies...

Mockito. Verify method arguments

Hello. I've googled about this, but didn't find anything relevant. I've got something like this: Object obj = getObject(); Mockeable mock= Mockito.mock(Mockeable.class); Mockito.when(mock.mymethod(obj )).thenReturn(null); Testeable obj = new Testeable(); obj.setMockeable(mock); command.runtestmethod(); Now, I want to verify that mym...

Running JUnit Tests in Parallel in IntelliJ IDEA

I have a large suite of tests that takes about half an hour to run and would love to be able to the test classes in parallel. Is there a way to do that with IntelliJ IDEA 9? ...