unit-testing

In xUnit.net, is it possible to run tests in order?

I know you generally should not depend on order for your unit tests, but in xunit is it possible to make your tests run in a certain order? ...

TDD. test first anyway?

Are you doing test first anyway? Or in some cases you are doing some coding and then writing your tests to make sure code works? As for me I prefer to create a class. Sure, during class creation I think about its interface and how to test the class. But I dont write testing code first. Do you write it first? Do you think you should alway...

When starting a MVC project, no Test project is created

When creating a new MVC Project in VS2008 Professional (SP1 installed), I do not get prompted for a Unit Test project. I have searched and found this solution (http://stackoverflow.com/questions/294117/creating-new-asp-net-mvc-project-unit-test-dialog-does-not-show-up) BUT I have already installed the Testing Tools and still no Unit Tes...

How to use SQLite :memory: database in webpy for unittesting

I want to use a SQLite in memory (":memory:") DB for the tests in my webapp. I'm using nosetests for the tests, and webpy as framework. I want to populate the DB in the setup() function, and then run all my tests. My problem is that webpy closes all the open DB connections after each request, and the SQLite :memory: DB only lasts until ...

Are there any Java open source projects with both integration and unit test suites?

I am looking for an open source Java project containing two reasonably complete test suites: a suite of integration tests and a suite of unit tests, for the same code. Note that I am only interested in developer tests, written with JUnit or TestNG. I ask this because I often see people saying that having both unit and integration tests...

Zend Framework: How to unit test a model using Zend_Service_Twitter

Hello, I have been getting into Unit Testing with Zend Framework. I am getting used to the other things it provide but I am having a hard time understanding Mock Objects. For this example, I am trying to use a Mock Object to test out my model. <?php class Twitter_Model_Twitter { private $_twitter; /** * Make the options...

Unit testing screen scraper

I'm in the process of writing an HTML screen scraper. What would be the best way to create unit tests for this? Is it "ok" to have a static html file and read it from disk on every test? Do you have any suggestions? Thanks ...

how to find allocated memory in linux

Good afternoon all, What I'm trying to accomplish: I'd like to implement an extension to a C++ unit test fixture to detect if the test allocates memory and doesn't free it. My idea was to record allocation levels or free memory levels before and after the test. If they don't match then you're leaking memory. What I've tried so far: I'v...

When is a Test not a Unit-test?

I am looking for rules like: A test is not a unit-test if: it communicates with a database it cannot run in parallel with other tests uses the "environment" like registry or file system What else is there? ...

how to phrase the result of an action in BDD/TDD

The title is probably not very clear. I have the following example in mind: an Authenticator object authenticates a user using credentials. It returns a AuthResult object. This AuthResult object says the authentication succeeded, or that it failed (and if so, why it failed, eg username not found). How can I phrase this in a test? 'test...

Ninject equivalent of Unity RegisterInstance method

Does Ninject have and equivalent method for unity's registerinstance. I want to create a mock object and register it. Thanks ...

Test case problem when exception handled

I have the following code with the corresponding test case: class XXX attr_accessor :source def check begin raise ArgumentError, "No source specified." \ unless @source.empty? != true puts "Passed" rescue print "Error: ",$!, "\n" end end end class T...

Unit Testing Front End Logic

We have tried to introduce unit testing front end logic on a recent project and the value of the tests are being questioned. We were not code reviewing the tests so the quality of them is poor, developers copied poor tests creating more poor tests and so we have a lot of crap tests. I still believe there is value in testing the prese...

Unit testing a communications protocol

I am developing a library for serial communications with an FPGA via RS-422 port. This library is part of a bigger project. I know I can test some parts of it, as the message generation. You set the inputs, and you can test if the array of bytes match the expected one. But, what if I wanted to make a more general test, how could I gener...

C++ unit testing with Microsoft MFC

Hey all, I'm trying to convince my organization to start running unit tests on our C++ code. This is a two-part question: Any tips on convincing my employer that unit testing saves money in the long run? (They have a hard time justifying the immediate expenses.) I'm not familiar with any C++ testing frameworks that integrate well with...

Ninject kernel binding overrides

I'm just wondering what the best practice is for rewiring the bindings in a kernel. I have a class with a kernel and a private class module with the default production bindings. For tests I want to override these bindings so I can swap in my Test Doubles / Mocks objects. does MyClass.Kernel.Load(new InlineModule(m=> m.Bind<IDepend>(...

Unit Test Collection

I have a simple method that returns an array of the letters of the alphabet. public char[] GetLettersOfTheAlphabet() { char[] result = new char[26]; int index = 0; for (int i = 65; i < 91; i++) { result[index] = Convert.ToChar(i); index += 1; } return result; } I tried to unit test the code with ...

C# Unit Testing: Testing a method that uses MapPath

First of all, I am aware that this question is dangerously close to: http://stackoverflow.com/questions/1231860/how-to-mappath-in-a-unit-test-in-c I'm hoping however, that it has a different solution. My issue follows: In my code I have an object that needs to be validated. I am creating unit tests for each validation method to make su...

How to run Integration Testing on DB through repositories with LINQ2SQL?

How do you go about integration testing your database through your domain layer/model (repositories) that uses LINQ 2 SQL in the implementation and leave the DB as you found it? In other words, the ideal world of unit testing the DB, the integration test would leave the DB as it found it. Are there tools out there that will handle this...

Unit Testing Assemblies Running Out Of Process

Anybody out there have experience testing "out of process assemblies"? I'm testing some Com+ (Serviced Component) and WCF services configured to be activated out of process and I'm not sure what the best practices are for testing in these situations. What I've done is given the public classes their own IOC container that they can buil...