unit-testing

Can Rhino Mock deeper/nested members directly?

Is it possible to mock a stub/mock's object member call without having to define that as a stub, and also set the return value as all seperate verbose lines? Example: [TestMethod] public void AssignedPermissions_AssociateExists_ReturnsEdit_Rhino() { //Arrange var fakeConfiguration = MockRepository.GenerateSt...

How do I design unit tests for multiple Perl modules in the same distribution?

I have been developing an internal framework which is designed with bunch of Perl modules. All these modules are dependent on a single module that exposes some Win32 functionality. For e.g. A, B, C, D, etc modules all depend on a single module Z. So all these modules will import by "use MyFramework::Z". All these modules A,B,C etc can be...

Writing good tests for Django applications

I've never written any tests in my life, but I'd like to start writing tests for my Django projects. I've read some articles about tests and decided to try to write some tests for an extremely simple Django app or a start. The app has two views (a list view, and a detail view) and a model with four fields: class News(models.Model): ...

How to start and stop an Tomcat container with Java?

I have a Maven project that starts a tomcat container for pre-integration-tests (jUnit Tests). Most of my tests require that the web-application under tests is restarted. So I'd like to restart the Tomcat container before each jUnit test is executed. As for now I use the cargo-maven2-plugin to configure the tomcat container. So, is it...

loading fixtures for django tests

Hi, I want to use some fixtures in my tests. I have cms_sample app and a fixtures folder inside with cms_sample_data.xml I use the following in my test.py: class Funtionality(TestCase): fixtures = ['cms_sample_data'] I do use TestCase of django.tests and not unittest. But the fixtures are not loaded. What am I missing? Th...

Running Xcode iPhone unit tests with Cruise Control

When using Cruise Control to build an iPhone XCode project with Unit Tests, an error of "Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.Calculator' could not be found" is generated. This isn't encountered when run through XCode? Is Cruise Control trying to launch the app rather than j...

How to extract QUnit results from the document

When QUnit adds the test result details to your HTML document, it thoughtfully wraps the numbers of tests taken, passed and failed inside span elements, each with its own class, to let you recover these three numbers programmatically. However, even though I can see the spans in the finished HTML, I can't find them when I search with jQu...

DB Permissions with Django unit testing

Hello All, Disclaimer: I'm very new to Django. I must say that so far I really like it. :) (now for the "but"...) But, there seems to be something I'm missing related to unit testing. I'm working on a new project with an Oracle backend. When you run the unit tests, it immediately gives a permissions error when trying to create th...

How to write a unit-test where each test case has different input but does the same?

Hi, I need to create a unit-test for some python class. I have a database of inputs and expected results which should be generated by the UUT for those inputs. Here is the psuedo-code of what i want to do: for i=1 to NUM_TEST_CASES: Load input for test case i execute UUT on the input and save output of run Load expected re...

How to mock ASP.NET 3.5 to unit test my web controls?

I want to mock ASP.NET 3.5 behavior in order to unit test my WebControls: I want to test how they perform with mock data with existing system of events. Basically I want to test generated result HTML based on input mock data. How to do it? I looked into NMock, but it doesn't suit my needs for 2 reasons: It just runs ASP.NET server in...

iPhone OCUnit, exited abnormally with code 139, what is it?

iPhone sdk 3.1.2, xcode 3.1.4, mac os x 10.5.8, I'm a newbie using OCUnit comes with iphone sdk. The only error i get is: error: Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/Developer/usr/bin/otest' existed abnormally with code 139 (it may have crashed). Does anyone know what it is? T...

Test Windows Forms logic with NUnit

Hello, I'm diving into unit testing and I would like to know if it is possible to test some special functionality of a dialog or a form with NUnit. I have tried NUnitForms, but it lacks good documentation and seems that nobody is mantaining that project. Is it true? If you have any experience testing Windows Forms, please point me in ...

Unit test documentation

I would like to know from those who document unit tests how they are documenting it. I understand that most TDD followers claim "the code speaks" and thus test documentation is not very important because code should be self-descriptive. Fair enough, but I would like to know how to document unit tests, not whether to document them at all....

Test project path in Team System 2008

I have a test project Company.Test which is located under C:\Dev\Projects\Tests folder When I run a test, I am an xml file under the Tests folder, and I would like to get the path " C:\Dev\Projects\Tests" from the test method. Is there a way to get the current project's folder path? ...

Find revision when particular test started failing

We are in a situation when developers broken the TDD process and stopped running tests few weeks ago, and now we have about 25 failing tests in solution. Also i we do not have build archives for failed builds, because a nightly build definition was not set up to keep failed bilds in TFS What would be your approach to this problem? Is ...

TestNG multithreaded test with Spring @Transactional

I am using TestNG to test persistence Spring modules (JPA+Hibernate) using AbstractTransactionalTestNGSpringContextTests as a base class. All important parts @Autowired, @TransactionConfiguration, @Transactional work just fine. The problem comes when I am trying to run test in parallel threads with threadPoolSize=x, invocationCount=y Te...

How can I run only a specific test in a Perl distribution?

This question is related to this question I asked before. I have multiple test files (A.t, B.t, C.t etc) created to test their respective module A, B, C & so on. But when I do a make test, it runs all the tests. But, when I'm working on a specific module say B, I'd like to run unit tests for that module. After I'm done with my changes, I...

Unit testing - testing in isolation

I've got a set up with a number of layers: Website Application / Service Domain (contains entities) Persistence (contains repositories) I'm testing the persistence layer in isolation OK using data created in memory from a stub object. Now, Im thinking about testing my Website layer. I know I should be testing it in isolation which...

What is good way of doing Database Unit testing.

We are using Power Designer for Database Modelling and whenever something is changed in model (column name, datatypes etc) have go back and test all depended stored procedures and fix them accordingly. What would be the best tool to do unit testing of database. Thanks ...

Create csv file as a StreamReader on the fly

Hi I would like to unit test the following method public IEnumerable<T> GetData<T>(StreamReader fileStream) where T : new() The streamreader needs to be a file in CSV format, with particular column names. Is it possible to create such files in code, rather than having to have lots of them on the file system for each unit test? Any ...