unit-testing

Multiple AppDomains: Keeping the Console Open

I have an integration test harness which launches a console exe several times, simultaneously, each in its own appdomain. As soon as any one of the console exe applications exits from its appdomain, it causes stdin, stdout, stderr to shutdown for all of the remaining console exe appdomains as well. That is, the console is closed even t...

Customize Python unittest report with HTML or Textile

Hey, I'm using unittest for testing my python code. I'm seeking a way that I can do the following: Customize the report of test run. Export it as HTML or Textile document. Any ideas? ...

Testing PHP code

Possible Duplicate: In need for a site that explains how to use PHPUnit Hi guys. I want to have a better testing procedure when I develop my applications in PHP. At the moment I map out all the possible actions/pages in my applications and test them all out everytime I make changes - that is in a perfect world. Often Time is...

Including resources file for Unit test in C# project

I have some functions that read & modify files. In order to make the unit tests independant of any file system issues, I want to include the files inside the project. However, my function should be getting the filePath, and all I can get from the assembly is a FileStream. Any idea how I can get the file path of a resource file in the p...

Unittesting database library in C# and NUnit

I have recently begun using NUnit and now Rhino Mocks. I am now ready to start using it in a C# project. The project involves a database library which I must write. I have read that test should be independent and not rely on each other nor the order of test execution. So suppose I wanted to check the FTP or database connection. I woul...

Unit testing class that does not have an output

Often times, a class would not have a direct output; it manipulates its dependencies, making them do things. For example: internal interface IEmailer { void SendEmail(); } class ReportSender { public IEmailer Emailer { get; set; } public ReportSender(IEmailer emailerToUse) { Emailer = emailerToUse; } ...

Cannot get to NSErrors from unit tests

Hello, I am setting up unit tests to run methods that should generate an NSError. For some reason, I can't get to the NSError from the unit tests. I created a sample method to test this, and it still doesn't work. What am I doing wrong? Implementation file: - (BOOL)createAnError:(NSError **)error { NSMutableDictionary *errorDet...

Unit Testing Code for Azure

I have an Azure application, and recently went gung-ho on the application settings. I realized putting pretty much every setting I needed into the ServiceConfiguration was the obvious way to go for anything you might even remotely want to change on the fly; which means web service URLs, smtp host information, etc is all in my ServiceConf...

While building a unit test project, VS 2010 cannot find the referenced assembly for testing.

I'm developing a unit test project (let's say XXX.UnitTest) to test ViewModels in another project (XXX) in my solution. I can add the reference but when I build, an error states that it cannot find that same project (XXX) Error 42 Could not load file or assembly 'XXX, Version=1.0.2.66, Culture=neutral, PublicKeyToken=null' or ...

Is it possible to prevent EF SaveChanges() from writing to DB?

I have service classes based on Entity Framework 4. I'd like to test them on a database filled with pre-generated sample data. The problem is: I would like the tests, whether passed or failed, to not actually touch the database, so that it may be re-used for other tests. Thus I'd like ObjectContext.SaveChanges to pretend that everything...

trickle down unit tests

If I'm writing a library in C that includes a Python interface, is it OK to just write unit tests for the functions, etc in the Python interface? Assuming the Python interface is complete, it should imply the C code works. Mostly I'm being lazy in that the Python unit test thing takes almost zero effort to use. thanks, -nick ...

Java bean testing framework

Is there a framework or library available that, when given a JavaBean, will "put it through its paces," i.e., test all the getters and setters, validate that a property matches the getters and setters, etc.? ...

Python unittest and discovery

I have directories, which contain files named like: 'test_foo.py' Each file is a test case. I would like to 1) run all the tests in a directory from the command line. I am using unittest2, since we are running Python 2.5.1. From one of these directories I tried typing this at the commandline: python -m unittest2 discover -p 'test_*.p...

Can an IOC Container AssemblyLoad Event / Static Injection?

I anticipate having various assemblies that each contain a static class, with a static property, that might need to be "set" the moment the assembly they are in is loaded. This other post has an example of a static class that could benefit from such a procedure, such as when integration or unit tests are applied. I wonder if there is an...

Unit test method with mock DAL, but underlying method calls different (real) DAL

I'm trying to implement unit tests in my current project. After that I'll start developing using TDD further on in this project. Yesterday I started making some tests and it wasn't as easy as it looks in theory/books. At the moment I'm struggling with a specific scenario, which I know someone else must have worked with in the past also....

Unit test problem with DataSource attribute [C#]

Hi, I try make my first simpel Data Driven Test. I created db (UnitTestsDb) with MS SQL Managmet studio, and also I created one db table (UsersTab). I try use this db in unit test. Code is here: [TestMethod()] [TestProperty("TestCategory","Developer"), DataSource("System.Data.SqlClient", "Data Source=.\\SQLEXPRESS;AttachDbFilena...

Test driven development of an MSBuild Task

What approach would you take while developing a custom MSBuild Task in a test driven way? Are there any available test harnesses suitable for test drive development of a Microsoft.Build.Utilities.ToolTask extension? I was considering attempting to use NUnit or MSUnit and check files generated and where they are placed, though this I ...

Running android unit tests from the command line?

I'm trying to run unit tests on the android platform in accordance with tutorial. Say, for example, I want to run tests for Email application. I open /apps/Email/tests/AndroidManifest.xml file, look for the <manifest> element, and look at the package attribute, which is com.android.email.tests, and in the <instrumentation> element I look...

how can i print the column in text file to row wise using unix command?

I have file like this.. for eg: number,dac,amountdac,expdate,0 1111,1,0.000000,2010-07-21,0 1111,2,0.000000,2010-07-21,0 1111,3,0.000000,2010-07-21,0 1111,4,0.000000,2010-07-21,0 1111,5,0.000000,2010-07-21,0 1111,6,0.000000,2010-07-21,0 1111,7,0.000000,2010-07-21,0 1111,8,0.000000,2010-07-21,0 1111,9,0.000000,2010-07-21,0 1111,10,0.0000...

How should I test private methods in java?

Possible Duplicate: Whats the best way of unit testing private methods? I am a beginner programmer, and I don't know how to write an application that will be well structured for unit testing. I want to write applications with the ability to afterwards add effective unit tests. The problem is with private methods - they can't ...