testing

djangorecipe test command

Hello Everyone, I've got a question about testing my Django applications in a built out Django project. First, I've got the same project not built out and everything works fine. This project follows the standard Django project architecture apart from putting my tests in their own directory: django_project/ manage.py settings.py ...

How to approach implementing an interface in a TDD way

So I'm trying to convert myself to a more test- and behaviour- driven approach to my development. It's good for me, and I've seen good results in the few projects I've used it for so far. My current project is a FUSE-based filesystem - I want to add some functionality over basic filesystem access so FUSE seemed like a good fit. All I ...

Unit Testing for NSError's

Hallo, I am trying to set up some unit tests for code that accepts an *NSError as an argument. If there is a validation problem, then the object is not saved and the NSError condition is set. My method is: - (BOOL)validateConsistency:(NSError **)error { ... code omitted for brevity ... if (errorCondition == YES) { N...

Practices for refactoring unit tested code

Suppose I have a function like this: public void AddEntry(Entry entry) { if (entry.Size < 0) throw new ArgumentException("Entry size must be greater than zero"); DB.Entries.Add(entry); } And a corresponding unit test: [TestMethod] [ExpectedException(typeof(ArgumentException), "Entry size must be greater than zero")] p...

xUnit or NUnit? What advantages and disadvantages of each other?

Hi Guys, what is pluses and minuses of each framework, comparing to each other? How well they work with ASP.NET MVC? How well they support mocking? ...

Trying to gain confidence in the benefits of TDD

I just bought The Art of Unit Testing from Amazon. I'm pretty serious about understanding TDD, so rest assured that this is a genuine question. But I feel like I'm constantly on the verge of finding justification to give up on it. I'm going to play devil's advocate here and try to shoot down the purported benefits of TDD in hopes that ...

jquery (or pure js) simulate enter key pressed for testing

What the best way to simulate the user pressing "enter"? $(element).keypress() doesn't seem to allow me to pass in the actual key that was pressed. ...

Why does calling Session.Clear() cause this test to fail?

The following is a simple test of a repository against FluentNHibernate-1.1.0.685 (NHibernate-2.1.2.4000). The Session and NH config are provided by the test fixture. [Test] public void ShouldEdit() { var employee = CreateEmployee(); session.Clear(); var changedEmployee = _testRepository(employee.id); changedEmployee....

How to use named Machinist blueprints in Cucumber with Pickle

I noticed this little tid-bit in the readme for pickle: (The latest version of pickle supports multiple blueprints, for earlier versions of machinist use pickle <= 0.1.10) I'm running in to a situation where I want to create a user with admin privileges. I've got two machinist blueprints: User.blueprint do first_name last_name ...

Can you recommend a book on automated testing/bug discovery(without source code)?

I hear there is some kinda fuzzing algorithm, is there a book on this? ...

How do I run an app (TestComplete) as Administrator from the command line

Scenario.... I am writing a powershell scrip to Automate some UI Testing, there are a bunch of things that I have to do re, checking code out of a repository, building, copying installers, then at the end I want to run TestComplete and test the installer UI... The Installer runs in elevated mode as it writes to program files, registry ...

How to turn Spring @Autowired required property to false for test?

I've been using the @Required annotation up to now to ensure DI of my beans in a Spring configured application. To enable the annotation, you need to declare a RequiredAnnotationBeanPostProcessor bean in your configuration. In your test configuration you just don't declare it, so that if some beans are not needed you don't have to have...

Saving to a repository using Rhino Mocks

Hi, I have so far been coding by doing mostly Get methods in my business/service layer using Rhino Mocks to get an expected List or type and making Rhino Mocks return it for me, my question is how do I test a set/save call, e.g void SaveCustomers(Customer) I have a call called GetCustomers, can I use Rhino mocks to call this immediatel...

Test cases for string inputs

What are all test cases (and test test case brainstorming questions) related to string inputs? Individual answers may contain questions specific to certain domains (eg email address) but should probably point to a separate wiki-question. Please add your answer BOTH to the question and to the list of answers so that individual items may...

Testing against an external UDP API. Where to start?

I'm writing a client library against an API that communicates using UDP through a socket connection. I'm trying to write tests as I go however I'm running into a few problems. Should I just build a testing server and start that up in my test helper? I don't want to hammer the external servers when running my tests. Or should I just moc...

RSpec: difference between "should == ..." and "should eql(...)"

In RSpec, what's the difference between using should == ... and should eql(...)? I noticed that the RSpec documentation always uses eql, but == is less typing and easier to read. What am I missing? ...

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...

Automating compatibility testing against many programs

Short version: What's the best way to automate compatibility testing against a large number of third-party programs? The details: I develop a program whose core feature is interacting with a variety of different pieces of music player software via their respective RPC interfaces. The RPC itself typically happens either via D-Bus or vi...

add test class to a test suite in ruby

I have a test class which i want to add to another test suite .. I tried testsuite< am i doing something wrong in here ...

selenium-rc Unable to connect to remote server

Hi, I've run into a weird problem yesterday. I am using selenium-rc along with C# to write test scripts. For the first time, yesterday, I started getting the error "Unable to connect to remote server". It seems to occur randomly at any part of code. e.g. The error is triggered at the statement selenium.setspeed(2000);. In another script...