Using the database in our tests

I’m releasing another chapter of my book. It is the chapter we focus on using a database in our tests. The chapter uses ActiveRecord and several additional gems. Please give it a read and let me know what you think.

Chapter 3: Getting our feet wet with Watir PDF ePub Kindle
Chapter 4: Getting started with Cucumber PDF ePub Kindle
Chapter 5: Using a database in our tests PDF ePub Kindle

If you’re interested in what’s coming up, I plan to release another chapter next week that parses and creates XML in our tests. After that I will release a new version of these chapters using a new example application. After that…

Outline

I’ve had several people ask me for a full outline for my book. Here are the chapter titles and brief description. This is all subject to change of course.

1. Introducing Acceptance Testing: 
This chapter will begin with a discussion on what is wrong with the way we typically test software today. It will point out the waste/rework caused by testing software after development and duplication caused by writing detailed test plans. It will then turn the focus on acceptance test driven development and demonstrate the efficiencies gained by adopting this practice. It will conclude with a description of how acceptance test driven development effects the entire process of delivering high quality software.

2. Installing the software: 
This chapter takes the reader through the process of installing Ruby, cucumber and a few additional gems, and an evaluation copy of RubyMine. Through the book I demonstrate how to do the activities through both the command-line and RubyMine.

3. Getting our feet wet with Watir: 
Watir is the foundation of my web testing strategy. In this chapter I introduce the reader to some basic Ruby concepts as well as taking them through the process of writing a few simple scripts using Watir. Along the way we also introduce a few design concepts to help us keep our code clean and maintainable. This is one of the two sample chapters I am including in this proposal

4. Getting started with Cucumber
: We finally introduce the reader to cucumber. We also introduce more Ruby concepts including classes. After writing a few basic scenarios and scenario outlines we turn our focus to writing more robust scenarios with page objects and default data. We conclude the chapter by discussing what level of granularity to use when writing scenarios.

5. Using a database in our tests: 
Frequently we need to stage or read data for out tests. In this chapter we introduce ActiveRecord as well as a few additional gems (factory_girl and pickle) to make this task easier. We do this by writing a couple of Scenarios against the database for our example web application and then enhance it by adding additional gems and techniques. We also demonstrate how our default data pattern from the previous chapter is applicable to this testing area.

6. Testing XML: 
Producing or validating XML is a common task for testers. This chapter introduces a couple of gems to help with this task. We end the chapter by creating scenarios that can create an XML contact list and then other scenarios that can verify the content of that list.

7. At your service: 
Service oriented architectures are still very popular. In this chapter we write a feature that specifies a web service that stock quotes. The scenarios will test both a restful and soap version of this service.

8. Ready for Web 2.0
: Testing applications that have a lot of javascript and ajax calls introduces a new set of challenges. We tackle these challenges head on by writing scenarios against an ajax version of our example web application. We finish the chapter by writing an extension to the Watir gem that allows us to test drag-and-drop.

9. Going Mobile: 
Most people still manually test their mobile applications. In this chapter we introduce iCuke to test an iPhone application. We also demonstrate how the page object and default data patterns apply to this type of testing.

10. Hanging out with the natives: 
Sometimes our tests need to make calls into libraries written in compiled languages. This chapter will begin writing scenarios to test the functionality of a library written in C. We will then proceed by using the gem ffi to create a wrapper around the library to enable us to make direct calls. Next we will write a higher level domain specific language to make our calls simpler. We will finish by using the DSL in our step definitions to complete the tests.

11. I’ve lost my head: 
In this chapter we will write the Scenarios for an application that reads data from a set of tables, performs some data transformation, and then writes the data into another set of tables. A secondary focus will be on how do you test an application when you can’t see it run. We will also build upon some of the design patterns we introduced in previous chapters.

12. Mocking processes: 
What do you do when the software you are testing needs to talk to hardware? What do you do when you application talks to a web service that doesn’t exist yet? This chapter focuses on creating surrogates for volatile or missing components in order to facilitate testing now.

Appendix A: Watir Quick Reference

Appendix B: RSpec Matcher Quick Reference

One thought on “Using the database in our tests

  1. Pingback: Tweets that mention Using the database in our tests | CheezyWorld -- Topsy.com

Leave a Reply

Your email address will not be published. Required fields are marked *