You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ReadMe.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,26 @@
2
2
3
3
In this tutorial you are going to learn <b>How to Automate the API Tests</b> using <b>RESTAssured Library</b>
4
4
5
-
This project contains automated api tests explained step by step. The tech stack used for this project are:
5
+
This project contains automated API tests explained step by step. The tech stack used for this project are:
6
6
1.**JAVA** as the programming language for writing test code
7
-
2.**TestNg** as framework
7
+
2.**TestNg** as the framework
8
8
3.**Gradle** as the build tool
9
9
4.**IntelliJ** as the preferred IDE for writing java code.
10
10
11
11
#### Getting Started
12
12
Setup your machine.
13
13
1. Install JDK 1.8
14
14
2. Install IntelliJ (Community edition is fine)
15
-
3. Install gradle
15
+
3. Install Gradle
16
16
17
17
#### Cloning & Importing the Project
18
18
1. Clone the project from ```git clone https://github.com/vinaykumarvvs/api-automation-tutorial.git```
19
-
2. Import the project (api-automation-tutorial) in IntelliJ ```File -> New -> Project from Existing Sources -> Browse Project Location -> build.gradle```
19
+
2. Import the project (API-automation-tutorial) in IntelliJ ```File -> New -> Project from Existing Sources -> Browse Project Location -> build.gradle```
20
20
3. Now click on ```auto import -> Ok``` wait until the IntelliJ downloads all the dependencies
21
21
22
22
#### Running tests
23
23
``Note:`` For 2nd & 3rd steps, you need to follow this way ```OpenTerminal/CMD -> cd <change-to-project-location>```
24
-
1. You can run the tests directly from the IntelliJ, by rightclicking and **Run test**..
24
+
1. You can run the tests directly from the IntelliJ, by right-clicking and **Run test**.
25
25
2. For Linux/Mac users: ```gradle clean build runTests```
26
26
3. For Windows users: ```gradlew clean build runTests```
27
27
@@ -30,15 +30,13 @@ Setup your machine.
30
30
## Tutorial Begins
31
31
32
32
### PetStore - Swagger
33
-
Through out this tutorial I am going to use [PetStore-Swagger](http://petstore.swagger.io/). <b>PetStore - Swagger</b> is the open source project
34
-
which has very good documentation with various number of examples.
33
+
Throughout this tutorial, I am going to use [PetStore-Swagger](http://petstore.swagger.io/). <b>PetStore - Swagger</b> is the open source project which has very good documentation with the various number of examples.
1.**[Test-1](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/FirstChapterTests.java):** Send a get Request of an API and validate the body
38
37
2.**[Test-2](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/FirstChapterTests.java):** Send a get Request of an API by passing the Query Parameters in the URL itself
39
-
3.**[Test-3](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/FirstChapterTests.java):** Send a get Request of an API and retrieve the data from body
38
+
3.**[Test-3](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/FirstChapterTests.java):** Send a get Request of an API and retrieve the data from the body
40
39
4.**[Test-4](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/FirstChapterTests.java):** Send a get Request of an API and store the Response
1.**[Test-1](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter02/SecondChapterTests.java):** Optimized way to send the Request and receive the Response
44
-
42
+
1.**[Test-1](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter02/SecondChapterTests.java):** Optimized way to send the Request and receive the Response
Copy file name to clipboardExpand all lines: src/test/java/Chapters/Chapter02/Chapter02.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,27 +5,27 @@
5
5
* If you are reading this line then you are good to go. Let's get started with the <b>Second Chapter</b>
6
6
7
7
#### **Before getting into the Tests**
8
-
These are the things we have done in the <b>First Chapter</b> that are not recommended. In a layman approach we can simply say <b>First Chapter</b> is very tightly coupled.
8
+
These are the things we have done in the <b>First Chapter</b> that are not recommended. In a layman approach, we can simply say that <b>First Chapter</b> is very tightly coupled.
9
9
1. Hard-coded the `BASE_URL`
10
10
2. And if you observe, in every test we are repeating the same lines of code like `given|when|then|get..` for the same functionality.
11
11
12
12
#### **Agenda for this Chapter**
13
-
Now in this chapter we are going to optimize the code what we have used for <b>First Chapter</b>, by doing this anyone can easily
13
+
Now in this chapter, we are going to optimize the code what we have used for <b>First Chapter</b>, by doing this anyone can easily
14
14
read and maintain the code.
15
15
16
16
#### **Optimizing**
17
-
In order to optimize the code we have introduced the following Java Files.
17
+
In order to optimize the code, we have introduced the following Java Files.
18
18
1.[PropertiesReader](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/utils/PropertiesReader.java) - It is used to read the URL's from the Properties file.
19
19
2.[ResourceHelper](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/utils/ResourceHelper.java) - This Java file is used to implement all <b>HTTP Methods</b>
20
-
3.[BaseTest](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/utils/BaseTest.java) - Every test needs to extend this Java File. In this file we can have `Hooks|CommonsMethods`
20
+
3.[BaseTest](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/utils/BaseTest.java) - Every test needs to extend this Java File. In this file, we can have `Hooks|CommonsMethods`
21
21
22
-
```After introducing the above files we can clearly say that, our project is loosly coupled and easily maintainable```.
22
+
```After introducing the above files we can clearly say that our project is loosely coupled and easily maintainable```.
23
23
24
24
This Chapter consists only tests
25
25
1.**Test-1:** Optimized way to send the Request and receive the Response
26
26
27
27
#### Summary
28
-
These are the following things we have learnt from [Chapter 1](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/Chapter01.md)
28
+
These are the following things we have learned from [Chapter 1](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter01/Chapter01.md)
29
29
and [Chapter 2](https://github.com/vinaykumarvvs/api-automation-tutorial/tree/master/src/test/java/Chapters/Chapter02/Chapter02.md)
30
30
1. How to send the Request and receive the Response.
31
31
2. How to separate the code based on their functionality `Single Responsibility Principle`.
0 commit comments