Hello Sir, Thank you for sharing this, this is very useful.. I have one question: Is any way to run parallel multiple Simulations instead of sequentially.
Banshi Sure, here is how you can write a Gatling Scala class to execute a karate runner class instead of the karate.feature file: ```scala import io.gatling.core.Predef._ import io.gatling.http.Predef._ import com.intuit.karate.gatling.Predef._ class MySimulation extends Simulation { val runner = karateRunner("classpath:my-karate-runner.class") val httpProtocol = http .baseUrl("www.mydomain.com") val scn = scenario("My Scenario") .exec(runner) setUp( scn.inject( constantUsersPerSec(10) during(10 minutes) ) ).protocols(httpProtocol) } ``` In this example, we are importing the `io.gatling.core.Predef` and `io.gatling.http.Predef` packages, as well as the `com.intuit.karate.gatling.Predef` package. We are then creating a class called `MySimulation` that extends the `Simulation` class. In the `MySimulation` class, we are defining a variable called `runner` that is a `karateRunner` object. The `karateRunner` object is used to execute the karate runner class. We are also defining a variable called `httpProtocol` that is a `http` object. The `http` object is used to configure the HTTP protocol that will be used to communicate with the website. We are then defining a scenario called `My Scenario`. The `My Scenario` scenario executes the karate runner class. Finally, we are setting up the simulation by injecting a constant number of users per second (10) for 10 minutes. I hope this helps
Hello, Raghav please can you prepare POM for playWright automation, you made me very familiar on selenium and Cucumber , but now I wish to know playWright,........I like your videos thanks
Hi sir ! 1) Could you please do a video on future of automation testing and software testing so many Developers and testers are coverting to Data science in recent times 2) is there any chance that sofware testing will be replaced with some other technologies in the future 3)Could you please differentiate wt will be the future and salary growth in Software testing vs data science which has more growth 4)As a software tester i would like to be work in testing field and i would also like to know is data science better than sofware testing( it it is then i will switch my carreer to data science ) .................Please reply sir your answer is much needed for me !
@@RaghavPal Hi sir some people are saying these are the only skills will have huge demand in the future .But there is No Software testing why ? some youtubers are mentioning this .what do you say 1. Blockchain 7:59 2. App Development 7:14 3. Cloud Computing 6:03 4. AI & Data Science 4:41 5. Big Data 2:41 6. Full Stack Development 1:56 7. DevOps 0:30 Other: Cybersecurity 9:13
Hi Jayasurya Here is the code to perform login operation into a url using Gatling: ``` import io.gatling.core.Predef._ import io.gatling.http.Predef._ class LoginSimulation extends Simulation { val httpProtocol = http .baseUrl("example.com") .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .connectionHeader("keep-alive") val scn = scenario("Login") .exec(http("Login") .post("/login") .formParam("username", "user") .formParam("password", "password") ) setUp( scn.inject(rampUsers(10) over (10 seconds)) ).protocols(httpProtocol) } ``` This code will first create a new HTTP protocol with the base URL of the web application. Then, it will create a new scenario called "Login". The scenario will have one action, which is a POST request to the "/login" endpoint. The POST request will include the username and password parameters. Finally, the code will set up the simulation and run it. The simulation will start with 10 users and will ramp up to 10 users over a period of 10 seconds. This code is just a basic example of how to perform a login operation using Gatling. You can customize the code to fit your specific needs and requirements. For example, you can add more actions to the scenario, such as a page visit or a form submission. You can also change the HTTP protocol to use a different protocol, such as HTTPS. I hope this helps
Hi Raghav, Thank you for all the videos . I am getting below error when I run mvn gatling:recorder . the same issue happening for mvn gatling:test as well . Could you please provide your suggestion. I googled it but didn't find proper solution. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE Here are my java,scala and mvn versions GatlingDemoProject2 % scala -version Scala code runner version 3.2.2 -- Copyright 2002-2023, LAMP/EPFL GatlingDemoProject2 % mvn -version Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584) Maven home: /opt/homebrew/Cellar/maven/3.9.0/libexec Java version: 19.0.2, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/19.0.2/libexec/openjdk.jdk/Contents/Home
Hi Ramesh, The error message "Could not create the Java Virtual Machine" usually occurs when the JVM (Java Virtual Machine) cannot allocate enough memory for your application. This can be caused by various factors, such as insufficient RAM or incompatible JVM options. Here are a few suggestions to resolve this issue: Check your system memory: Ensure that your system has sufficient memory available to run the JVM. You can check your system's memory usage using the task manager or activity monitor Increase the JVM memory: You can increase the JVM memory by setting the JAVA_OPTS environment variable. For example, you can set -Xms512m -Xmx1024m to allocate 512 MB for the initial heap size and 1024 MB for the maximum heap size Check your JVM options: Make sure that your JVM options are compatible with your Java version. You can check the compatibility of JVM options with your Java version by referring to the Java documentation Check your Java installation: Make sure that your Java installation is configured correctly and is compatible with your system. You can check your Java version and installation by running the java -version command If the above suggestions do not resolve the issue, you may need to provide more information such as the full error message and any relevant logs to diagnose the issue further
@@RaghavPal Thanks Raghav for your quick response. I tried in 2 of my mac machines I got the same error. Both my machines are high end machines . Can you please provide few more inputs how can I resolve this.
@@RaghavPal Hi Raghav after I upgraded my gatling-maven-plugin.version to 4.3.0 and also added scala-maven-plugin.version dependency 4.8.1 to my pom.xml . Now I'm able to run my tests. Thank you for all your videos. 4.3.0 4.8.1
Thank you so much for all your efforts, this Gatling Video Series helped me a lot.
Glad to hear that
I came here to thank you for making the appium playlist… it’s has help me a lot ….😅i know it’s not connected to this but thank you some much
You're welcome 😊
Hello sir,
How to run multiple simulations which have multiple parameters whose values we have to pass before running them from terminal?
Hi Pallavi, I will do a video on this, for now can check some online examples
Hello Sir,
Thank you for sharing this, this is very useful..
I have one question:
Is any way to run parallel multiple Simulations instead of sequentially.
Hi Hitesh, yes you can check the Injection models gatling.io/docs/gatling/reference/current/core/injection/
Hi Raghav
Can you please suggest me how can I write a Gatling Scala class to execute a karate runner class instead of the karate.feature file?
Banshi
Sure, here is how you can write a Gatling Scala class to execute a karate runner class instead of the karate.feature file:
```scala
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import com.intuit.karate.gatling.Predef._
class MySimulation extends Simulation {
val runner = karateRunner("classpath:my-karate-runner.class")
val httpProtocol = http
.baseUrl("www.mydomain.com")
val scn = scenario("My Scenario")
.exec(runner)
setUp(
scn.inject(
constantUsersPerSec(10) during(10 minutes)
)
).protocols(httpProtocol)
}
```
In this example, we are importing the `io.gatling.core.Predef` and `io.gatling.http.Predef` packages, as well as the `com.intuit.karate.gatling.Predef` package.
We are then creating a class called `MySimulation` that extends the `Simulation` class.
In the `MySimulation` class, we are defining a variable called `runner` that is a `karateRunner` object. The `karateRunner` object is used to execute the karate runner class.
We are also defining a variable called `httpProtocol` that is a `http` object. The `http` object is used to configure the HTTP protocol that will be used to communicate with the website.
We are then defining a scenario called `My Scenario`. The `My Scenario` scenario executes the karate runner class.
Finally, we are setting up the simulation by injecting a constant number of users per second (10) for 10 minutes.
I hope this helps
Hello, Raghav please can you prepare POM for playWright automation, you made me very familiar on selenium and Cucumber , but now I wish to know playWright,........I like your videos thanks
Hi Ethio, I will do
Hi sir !
1) Could you please do a video on future of automation testing and software testing so many Developers and testers are coverting to Data science in recent times
2) is there any chance that sofware testing will be replaced with some other technologies in the future
3)Could you please differentiate wt will be the future and salary growth in Software testing vs data science which has more growth
4)As a software tester i would like to be work in testing field and i would also like to know is data science better than sofware testing( it it is then i will switch my carreer to data science ) .................Please reply sir your answer is much needed for me !
Sure, I will take these in #AskRaghav series soon
@@RaghavPal Hi sir
some people are saying these are the only skills will have huge demand in the future .But there is No Software testing why ? some youtubers are mentioning this .what do you say
1. Blockchain 7:59
2. App Development 7:14
3. Cloud Computing 6:03
4. AI & Data Science 4:41
5. Big Data 2:41
6. Full Stack Development 1:56
7. DevOps 0:30
Other: Cybersecurity 9:13
Can you provide me the code to perform login operation into a url using gatling
Hi Jayasurya
Here is the code to perform login operation into a url using Gatling:
```
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class LoginSimulation extends Simulation {
val httpProtocol = http
.baseUrl("example.com")
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.connectionHeader("keep-alive")
val scn = scenario("Login")
.exec(http("Login")
.post("/login")
.formParam("username", "user")
.formParam("password", "password")
)
setUp(
scn.inject(rampUsers(10) over (10 seconds))
).protocols(httpProtocol)
}
```
This code will first create a new HTTP protocol with the base URL of the web application. Then, it will create a new scenario called "Login". The scenario will have one action, which is a POST request to the "/login" endpoint. The POST request will include the username and password parameters.
Finally, the code will set up the simulation and run it. The simulation will start with 10 users and will ramp up to 10 users over a period of 10 seconds.
This code is just a basic example of how to perform a login operation using Gatling. You can customize the code to fit your specific needs and requirements. For example, you can add more actions to the scenario, such as a page visit or a form submission. You can also change the HTTP protocol to use a different protocol, such as HTTPS.
I hope this helps
Hi Raghav, Thank you for all the videos . I am getting below error when I run mvn gatling:recorder . the same issue happening for mvn gatling:test as well . Could you please provide your suggestion. I googled it but didn't find proper solution. Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Here are my java,scala and mvn versions
GatlingDemoProject2 % scala -version
Scala code runner version 3.2.2 -- Copyright 2002-2023, LAMP/EPFL
GatlingDemoProject2 % mvn -version
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /opt/homebrew/Cellar/maven/3.9.0/libexec
Java version: 19.0.2, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/19.0.2/libexec/openjdk.jdk/Contents/Home
Hi Ramesh,
The error message "Could not create the Java Virtual Machine" usually occurs when the JVM (Java Virtual Machine) cannot allocate enough memory for your application. This can be caused by various factors, such as insufficient RAM or incompatible JVM options.
Here are a few suggestions to resolve this issue:
Check your system memory: Ensure that your system has sufficient memory available to run the JVM. You can check your system's memory usage using the task manager or activity monitor
Increase the JVM memory: You can increase the JVM memory by setting the JAVA_OPTS environment variable. For example, you can set -Xms512m -Xmx1024m to allocate 512 MB for the initial heap size and 1024 MB for the maximum heap size
Check your JVM options: Make sure that your JVM options are compatible with your Java version. You can check the compatibility of JVM options with your Java version by referring to the Java documentation
Check your Java installation: Make sure that your Java installation is configured correctly and is compatible with your system. You can check your Java version and installation by running the java -version command
If the above suggestions do not resolve the issue, you may need to provide more information such as the full error message and any relevant logs to diagnose the issue further
@@RaghavPal Thanks Raghav for your quick response. I tried in 2 of my mac machines I got the same error. Both my machines are high end machines . Can you please provide few more inputs how can I resolve this.
@@RaghavPal Hi Raghav after I upgraded my gatling-maven-plugin.version to 4.3.0 and also added scala-maven-plugin.version dependency 4.8.1 to my pom.xml . Now I'm able to run my tests. Thank you for all your videos. 4.3.0
4.8.1