If you are a Software Test Engineer or Quality Control Engineer and you want to automate your API call tests, then you should try RSpec (Ruby’s testing framework). I didn’t exactly chose it (the QC team was already using it), but I tend to believe that I would have picked it in the future for my own tests because when it comes to the installation of the program, the process is not that complicated at all.

Actually, let me show you how little you need to do in order to start writing your own tests:

Yep, that’s all. Now you can automate your tests and run them with the following command:

I will now show you some common error messages that I’ve encountered, so that you can avoid them during your work. These errors are caused by very small mistakes, but usually in the rush of delivering quality we skip some things or words.


1. syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)

Let’s take a look at the following examples:

So, if you get the above error, you most probably forgot to put a ‘do’ after ‘describe’ or ‘it’ methods.


2. syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)

I will use the same example again:

What is wrong with this? Well, I missed an ‘end’. I’ll take it you can figure out by yourself where it should be placed.


3. JSON::ParserError: 757: unexpected token

Take a look:

Supposedly, sometimes you will get as an answer a JSON and you will want to parse it for better tests. You will get the above error if the answer is not a JSON and the parser can’t find there what it expects.

I hope you will find this short guide useful, I plan to continue writing about common errors that we may encounter while using RSpec.