Integration Testing

What does Integration testing mean ? Wiki says: Integration testing is the phase in software testing in which individual software modules are combined and tested as a group [Read More][1] When a software grows(may it be written in Ruby or Java or any other language for that matter), stability can become an issue as the application evolve and grow. Integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected. The BDD-TDD life cycle goes as follows: Integration relates more towards BDD, so let's briefly get to know how BDD works. When

When to mock and How to mock

What is mock ? A mock is an object which we can use on behalf of another object. In short, mocking is creating (fake) objects that simulate the behavior of Real Objects. An object under test may have dependencies on other (complex) objects. To isolate the behavior of the object you want to test you replace the other objects by mocks that simulate the behavior of the real objects. When to mock ? Mocking is required when real objects are impractical to incorporate into the unit test. Most of the time external services or methods we have to mock. Once mocked, the

Why and How to write specs?

Why write tests ? Some answers might be Because I have been told by my manager Some could be yay! let's bolt on writing tests because it's cool But some meaningful reasons could be Test-Driven Development is a developer practice that involves writing tests before writing the code being tested. Begin by writing a very small test for code that does not yet exist. Run the test, and, naturally, it fails. Now write just enough code to make that test pass. No more. It gives a strong base for your project or library or even a framework to build upon flawlessly

Capybara-Webkit : How it works and its anomolies

This post is to explain some insights of [capybara-webkit][1] and its functional setup. What is capybara-webkit ? Capybara-webkit is used for acceptance tests in our rails 3 application and it turned out to be non trivial, even though there are excellent tools out there, and they keep getting better. WebKit is an open source web browser engine and capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. Using capybara with the capybara-webkit driver, works great because it runs in headless mode, without annoying browser windows popping up. How to setup ? gem "capybara-webkit" Set javascript driver to webkit

Useful Links on Rspec, Cucumber, Capybara,TDD, BDD

Hello Everyone, I wanted to share few links that Swapnil shared with me in the past. All of the links were really great. So I am sharing it here. Also if possible, just take an hour to go through the links. They are really good. If you guys find any good links other than the ones I give below, please post them as comments.So that this post can help someone who needs good references for the specs in the future. https://github.com/jnicklas/capybara https://gist.github.com/zhengjia/428105 :capybara cheat sheet http://eggsonbread.com/2010/09/

Test Unit Macros.

While writing functional test cases, we might need a common utility to be used through our test cases. These utility is generally recognized as "Macros" and more specifically as "Controller Macros". With Rspec we can easily configure such Macros, as Rspec specifically provide a RSpec.configure block to define all our utility and support classes/modules used throughout our test suit. The RSpec.configure block looks like this. RSpec.configure do config.extend(AuthenticateMacro) end With Test::Unit which is a default testing tool provided by rials and its much more liter than Rspec, we can't