Gatling saying Class not found The requested class 'com.xxxxx.performace.test.gatling.UserCreationSimulation' can not be found in the classpath or does not extends Simulation.

Hi All

BackGround:Bit new to Gatling and scala thing,so excuse me if I ask stupid question.

Objective:TO performance test our API endpoints on Google Cloud Server(VM).

Tools:Gatling and writing a custom scala code to test end points.

package com.enwintra.performace.test.gatling

import io.gatling.core.Predef._

import io.gatling.core.scenario.Simulation

import io.gatling.http.Predef._

class UserCreationSimulation extends Simulation {

val httpEndPointConf = http.baseURL(“”).acceptHeader(“application/json”)

val scn = scenario(“UserCreation”).exec(PerformanceTaskCreation.createUser)

setUp(scn.inject(rampUsers(10000) over (10))).protocols(httpEndPointConf)


package com.xxxx.performace.test.gatling

class User{

var email:String=_

var username:String=_

var password:String =_


package com.enwintra.performace.test.gatling

import io.gatling.http.Predef._

import io.gatling.core.Predef._

object PerformanceTaskCreation {

val createUser = exec(



.header(“Content-Type”, “application/json”)




package com.enwintra.performace.test.gatling

import scala.util.Random

import com.enwintra.performace.test.gatling.User


object GenerateUsers {

val users = Array(“bhanu”, “saagr”, “domil”, “bharat”)

val mails = Array(“”, “”, “”, “”)

def getRandomUser(): String = {

val randomUser = new User()

var index = Random.nextInt(users.length)

var randomuser = users(index)

var randomNumber = Random.nextInt();

var counter = Random.nextInt().toString()

var finalUser = randomuser.concat(counter)

var randomEmail = mails(index)

var finalmail = randomEmail.concat(counter) = randomEmail

randomUser.password = “123456”

randomUser.username = randomuser

val json= new Gson

val userJson=json.toJson(randomUser)

return userJson


Above is the code I wrote to performance test API on GCP VM.


apply plugin: ‘java’

apply plugin: ‘scala’

repositories {



dependencies {


compile group: ‘’, name: ‘gson’, version: ‘2.8.5’

implementation ‘’

testImplementation ‘junit:junit:4.12’


task testLoad(type: JavaExec) {

description = ‘Test load the gaming api’

group = ‘Load Test’

classpath = project.sourceSets.test.runtimeClasspath

jvmArgs = [




main = ‘’

args = [

‘–simulation’, ‘com.xxxx.performace.test.gatling.UserCreationSimulation’,

‘–results-folder’, “${buildDir}/gatling-results”,

‘–binaries-folder’, sourceSets.test.output.classesDir.toString()



def logbackGatlingConfig() {

return sourceSets.test.resources.find { == ‘logback-gatling.xml’};


I am building this project and running task on one of GCP Machine

Linux test-instance 4.15.0-1018-gcp #19-Ubuntu SMP Thu Aug 16 13:38:55 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The requested class ‘com.xxxx.performace.test.gatling.UserCreationSimulation’ can not be found in the classpath or does not extends Simulation.

can anyone guide as to how this problem can be solved.