Skip to content

dannyhdyt/DannyHidayat-API-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Automation Practice

selenium selenium

Overview

This repository contains API automation scripts developed using Karate-JUnit5 Framework in Java, to test the functionalities of the Pet Store API available at Swagger Pet Store.

Getting Started

Prerequisites

  • Java Development Kit (JDK) 11.0.20 installed
  • Maven build tool installed

Folder Structure

  • src/test/java: Contains the Karate test scripts java runner.

    src
    └── test
        └── java
            ├── com
            │   └── api
            │       └── automation
            │           ├── 1postCreateUser.feature
            │           ├── 1postCreateUserWithList.feature
            │           ├── 2getLoginRequest.feature
            │           ├── 2getLogoutRequest.feature
            │           ├── 2getUserNameRequest.feature
            │           ├── 3putUpdateUser.feature
            │           ├── RunAllTest.java --> to run all test
            │           ├── Runner.java --> run single test
            │           └── deleteRequest.feature
            ├── karate-config.js
            └── logback-test.xml
    
  • target: Generated reports and logs.

      target
      ├── karate-reports 
    

Dependency Configuration

Add the following to your pom.xml <dependency>

<!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-junit5 -->
<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-junit5</artifactId>
    <version>1.4.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.12.0</version>
</dependency>
<dependency>
    <groupId>com.github.java-json-tools</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>2.2.14</version>
</dependency>

How to Use

  1. Review the test scripts available in src/test/java.

  2. Run the JUnit Runner file directly from the IDE, I'm using IntelliJ IDEA, or run using the terminal using this command

    mvn test -Dtest="Runner"

    This is for running all the karate .feature file

    mvn test -Dtest="RunAllTest"
  3. By integrating with the JUnit framework we can quickly see what failed and the corresponding error message without having to dive into logs / HTML reports, with Karate will also create a .html report

    report

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published