Code Monkey home page Code Monkey logo

getting-started-with-karate's Introduction

getting-started-with-karate

Sample project to get started with implementing and running karate tests, in a structured fashion.

Results are published in junit, html and cucumber-reporting format

Running the tests with gradle command:

./gradlew test

Example

TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test

Running the tests as an uber jar:

Build the uber jar

  • Build an uber jar:

    ./gradlew shadowJar

  • The above command will create a jar in the upload folder with the name like: upload/getting-started-with-karate-0.0.1.jar

Running tests using the uber jar

  • Gradle command:

    • You can run the test using a gradle command:

      Example

        TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test
      
  • Uber jar:

    • You can run the tests using the same format as the ./gradlew test command:

      Example

        PARALLEL=3 TARGET_ENVIRONMENT=prod TAG=demo TYPE=api java -jar getting-started-with-karate-0.0.1.jar
      
  • Shell Script:

    • You can also run the tests using a script file using this command:

      Example

        PARALLEL=3 TARGET_ENVIRONMENT=prod TAG=demo TYPE=api ./runAPIWorkflowTests.sh
      

Configuration parameters

  • TARGET_ENVIRONMENT=... -> Run tests for specific environment. Data will be picked up accordingly from test_data.json
  • TYPE=[api | workflow] -> What type of test you want to run?
  • TAG=... -> What subset of tests you want to run? Ex: TAG=confengine will run all tests having the tag confengine
    • To run test with multiple tags specified, you can use a command like: TAG=@demo,~@sanity TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test

    • To run tests having tags as @tags OR @sample:

      TYPE=api  TARGET_ENVIRONMENT=prod  TAG=@tags,@sample ./gradlew test
      
    • To run tests having tags as @tags OR @sample AND exclude tags @demo2

      TYPE=api  TARGET_ENVIRONMENT=prod  TAG=@tags,@sample:~@demo2 ./gradlew test
      
    • To run tests having tags as @tags OR @sample AND exclude tests having either of the following tags: @demo2, @e2e

      TYPE=api  TARGET_ENVIRONMENT=prod  TAG=@tags,@sample:~@demo2:~@e2e ./gradlew test
      
    • PARALLEL=... -> What is the parallel count for the test execution. Default is PARALLEL=5

Guidelines

Read the Guidelines for writing tests in this framework

Machine setup

  • Install JDK 11 or higher
  • Install IntelliJ Idea Community Edition
  • Install the following plugins
    • .ignore
    • Cucumber for Java
    • Gherkin
    • SonarLint
    • Gradle
    • Maven
    • Groovy
    • Markdown
    • Properties
    • Shell Script
    • YAML
    • JUnit
    • TestNG
    • Git
    • GitHub
    • Terminal

Contact

Contact @BagmarAnand for help / information / feedback on this repo

getting-started-with-karate's People

Contributors

anandbagmar avatar namankhurana avatar

Watchers

James Cloos 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.