HAR Convertor Filter

Hey,

I’ve just converted my HAR file via Chrome into a new Java simulation and it contains ~150requests. I did filter out many static resources included in the recorder but it doesn’t look like it’s worked because many of these requests are all images.

I’ll manually remove this but wondering if I have done something wrong?

Edit: I think a better way for me is to create this script from scratch.

Thank you

Can’t help unless you share your HAR file, what you’ve exactly done and what you’re expecting.


you can ignore the static resources or define some regular expressions to ignore some URLs that you don’t want

Yep that’s what I used but it still filtered them all in.

@slandelle I’m essentially opening the homepage and wanting to play a video. There are a lot more calls made in the background which I am not sure if I should keep but there’s way too many requests in 2.

  1. Copy of HAR Google Drive: Sign-in (Do we have option to upload files to forum?)

  2. Copy of Script with just headers removed Google Drive: Sign-in

As @lance2038 suggested, you have to play with the Deny list regex filters to exclude requests that are not of interest.

@slandelle Hey I managed to resolve this with Regex finally! I removed headers and tidied script up a bit but it doesn’t build. I’m getting ; Cannot resolve method ‘pause’ in ‘HttpRequestActionBuilder’

package fiba;

import java.time.Duration;
import java.util.*;

import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;
import io.gatling.javaapi.jdbc.*;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;
import static io.gatling.javaapi.jdbc.JdbcDsl.*;
a
public class Homepage extends Simulation {

  private HttpProtocolBuilder httpProtocol = http
    .baseUrl("https://courtside.test.fiba.pulselive.com");
  
  private String uri01 = "https://api.test.platform.pulselive.com/content/fiba-courtside";
  
  private String uri03 = "https://sportsdata.courtside1891.basketball/sportzapi/v1/en";
  
  private String uri04 = "https://stagingfibapayments.streamamg.com/api/v1/session/prescence";
  
  private String uri05 = "https://sso.dev.fiba.pulselive.com/auth/realms/fiba-courtside/protocol/openid-connect";
  
  private String uri10 = "https://open.http.mp.streamamg.com/p/3001355/sp/300148200/embedIframeJs/uiconf_id/30030624/partner_id/3001355";

  private ScenarioBuilder scn = scenario("Homepage")
    .exec(
      http("Login To Test Environment")
        .get("/")
        .basicAuth("xxxxxxx","xxxxxxx")
        .resources(
          http("request_5")
            .get(uri10),
          http("request_7")
            .get(uri05 + "/3p-cookies/step2.html"),
          http("request_8")
            .get(uri03 + "/schedule/competitions/147?from=2022-01-24&to=2022-03-02&pagination=false"),
          http("request_9")
            .get(uri01 + "/playlist/en/10530050?detail=DETAILED"),
          http("request_10")
            .get(uri05 + "/login-status-iframe.html"),
          http("request_11")
            .get(uri01 + "/playlist/en/?detail=DETAILED"),
          http("request_12")
            .get(uri05 + "/login-status-iframe.html/init?client_id=fiba-courtside-web&origin=https%3A%2F%2Fcourtside.test.fiba.pulselive.com"),
          http("request_14")
            .get(uri03 + "/games/932"),
          http("Check Subscription Status")
            .get(uri04 + "/"),
          http("request_16")
            .get("/resources/991/site.webmanifest"),
          http("request_17")
            .get(uri03 + "/schedule?from=2022-02-10&to=2022-02-12&pagination=false"),
          http("request_18")
            .get(uri03 + "/schedule/live?pagination=false"),
          http("request_19")
            .get(uri01 + "/VIDEO/EN?references=BASKETBALL_GAME%3A932"),
          http("request_20")
            .get(uri01 + "/VIDEO/EN?referenceExpression=(%22BASKETBALL_GAME%3A932%22or%22BASKETBALL_GAME%3A964%22or%22BASKETBALL_GAME%3A913%22or%22BASKETBALL_GAME%3A943%22or%22BASKETBALL_GAME%3A929%22or%22BASKETBALL_GAME%3A911%22or%22BASKETBALL_GAME%3A973%22or%22BASKETBALL_GAME%3A984%22or%22BASKETBALL_GAME%3A946%22)&pageSize=50"),
          http("request_21")
            .get(uri03 + "/competitions/357"),
          http("request_22")
            .get(uri03 + "/competitions/298"),
          http("request_23")
            .get(uri03 + "/games/821"),
          http("request_24")
            .get(uri03 + "/games/823"),
          http("request_25")
            .get(uri01 + "/playlist/en/?detail=DETAILED&tagNames=tray%3A%20other-videos"),
          http("request_26")
            .get(uri03 + "/games/31958"),
          http("request_27")
            .get(uri03 + "/games/32636"),
          http("request_29")
            .get(uri01 + "/VIDEO/EN?referenceExpression=(%22BASKETBALL_GAME%3A821%22or%22BASKETBALL_GAME%3A823%22or%22BASKETBALL_GAME%3A14203%22or%22BASKETBALL_GAME%3A14616%22or%22BASKETBALL_GAME%3A14682%22or%22BASKETBALL_GAME%3A15873%22or%22BASKETBALL_GAME%3A15931%22)&pageSize=50")
        )
    .pause(1)
    .exec(
      http("request_31")
        .get(uri03 + "/schedule/live?pagination=false")
        .resources(
          http("request_32")
            .get(uri03 + "/games/31958"),
          http("request_33")
            .get(uri03 + "/games/32636")
        )
    )
 );
  {
	  setUp(scn.injectOpen(atOnceUsers(1))).protocols(httpProtocol);
  }
}

I’ve also noticed there is a problem with my pom.xml. I did follow the tutorial online from scratch for Java when I noticed I was using wrong config last time but I get : Plugin ‘maven-compiler-plugin:3.8.1’ not found.

Thank you

<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.demo</groupId>
  <artifactId>gatling-maven-plugin-demo-java</artifactId>
  <version>3.7.6</version>

  <properties>
    <!-- use the following if you're compiling with JDK 8-->
    <!-- <maven.compiler.source>1.8</maven.compiler.source> -->
    <!-- <maven.compiler.target>1.8</maven.compiler.target> -->
    <!-- comment the 2 lines above and uncomment the line bellow if you're compiling with JDK 11 or 17 -->
    <maven.compiler.release>11</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-maven-plugin.version>4.1.5</gatling-maven-plugin.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
  </properties>

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

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
        <configuration>
          <!-- Enterprise Cloud (https://cloud.gatling.io/) configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/#working-with-gatling-enterprise-cloud -->
          <!-- Enterprise Self-Hosted configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/#working-with-gatling-enterprise-self-hosted -->
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

You’re missing a closing paren for the previous exec block.

1 Like

I tidied up my script and moved my homepage request into a class similar to what the tutorial does but I get a similar error as I did before. Been staring at the ide for half hour now for missing brackets but can’t figure it out. Thank you so much

Also noticed in the tutorial scenario builder is
private static final ScenarioBuilder scn = scenario(“Homepage”)
instead of
private ScenarioBuilder scn = scenario(“Homepage”)


  public class Homepage extends Simulation {

  private static final String DOMAIN = "courtside.test.fiba.pulselive.com";
  private static final HttpProtocolBuilder HTTP_PROTOCOL = http.baseUrl("https://" + DOMAIN);
  
  private String testCMS = "https://api.test.platform.pulselive.com/content/fiba-courtside";
  
  private String sportz = "https://sportsdata.courtside1891.basketball/sportzapi/v1/en";

  private static class CmsPages {

    private static final ChainBuilder homepage =
          exec(
                  http("Login To Test Environment")
                    .get("/")
                    .check(regex("<title>Courtside - Watch Basketball Live<title/>").exists())
                    .basicAuth("xxxxxxx","xxxxxxxx"));
  }

  private ScenarioBuilder scn = scenario("Homepage")
          .exec(CmsPages.homepage)
        .resources(
          http("request_8")
            .get(sportz + "/schedule/competitions/147?from=2022-01-24&to=2022-03-02&pagination=false"),
          http("request_9")
            .get(testCMS + "/playlist/en/10530050?detail=DETAILED"),

Cannot resolve method ‘pause’ in ‘HttpRequestActionBuilder’

meaning your error is before the pause call. That’s where you’re missing a paren.

@slandelle I already resolved that error in the previous comment but my last post was regarding a similar error

Cannot resolve method ‘resources’ in ‘ScenarioBuilder’

package fiba;

import java.time.Duration;
import java.util.*;

import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;
import io.gatling.javaapi.jdbc.*;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;
import static io.gatling.javaapi.jdbc.JdbcDsl.*;

public class Homepage extends Simulation {

  private static final String DOMAIN = "courtside.test.fiba.pulselive.com";
  private static final HttpProtocolBuilder HTTP_PROTOCOL = http.baseUrl("https://" + DOMAIN);
  
  private String testCMS = "https://api.test.platform.pulselive.com/content/fiba-courtside";
  
  private String sportz = "https://sportsdata.courtside1891.basketball/sportzapi/v1/en";

  private static class CmsPages {

    private static final ChainBuilder homepage =
          exec(
                  http("Login To Test Environment")
                    .get("/")
                    .check(regex("<title>Courtside - Watch Basketball Live<title/>").exists())
                    .basicAuth("fffffffff","fffffffff"));
  }

  private ScenarioBuilder scn = scenario("Homepage")
          .exec(CmsPages.homepage)
        .resources(
          http("request_8")
            .get(sportz + "/schedule/competitions/147?from=2022-01-24&to=2022-03-02&pagination=false"),
          http("request_9")
            .get(testCMS + "/playlist/en/10530050?detail=DETAILED"),
          http("request_11")
            .get(testCMS + "/playlist/en/?detail=DETAILED"),
          http("request_14")
            .get(sportz + "/games/932"),
          http("request_17")
            .get(sportz + "/schedule?from=2022-02-10&to=2022-02-12&pagination=false"),
          http("request_18")
            .get(sportz + "/schedule/live?pagination=false"),
          http("request_19")
            .get(testCMS + "/VIDEO/EN?references=BASKETBALL_GAME%3A932"),
          http("request_20")
            .get(testCMS + "/VIDEO/EN?referenceExpression=(%22BASKETBALL_GAME%3A932%22or%22BASKETBALL_GAME%3A964%22or%22BASKETBALL_GAME%3A913%22or%22BASKETBALL_GAME%3A943%22or%22BASKETBALL_GAME%3A929%22or%22BASKETBALL_GAME%3A911%22or%22BASKETBALL_GAME%3A973%22or%22BASKETBALL_GAME%3A984%22or%22BASKETBALL_GAME%3A946%22)&pageSize=50"),
          http("request_21")
            .get(sportz + "/competitions/357"),
          http("request_22")
            .get(sportz + "/competitions/298"),
          http("request_23")
            .get(sportz + "/games/821"),
          http("request_24")
            .get(sportz + "/games/823"),
          http("request_25")
            .get(testCMS + "/playlist/en/?detail=DETAILED&tagNames=tray%3A%20other-videos"),
          http("request_26")
            .get(sportz + "/games/31958"),
          http("request_27")
            .get(sportz + "/games/32636"),
          http("request_29")
            .get(testCMS + "/VIDEO/EN?referenceExpression=(%22BASKETBALL_GAME%3A821%22or%22BASKETBALL_GAME%3A823%22or%22BASKETBALL_GAME%3A14203%22or%22BASKETBALL_GAME%3A14616%22or%22BASKETBALL_GAME%3A14682%22or%22BASKETBALL_GAME%3A15873%22or%22BASKETBALL_GAME%3A15931%22)&pageSize=50")
        );

  {
	  setUp(scn.injectOpen(atOnceUsers(1))).protocols(HTTP_PROTOCOL);
  }
}

Looks like I have solved it! I took everything above .resources into the homepage method but resources means it requests in parallel so looks like I can’t write the code like that. I’ll have to move all those requests into that method.