Home > OS >  Getting "Cannot resolve symbol core" while writing Gatling script
Getting "Cannot resolve symbol core" while writing Gatling script

Time:10-12

I am trying create a Gatling load test script on Intellij Idea and I'm at the very beginning steps. I created a Gatling project with Maven but i cannot import io.gatling.core package.

Could you please help me to resolve my issue? Thanks in advance.

My pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.gatling</groupId>
  <artifactId>gatling-core</artifactId>
  <version>3.5.1</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <encoding>UTF-8</encoding>

    <gatling.version>3.5.1</gatling.version>
    <gatling-maven-plugin.version>3.1.1</gatling-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-core</artifactId>
      <version>3.5.1</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

What i want to achieve:

import io.gatling.core.scenario.Simulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._

CodePudding user response:

I changed my pom.xml to below with Gatling 3.5.1 and it works now:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.gokhan</groupId>
  <artifactId>Test</artifactId>
  <version>1.0</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <encoding>UTF-8</encoding>

    <gatling.version>3.5.1</gatling.version>
    <gatling-maven-plugin.version>3.1.1</gatling-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>${gatling.version}</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

CodePudding user response:

Or you should use only variables like ${"ANY_PACKAGE".version} or check the right version from the terminal.

  • Related