Trade Me-1-API testing first demo | Postman API automation testing

What’re the reasons for writing the series?

  • 1st, for testing skills demonstration.

The author wanted to demonstrate his comprehensive skills within API, UI, mobile automation testing domains through a series of automation testing practices sharing.

  • 2nd, for guiding those who are new to automation testing.

Choose a popular product to demonstrate its API automation testing process will be an easy way for the above people to quickly get started into the automation testing domain to save their time.

  • 3rd, for mutual boost and progress.

Testing technical structure for this practice

img

Panorama for this practice (large image here )

img

What’s next after this series?

This series mainly covers postman practice from business and API analysis, API testing script skills, API testing scenario, to CI process.

It’s only a tiny part of the full-stack testing.

After this series, the author will continue publish other automation testing practices. Such as:

Cypress + Cucumber UI automation testing practice,

Appium mobile automation testing practice,

JMeter + Grafana&Prometheus&InfluxDB performance testing practice,

Jenkins / Azure CI process,

Docker application.

Stay tuned.

What is Trade Me sandbox?

Trade Me is New Zealand’s largest online auction and classifieds website.

The Trade Me sandbox environment is a completely independent copy of the Trade Me website, API and database.

It is designed to allow you to test potentially destructive API operations in a safe environment.

Why choose the Trade Me?

When I want to choose a product to practice and display my automation demo, I will take some factors into my consideration:

  • Does this product is popular and widely used by the public?
  • Is the business complexity of this product enough for me to cover different types of testing practices?
  • Is there a clear enough specification for this product to allow me to develop my demo?
  • Can practicers who see my demo reproduce it in the same product environment?

Trade Me exactly fulfils all these above considerations for me.

Trade Me sandbox official materials

Preparation before API testing demo

1.Overview

  • Register a Trad Me sandbox user
  • Register your API application - get Consumer Key and Consumer Secret.
  • Get approved the Authentication - get OAuth Token and OAuth Token Secret.
  • Connectivity testing for verifying the authentication worked.

2.Register a Trade Me Sandbox User

3.Register your API Application

Log in -> View My Trade Me -> My Trade Me API applications -> Developer options -> Register a new application -> fill in the form and Register (get consumer key and consumer secret)

  • Gets the consumer key and consumer secret

If successfully registered, will get the consumer key and consumer secret.

4.Authentication

Authentication page with the consumer key and consumer secret clicks ‘Generate Token’ -> Allow

  • Generate an access token

Note: if you don’t give a right call back domain at the step of ‘Register a new application’, this generate token action will be failed like below page.

a referential call back domain can be https://developer.trademe.co.nz

a referential call back url can be https://developer.trademe.co.nz/callback

  • Allow your authentication

Trade Me first API demo connectivity testing

When we finished the preparation, we could pick two types of transactions to test the API connectivity.

The first transaction does not need authentication, and the second transaction needs authentication.

We will use the API testing tool Postman to verify the connectivity.

  • How to install Postman?

Postman installation refers to: How to install Postman?

  • All API domain in sandbox environment - api.tmsandbox.co.nz

Details see Testing your app

  • API - Retrieve general categories without authentication info

API - retrieve general categories reference

Using Postman tests the API connectivity

  • API - retrieve-your-watchlist with authentication info

API - retrieve your watchlist reference

Using Postman tests the API connectivity

Note:

When you do want to chain your upstream and downstream transactions, you may need self-assemble a network request.

Then you should note that one of the auth domain called oauth_signature, will be composed with below sub-domain

oauth_signature = Consumer Secret%26OAuth Token Secret

Copyright

This work is licensed under CC BY-NC-ND 4.0 .