Objective: RESTFul API Test cases and Test automation using ** Karate**
- This work helps to understand what is karate framework (open source tool) and how it help's to test restful webservices (
QA perspective
). - I have used ** imgur account and its webservices**
- Test CRUD operations.
- In this project work I have automated basic CRUD operations, and considered only positive cases.
- This work is restful webservices testing.
-
Get new user account with
imgur.com
-
Next, You need an fake or real application. Do not worry if you don't have one.
-
You can use
https://www.getpostman.com/oauth2/callback
. consider this as your application. -
Now, register the
url
withimgur
. see this link imgur -
Go to
REGISTRATION QUICKSTART
section of the above page. -
Follow the steps as shown.
-
You will have new
Client ID
andClient Secret
. -
You can also see the
Client ID
andClient Secret
inimgur
website under user account settings section. -
You need this two
Client ID
andClient Secret
to use imgur webservices, meaning, you can do post, get, put or delete operations. -
This how your
imgur
user account settings will look like. see below image:
-
Next, please follow
Download code
section (see below), and then open feature fileoauth2.feature
which is undersrc\test\java\demo\oath
package. -
Replace
Client ID
andClient Secret
with your's. -
Replace
username
andpassword
with your's. Note, these two will be yourimgur
user credentials.
- java 8
- karate open-source tool
- maven
- junit 4
- windows 10 OS
- cucumber-reporting
Do git clone for downloading the project to your local machine and then import project to your IDE.
Install with git:
$ git clone https://github.com/kodlist/restful-test-automation.git
-
You can use git bash or any choice of shell.
-
Go to your project directory from terminal and hit below command:
$ mvn test -Dtest=DemoTestSelected
- Test results or reports can be found in
cucumber-html-reports
folder which is undertarget
directory.
- in progress...
I have separated api
to respective feature files and I consider them as called
feature files, in other words, the test feature files e2e
feature will call
api
feature file. see below image;
- During this design I have considered
Calling feature
andCalled feature
as fundamental principle, this helps my scenarios to be modular and easy to maintain.