All Questions

97
votes
18answers
30601 views

What Makes a Good Unit Test?

I'm sure most of you are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is do you follow any rules of conduct for writing tests i...
239
votes
19answers
40384 views

What is the difference between integration and unit tests?

I know the so-called textbook definition of unit tests and integration tests. What I am curious about is when it is time to write unit tests... I will write them to cover as many sets of classes as p...
42
votes
15answers
9671 views

Should one test internal implementation, or only test public behaviour?

Given software where ... The system consists of a few subsystems Each subsystem consists of a few components Each component is implemented using many classes ... I like to write automated tests of...
73
votes
11answers
79154 views

Before and After Suite execution hook in jUnit 4.x

I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm look...
267
votes
5answers
161237 views

What's the difference between unit tests and integration tests?

What's the difference between unit tests and integration tests? Are there different names for these tests? Like some people calling unit tests functional tests, etc?
96
votes
12answers
54295 views

Embedded MongoDB when running integration tests

My question is a variation of this one. Since my Java Web-app project requires a lot of read filters/queries and interfaces with tools like GridFS, I'm struggling to think of a sensible way to employ...
63
votes
16answers
50942 views

How to configure JPA for testing in Maven

Is there a way to set up a second persistence.xml file in a Maven project such that it is used for testing instead of the normal one that is used for deployment? I tried putting a persistence.xml int...
77
votes
5answers
31238 views

Stubbing authentication in request spec

When writing a request spec, how do you set sessions and/or stub controller methods? I'm trying to stub out authentication in my integration tests - rspec/requests Here's an example of a test requir...
135
votes
6answers
29943 views

RSpec vs Cucumber (RSpec stories)

When should I use specs for Rails application and when Cucumber (former rspec-stories)? I know how both work and actively use specs, of course. But it still feels weird to use Cucumber. My current vie...
82
votes
10answers
32377 views

How to test a confirm dialog with Cucumber?

I am using Ruby on Rails with Cucumber and Capybara. How would I go about testing a simple confirm command ("Are you sure?")? Also, where could I find further documentation on this issue?

Previous Next