REST testing with jMeter

Testing RESTful application is very simple with jMeter. In the first part of the tutorial in this series, the basics are shown. As requests can be created and evaluated. The request going to http://httpbin.org.

Preconditions

  • JAVA is installed
  • jMeter is installed

Steps

Create new “Thread-Group” on “Test Plan” (Add – Threads (User) – Thread Group)

jmeter thread group

Now add one “HTTP Request” inside the “Thread Group” (Add – Sampler – HTTP Request)

jmeter http request

Inside the “HTTP Request” we add now a “HTTP Header Manager” (Add – Config Element – HTTP Header Manager). For configuring we add the Name/Value – “Content-Type”/”application/json”.

jmeter http header manager

At the end we add the “View Results Tree” on “Thread Group” (Add – Listener – View Results Tree)

jmeter view results tree

Our first request example will be a “GET”. On HTTP Request we add following values.

  • Server Name or IP: httpbin.org
  • Method: GET
  • Path: /ip
  • Implementation: HttpClient4
  • Follow Redirects: yes
  • Use KeepAlive: yes

jmeter get request

After save we can start the first run. How to see result will show later. Now second request with POST example. For this we modify the HTTP Request with following values.

  • Method: POST
  • Path: /post
  • Send Parameters With the Request: {“firstName”:”harry”;”lastName”:”Hirsch”}
  • Include Equals?: yes

jmeter post request

Now save and run again. On View Results Tree we can check the results for every http request (Sampler results, Request, Response data).

jmeter rest results

For the JSON response, switching from Text to JSON view. The same way can used for PUT, DELETE or other requests.

Layer 3 discovery with Ping

If ICMP (Internet Control Message Protocol) is not blocked – the ping command is one of my most used tools.

Example

Usage

With a small bash-script it is possible to identify all hosts that respond to ICMP requests.

 

Jenkins and jslint4java

This tutorial shows a very simple Jenkins – jslint4java integration over Shell.

Preconditions

  • Jenkins is installed

Steps

Start Jenkins, open the browser (http://<host>:8080) and setup a new “Free Style Project” (JS-Lint-Example).

Jenkins Freestyle Project
The tutorial does not use any VCS, so we press the “Build Now” button to create the project “workspace” folder. After successful creation, we create 3 new folders (src, lib, build) inside the workspace folder.

Now upload the jslint4java into the “lib” folder.

It`s time to test if jslint4java is running. The 1st test in terminal self.

The 2nd test direct on Jenkins. Open the “JS-Lint-Example” job in browser – press link “Configure” and we create a “Build-Step” with “Execute Shell”.

Jenkins JSLint Test

After save and build the “Console Output” of the respective build should show the help. If there is a problem here, please check if Java is installed and the file permissions are correct. If everything works fine we create a simple JavaScript file and upload this into the “src” folder.

Now we change the “Execute Shell” command and add the “Post-Build-Action” – “Publish JUnit Test Results” with value “build/js_report.xml”.

Jslint Jenkins Configuration

Ready,… after save and new build we can see the file “js_report.xml” into “build” folder and the jUnit  report into our project.

Jslint Jenkins jUnit Report

Wireshark and OS X Yosemite

Since X11 is no more included, you need XQuartz to run Wireshark on Yosemite. Wireshark is expecting XQuartz (X11) to be inside the folder “/usr” but it is now under “/opt”. With a symbolic link you can solve it easily.

After install and create symbolic link you download can install Wireshark. Now you can start Wireshark.

Note: The start may take some time.

Robot Framework and Selenium-Grid 2.0

This small tutorial shows, how to run a generic Robot Framework test with Selenium Grid.

Preparation

Steps

Now we create a very simple test

Now start the Selenium Grid (Hub and Node)

Note: The actual version for selenium-server-standalone may be different!

Open the browser http://localhost:4444/grid/console and check the node is registered. This step can be skipped, just to be sure.

In the last step we start the test. Open a 3rd terminal, browse to the folder and start the Robot Framework.

If everything works well, the output should look like this:

 

 

Command line SQLite recipes

As a software tester you get in touch with SQLite? Here are a few recipes that make your work easier.

Backup SQLite

Create a copy of the entire database

Create copy of a specific table

Create copy of specific table as CSV or HTML

Create SQLite

Create database from sql file

Select query from Terminal

Merge sqlite tables with same schema

Imagine there are two databases (db_1.db and db_2.db) with tables (myTable) in same schema. Now we merge the content of table “myTable” from database “db_2.db” into “db_1.db”.

Interrogating the Whois servers

Whois servers hold information about domain names,  IP addresses and other relevant information. In a penetration test, you might need this information. With the Whois protocol you can simply query this data.

Fast PHP server

Since PHP 4.x, there is a CLI SAPI web server. As a tester you simply go to the folder and start the server.

Example

Now start your browser and insert the URL “localhost:8100″. With “Ctrl+c” you can stop the server.

Extended