Skip to main content

Performance testing with Karate Gatling

What is Karate Gatling? Github page of this project has the tag line API performance testing made simple . Simply put this should help in performance testing of the api test written using Karate by leveraging performance testing capabilities of karate. On reviewing the documentation available on GitHub following capabilities are listed: Re-use karate tests as performance tests executed by Gatling Gatling and scala required only for defining the load model Everything else can be defined in Karate  Karate assertion failure also appear in the Gatling report Anything that can be written in Java can be performance tested. Option to scale out over multiple hardware nodes or Docker containers In this post we will see how to reuse Karate tests for execution using Gatling We will see step by step on how to setup Karate Gatling performance tests. There are a few prerequisites for setting up your karate Gatling tests. Prerequisites: JDK should be installed and availabl...

Karate zip release | running your tests using jenkins

Some time back there was a question on my youTube channel related to using Jenkins along with Karate's zip release version. So I did a POC to explore the possibility and found that Jenkins can be used when using Karate's zip release version.


Problem Statement:

Can Jenkins be used to run the tests when using the zip release version of Karate.

Pre-requisites:

  • Java should be installed on your system
  • Jenkins should be available

    How to run Karate tests in Jenkins?

    • Launch Jenkins
    JenkinsHomePage

    • Create a new Project by clicking on New Item
    • Then enter a name
    • Select 'Freestyle project'
    • Click on OK
    • In the subsequent screen scroll down to the build section
    • For windows OS
      • Select Execute Windows batch command
    • For Linux
      • Will cover in a separate post 
    Select Execute Windows batch command

    • Enter the following command inside the text area
    D:
    cd D:\karateZipRelease\karate-1.2.0.RC1
    karate D:\karateZipRelease\karate-1.2.0.RC1\src\demo\api

    • So the above command would first change the drive to D. 
      • This is where I've my files
    • Then the next command would change the directory to where the karate.jar file is located
    • Then the last command uses the keyword karate followed by the path to directory which contain the api tests
      • For the purpose of this POC, I'm using the demo api tests already included in the zip release version.
      • The last line in the command can be modified to run individual tests too, 
        • This can be achieved by merely changing the path to point to the Test instead of an directory
    • Next, click Apply and save
    New Project screen
    • Now Click on Build Now link in the Left pane
    Click Build Now
    • Under Build History you'll see that the execution has started
    • Click on the Link (#1) under this section
    • Click on Console Output to view the details
    • Since I've run all the tests in the directory, the console output was too big to be taken as a single screen print.
      • I've displayed below the top and bottom part of the output 
    Console Output - Top part

    Console Output - Bottom part

    A special mention and THANKS to all those lovely people who keep sending their queries, your queries help me learn too :-)
    Please do keep sending the queries. I'll try to post answers to those as soon as I get time to explore them. Thank you for your patience.

    Comments

    Popular posts from this blog

    Getting started with karate-config.js

    In this post we will see how to add an configuration file (karate-config.js) to our sample karate project. This configuration file is similar to the properties file that you would have used for other automation projects.  I'll be using the Karate-Zip release version for this post too. Still unaware about it, check out my last post . When using the config file we need to understand a few basics about it: When Karate starts-up it expects a file called karate-config.js in the classpath This config file should be a Javascript function . The function is expected to return a json object All Keys and values in the json object will be made available as script variable So what is classpath when using the Karate Standalone Jar or the Zip release version of Karate? To understand this lets open the karate.bat file and try to see what it contains, it has this command java -cp karate.jar;. com.intuit.karate.Main %* So com.intuit.karate.Main is the entry point for the Karate command line app A...

    Karate - Quick Start with Maven Archetype

     What is Karate? Karate enables you to script a sequence of calls to any kind of web-service and assert that the responses are as expected.  Karate provides an easy to use DSL which natively supports json and xml. Karate is not just limited to API automation. After the initial releases which supported API automation, now the capabilities include Performance testing, UI  automation, Desktop automation (a release candidate was made available just a few weeks ago with this capability). Why Karate?  Is based on the popular Cucumber / Gherkin standard, and IDE support and syntax-coloring options exist  You can run tests and generate reports like any standard Java project. But instead of Java - you write tests in a language ( DSL ) designed to make dealing with HTTP, JSON or XML Java knowledge is not required and even non-programmers can write tests Embedded JavaScript engine that allows you to build a library of re-usable functions  Gherki...

    Performance testing with Karate Gatling

    What is Karate Gatling? Github page of this project has the tag line API performance testing made simple . Simply put this should help in performance testing of the api test written using Karate by leveraging performance testing capabilities of karate. On reviewing the documentation available on GitHub following capabilities are listed: Re-use karate tests as performance tests executed by Gatling Gatling and scala required only for defining the load model Everything else can be defined in Karate  Karate assertion failure also appear in the Gatling report Anything that can be written in Java can be performance tested. Option to scale out over multiple hardware nodes or Docker containers In this post we will see how to reuse Karate tests for execution using Gatling We will see step by step on how to setup Karate Gatling performance tests. There are a few prerequisites for setting up your karate Gatling tests. Prerequisites: JDK should be installed and availabl...