TestMace
0.0.1-beta.24
Search
K

Getting Started

This guide will help you quickly get to know TestMace interface and its main features.
In this guide we're going to test a back-end server running the following scenario for post records:
  • request all records from the server;
  • add a new record;
  • check if the record was added correctly;
  • update the record and check the update with a server response;
  • request the updated record from the server;
  • check if the record on the server is updated;
  • delete the record;
  • check if the record was deleted from the server.
You'll need about 10 min to do that after running the app.

Installation

Go to our site https://client.testmace.com or use the following links to download TestMace:
Run the installer and follow the instructions. You will be prompted to choose an installation directory.
To install TestMace on Windows run the installer as an administrator.
Once the installation is complete, run the app. You'll see a new project.

Interface Overview

Your First GET Request

To make your first request create a new tab by clicking on +. При этом в зоне You'll see a new Scratch 1 node in the Scratches Area. Insert this address in the URL field: https://testmace-stage.herokuapp.com/posts. You can now test server response right from Scratches Area or add your scratch to the project. Rename the node to getPosts for convenience.
Note that all changes to the project are automatically saved in real-time.
Creating a GET request template
In your project create a Folder node named posts and move the scratch getPosts from the Scratches Area to the Project Area.
Creating a Folder node and GET request template moving
Double click on the created request getPosts to open it and then run it with the Run button.
Running a GET request
As you see, the request was successfully run, and you have a list of existing records in Response Area. Let's take a closer look at this window:

Request parameters

Here you can specify http headers and pass parameters to the request with the help of the autocomplete feature and variables.

Request type

  • GET — get a resource
  • POST — create a resource
  • PUT — update a resource
  • DELETE — delete a resource
  • PATCH — make some changes to a resource
  • OPTIONS — specify resource connection parameters

URL

The URL field supports autocompletion and using variables. We'll take advantage of these features later.

Make Request

Sending a request or a group of requests while running from the project root or a folder node.

Response area

A server response area. The Response Body tab contains parsed, JSON, and text representations of a response. On the tabs next to it you can see Response Headers and create or view existing Assertion nodes to make a request.

POST Request and Assertion

Now let's add a new post record to the server, and to do that we need to create a new RequestStep node.
A new node can be created in three different ways:
  1. 1.
    Create a Scratch by clicking on + and drag and drop it to the project later.
  2. 2.
    Right-click on the parent node and choose Add node -> Request step.
  3. 3.
    Click on the button Add project node-> Add node -> Request step.
Use any of these ways to create a node and name it createPost.
  1. 1.
    Set POST as its Request type.
  2. 3.
    Chose JSON on the response body tab and add {"title": "Testing post", "content": "Sendt via TestMace"}
  3. 4.
    Click on the RUN button and send the request.
You'll get a response telling you that the record has been successfully added, but we need to check if it was added correctly. And to do that we'll use the quickest way of creating Assertion nodes. We'll compare the sent data with the data received from the server.
In Response Area open the tab with the parsed response and right-click on the title value, that you passed in the request and choose Create Assertion -> Compare -> Equal. It'll create and open the Assertion node, and as you're not going to configure it, just close it. Create an Assertion node for the Content value in the same way.
Now send the createPost request, and you'll see that the test was successful. The task is really easy. Have a look at the animation below:
Sending POST request and creating an Assertion node

Dynamic Variables

To be able to interact with the newly added node you should pass its Id to all subsequent Request step nodes. Define a dynamic variable postId and assign to it the Id value, received in the record after running CreatePost.
  1. 1.
    Right-click on the Id value in the CreatePost node's response body.
  2. 2.
    Choose Assign to variable.
  3. 3.
    In a pop-up window choose the posts project directory as a node, enter the variable name (postId) and press OK.
To access the variable use a default variable $dynamicVar:
${$dynamicVar.postId}
Creating a dynamic variable

PUT Request

It's time we sent a PUT request. Let's access the previously created record using a dynamic variable ${$dynamicVar.postId} and update its title and content values.
  1. 1.
    Create a RequestStep node named updatePost.
  2. 2.
    Set PUT as its request type.
  3. 4.
    Body: {"title": "Testing post updated", "content": "Updated via TestMace"}
  4. 5.
    Send the request and, just like we did with the POST request, create two Assertion nodes to compare sent and received title and content values.
Creating a PUT request

Verifying Changes

In some situations you might want to additionally verify changes in the record, because the server may give a successful response of PUT, but sending a GET request you receive the old version.
To do that create a GET request at the record's URL using a dynamic variable.
  1. 1.
    Create a new RequestStep node named getPost.
  2. 2.
    Request type: GET.
  3. 4.
    Send the request and create 2 Assertion nodes to compare title and content values.
Verifying changes using a GET request

DELETE Request

Our next step is deleting our record at the provided URL using a dynamic variable.
  1. 1.
    Create a RequestStep node named deletePost.
  2. 2.
    Request type: DELETE.
DELETE request

DELETE Verifying

To ensure that the record was deleted from the server, create a GET request at that record's URL using a dynamic variable. We expect to get a 404 response from the server, and so we create an Assertion node:
  1. 1.
    Create a new RequestStep node named checkIfNodeExists
  2. 2.
    Request type: GET
  3. 4.
    Send the request, open the Assertions and add a new Assertion node, by clicking ADD. Set the node data:
    1. 1.
      Actual value: ${$response.code}
    2. 2.
      Operator: =
    3. 3.
      Expected value: 404
Verifying if the record was deleted via the server response

Summary

In the end we've got a test set for our server that we can run in a scenario. Just go to posts and click RUN.
Running a scenario

Video Instruction

Watch a video of the entire process of creating a scenario described in this guide.

Getting started code for a shared import

getting_started_shareCode.txt
8KB
Text
Getting Started Share Code

Download the Project

Unzip in the TestMace projects directory.
TestMace_getting_started.zip
7KB
Binary
Quick start project
Last modified 4yr ago