Giter VIP home page Giter VIP logo

karate-crudtesting's Introduction

karate-crudtesting

This project basically covers the CRUD scenarios(POST, GET, PUT & DELETE) on REST api using karate framework and I have used Maven as build & Cucumber as reporting tool.

Features

  1. Create or POST operation is performed where the request payload is read from a resource folder, response is printed and validated.
  2. Read or GET operation is performed and the response is printed and validated.
  3. Update or PUT operation is performed where the request payload is read from a resource folder, response is printed and validated.
  4. Delete or DELETE operation is performed and the response is printed and validated.
  5. Also, we can execute all the scenario at once. Reports are generated at the end of every scenario execution.

Maven

I have used Maven as build tool.

So we need two :

com.intuit.karate karate-apache 0.9.4 test com.intuit.karate karate-junit4 0.9.4 test

IntelliJ

I have used IntelliJ as IDE for this project

Folder Structure

As it is recommeded for karate framework to keep .feature file and .java file in same folder so I followed the same and created this structure.

The Maven tradition is to have non-Java source files in a separate src/test/resources folder structure - but we recommend that you keep them side-by-side with your *.java files. When you have a large and complex project, you will end up with a few data files (e.g. *.js, *.json, *.txt) as well and it is much more convenient to see the *.java and *.feature files and all related artifacts in the same place.

This can be easily achieved with the following tweak to your maven section.

src/test/java **/*.java ...

With the above in place, you don’t have to keep switching between your src/test/java and src/test/resources folders, you can have all your test-code and artifacts under src/test/java and everything will work as expected.

Test Execution

We can tes scenarios individually as well as we can use terminal to execute all the scenarios at once using mvn clean test command in terminal. It will generate a detailed cucumber report of all executed scenarios

Command Line

Normally in dev mode, you will use your IDE to run a *.feature file directly or via the companion ‘runner’ JUnit Java class. When you have a ‘runner’ class in place, it would be possible to run it from the command-line as well.

Note that the mvn test command only runs test classes that follow the *Test.java naming convention by default. But you can choose a single test to run like this:

Test Reports I have used cucumber to generate reports for this project where as we can see karate generated default reports as well.

karate-crudtesting's People

Contributors

ahmed-zia-siddiqui 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.