rohinegi548 / ACExercise

ACExercise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AC Exercise - Demo of API Tests - Sample Framework

  • This framework contains API Tests structure written based on Cucumber-BDD (Gherkin) pattern
  • SanboxApiValidation.feature file under com.api.features package contains Feature definition which includes the Validation scenario (containing all steps)
  • stepDefinitions.java file under com.api.stepdefinitions package contains the implemented methods/functions which are mapped to the steps writtern in above feature file. It also contains Hooks.java class which is a kind of ability to run something before or after scenarios based on any defined tags.
  • com.api.runner package contains 'TestRunner' class which contains the cucumberoptions to map - features, stepdefinitions, plugin for report and any other option to generate step definition methods/functions.
  • com.api.resources package contains several classes and files to generate logs, enums for API endpoint resources, Request specification utilities, property files and config file for log4j. ApiGlobal.properties file contains the base URI for API. ApiResStatCodes.java contains the API endpoint resource path based on HTTP methods that are called in step definition methods.
  • allure-resources folder contains file generated during execution of tests to create report

Pre-requisite

  • Java, maven, and allure should be installed on system and should be configured on PATH

Basic structure can be seen in below screenshot

image

Some important information about files and folders

  • POM.xml contains all dependencies, plugin, report plugins etc and main entry point of execution of Apitests.xml TestNG file.
  • runallure.bat file is used in maven plugin to fire based on 'verify' goal to generate consolidated allure report for tests.
  • logs folder will contain - "All.logs", "APIExecution.logs" files which contains some sample logs I've captured while executing the tests (generated log files you can access in directory i've added for your reference). I've just shown an overview to generate logs.

image

image

image

image

  • reports folder is the container of generated reports including Allure and other Cucumber reports. You'll be able to see on server only but don't worry all is in place you just need to go through below steps. Logs have been printed on console and allure report as well

-> To run this on your system, clone the repo and install all pre-requisites and navigate to repository directory and open cmd and fire command - mvn clean test verify. This will fork maven to clean the required directories, compile and test, then generating reports for you and open report folder in browser.

image

image

image

image

image

image

image

image

image

image

image

image

image

image

About

ACExercise


Languages

Language:HTML 86.1%Language:JavaScript 6.2%Language:CSS 4.7%Language:Shell 1.1%Language:Java 0.8%Language:Batchfile 0.7%Language:Gherkin 0.3%