unit-testing

cxxTestgen.py throw a syntax error

I've follow the tutorial on http://cxxtest.com/index.php?title=Visual_Studio_integration and I've looked on google but found nothing. When I try to lunch a basic test with cxxtest and visual studio I get this error : 1>Generating main code for test suite 1> File "C:/cxxtest/cxxtestgen.py", line 60 1> print usageString() 1> ...

Using delegates instead of interfaces for decoupling. Good idea?

When writing GUI apps I use a top level class that "controls" or "coordinates" the application. The top level class would be responsible for coordinating things like initialising network connections, handling application wide UI actions, loading configuration files etc. At certain stages in the GUI app control is handed off to a differe...

How to select drop down list value and then postback with PowerShell and IE 6.0

This will set the value, but will not cause a postback: function SelectValue($ddl, $val) { $ddl.options | % {$i = 0}{ if ($_.value -eq $val) { $ddl.selectedIndex = $i; }; $i += 1; } } Also, once I get the postback working, will I need to add a delay, eg: while($ie.ReadyState -ne 4) { start-sleep -m 100 ...

do you know any tutorial for MBUnit?

Hi, It looks a bit hard to find documentation about MBUnit, do you know any tutorial? Thank you! ...

Where to keep unit tests?

Are unit tests kept in the same file as the code, a separate file in the same directory, or in an entirely different directory? ...

How to use integrated unit testing in VS2008 to test abstract class

I can't find any info on whether it can do this. I have a couple of protected methods inside the abstract class and want to test these. I don't want to inherit from the class and test its implementation (besides thats technically not strictly unit testing, also VS2008 won't let you test inherited methods). I would like to solve this p...

How can I write additional test information to the screen during a testrun?

I want to output some additional information about a test run that I can quickly visually review. It doesn't affect the outcome of the test. I am familiar with Assert.Inconclusive(String) but I want the test to pass/fail on it's own. ...

MSTest: Problems with DeploymentItem attribute

Hi, I'm currently maintaining an "old" system written in C#.net, removing some obsolete features and doing some refactoring. Thanks god, the previous guy wrote some unit tests (MSTests). I quite comfortable with JUnit tests, but didn't do yet much with MSTests. The test methods have a DeploymentItem attribute, specifying a text file wh...

Python unittest: how do I test the argument in an Exceptions?

Hi all, I am testing for Exceptions using unittest, for example: self.assertRaises(UnrecognizedAirportError, func, arg1, arg2) and my code raises: raise UnrecognizedAirportError('From') Which works well. How do I test that the argument in the exception is what I expect it to be? I wish to somehow assert that capturedException.ar...

Testing Linqto SQL classes

How do I unit test my code that has LTS Datacontext. I get error while testing, I have a lot of Datacontexts and manually adding the Connection string is a pain, any suggestions. ...

TDD - When introducing a class when refactoring - should that class be unit tested?

Presume you have a class which passes all its current unit tests. If you were to add or pull out some methods/introduce a new class and then use composition to incorporate the same functionality would the new class require testing? I'm torn between whether or not you should so any advice would be great. Edit: Suppose I should have ad...

Testing an Oracle Coherence IPortableObject Implementation in .NET

In order to get good test coverage, I want to test the WriteExternal and ReadExternal methods of IPortableObject (as described at Creating an IPortableObject Implementation (.NET) ). Here is code similar to what I have in my test method (which I like, and it works). Person person = new Person { Name = "John Doe" }; Person personCopy = ...

Best practices: Unit Test structuring

I'm a bit confused. Got project which is covered by unit tests in different assembly. Co-developer created another project + another unit test assembly too. Now we want to mix some logic between both unit test projects (object factories, some initialization tasks, injection/mocking helpers, etc.). That would cause his project to referenc...

Provide explicit view names when unit testing a controller action?

Stephen Walther recommends that you should provide explicit view names when you want to unit-test them. I definitely want to test them, but I'm curious whether or not this recommendation is still valid with the release of 1.0. In the NerdDinner tutorial the tests just check if the viewResult is null. They don't explicitly specify the ...

Unit testing in JEE environment

We're migrating our application into a JEE container, and looking for tools to use for unit testing (and integration testing) our migrated app. Our requirements include: Ad-hoc testing: the ability to run tests manually, on demand (to be used by developers while developing code) Batch testing: the ability to run a large (and growing) s...

How to handle exceptions raised in other threads when unit testing?

When testing with Visual Studio Team Test unhandled exceptions in tests are caught and reported in the results. So I was kind of surprised to see the test hosting process (VSTestHost.exe) crash and showing the system crash dialog. Upon further investigation this crash was an unhandled exception raised in another thread (more directly, i...

Unit testing with nose: tests at compile time?

Is it possible for the nose unit testing framework to perform tests during the compilation phase of a module? In fact, I'd like to test something with the following structure: x = 123 # [x is used here...] def test_x(): assert (x == 123) del x # Deleted because I don't want to clutter the module with unnecessary attributes nosetes...

Unit testing DDL statements that need to be in a transaction

I am working on an application that uses Oracle's built in authentication mechanisms to manage user accounts and passwords. The application also uses row level security. Basically every user that registers through the application gets an Oracle username and password instead of the typical entry in a "USERS" table. The users also receive ...

Where can I find large php5 best practises project?

I'm trying to find a project that incorporates the "best practices" that are discussed and debated on a daily basis for almost all languages but I'm trying to focus on php5. Is there a php5 open source project that I can comb through to see working examples of project that exemplifies Units Tests, Dependency Injection and other best pra...

Organising methods for performing tests - C#

I have a class at the moment and within this class it has 15 or so private methods that perform certain tasks on a loop run by a timer. Some of these methods call of to the database and some don't. The question is...how can I arrange these so that I can setup the class so I can fake a repos or executing process?? This is a simplified ...