Code Monkey home page Code Monkey logo

freechargeassignment's Introduction

FreechargeAssignment

This framework is developed to test GitHub Teams API and Front End Testing as well.

Specifications

  • Gradle: v5.6.2
  • TestNg: v7.1.0
  • RestAssured: v4.3.0
  • Extent Reports: v2.41.2
  • JSON Simple: v1.1.1
  • Log4j: v1.2.17
  • Selenium Java: v3.141.59

Features of JARs used to develop the framework

  • Gradle as build tool (A basic building block for CI/CD)
  • TestNg for developing exhaustive tests
  • RestAssured as the interface to automate Rest endpoints and related tests
  • Extent Reports for HTML reporting
  • JSON Simple to read and write JSON Object during REST call
  • Log4j for textual logging
  • Selenium Java to automate and interact with Front end based on JSONWireProtocall

Project Structure

The code base of above project is divided into two folders as per gradle division, src/main/ & src/test/. Let's understand the working of each class written within the folder:

src/main

It contains package within java folder: com.project.freecharge.utilities. There are two classes available within this package: Configuration.java and RestUtility.java. There is a resource folder within src/main where config.properties are kept.

Configuration.java

This class is used to read value of all the properties written inside config.properties. It uses encapsulation and gives getters to read the properties values. These proeprties values are used throughout the project wherever required.

RESTUtility.java

This class contains all the static methods which is used to perform REST calls, like GET, POST, PUT, PATCH, and DELTE. Apart from these operations, there are methods to perform other operations like getting response, status code, setting and resetting BASE URL, etc.

resources/config.properties

This file contains all the properties like access token, media types, etc which are used at project levels. This file is accessed by Configuration.java class.

src/test

It also contains package within java folder: com.project.freecharge. This package have two sub-packages which are- controller & test. Controller sub-package contains APITestBed.java, BaseTest.java & MyListeners.java classes, whereas, test sub-package contains all the test cases built with TestNG. So it mainly contains TestNg classes like BewkoofTest.java & GitHubTeamApiTesting.java. Further, resources folder contains four sub-folders which are-

  • Container
  • JsonBody
  • PostJsons
  • Suite

Let's understand each classes and folders.

BaseTest.java

This class contains all the common methods which are used by all the test cases. It contains methods to set up browser for front end testing, report generation and closing, tear down methods, etc.

APITestBed.java

This class contains @BeforeSuite & @AfterSuite annotations, which mainly sets & resets the BASE URI. It extents BaseTest.java class to re-use the test level common methods.

MyListeners.java

This class extends ITestListener interface which is used for auto logging and reporting the testing events like failure, success, test startups, test end process, etc.

GitHubTeamApiTesting.java

This is TestNg class which contains all the test for GitHubTeams API testing. The tests are written within @Test annotation. Those tests are grouped by Positive Test and Negative Test and their priority of execution are set.

BewkoofTest.java

This is another TestNg class which contains test for front end testing of Bewkoof.com. The development of this test is currently in progress.

resources/Container folder

This folder contains all the third party plugins like chromedriver.exe.

resources/JsonBody folder

This folder contains Json files which are mainly gathered by using GET call of REST API. It contains only those json body whose values are set as parameter for another methods at runtime like getting project id.

resources/PostJsons folder

This folder contains all the JSON files which are used to perform POST call of REST API, like editing a team, creating a new team, etc.

resources/Suite folder

This folder contains two testng.xml files. First, apitsuite.xml contains test class for GitHub Teams API testing. Second, frontendsuite.xml contains test class for front end testing. The configuration of these two xmls are done inside build.gradle file as test task which uses useTestNg() method.

ExecutionLog.log

This file is stored inside the root directory of the project. It stores all the logs generated during test exeuction and it is directly configured with log4j.xml file.

TestReport Folder

This folder contains all the HTML reports generated by Extent Report and it is stored in root directly of the project.

How to execute API Tests?

Go to src/test/resources/Suite/apisuite.xml, Right click and Run. So, API tests are executed either from apisuite.xml file or directly running that Testng class file which is stored inside test sub-package of src/test/java folder.

How to execute Front End Tests?

Go to src/test/resources/Suite/frontendsuite.xml, Right click and Run. So, Front end tests are executed either from frontendsuite.xml file or directly running that Testng class file which is stored inside test sub-package of src/test/java folder.

Alternative way to execute the tests?

  1. Go to build.gradle file and directly run runApiTest() task to execute API test suite and run runFrontEndTest() task to execute frontend test suite.
  2. Use terminal and run command gradle runApiTest for executing API test suite and gradle runFrontEndTest for executing front end test suite.

freechargeassignment's People

Contributors

inviul avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.