Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven plugin: support headless execution of recorder's HAR mode #3894

Open
chriskilding opened this issue Apr 30, 2020 · 12 comments
Open

Maven plugin: support headless execution of recorder's HAR mode #3894

chriskilding opened this issue Apr 30, 2020 · 12 comments

Comments

@chriskilding
Copy link

chriskilding commented Apr 30, 2020

Proposal

I would like the Maven plugin to allow headless execution of the recorder target in HAR mode.

To that end the following options come to mind:

Add missing properties to recorder target

Add the missing HAR-related properties from ArgsParser to RecorderMojo:

  • mode (enum: proxy or har)
  • headless (boolean)
  • harFilePath (path)

Define different recorder targets for proxy mode and HAR mode

Each target would have the options that make sense for it.

Questions

This feature also questions a couple of the assumptions made by the existing Maven plugin recorder options, which I think are largely designed for the point-and-click proxy mode use case.

  • The scenarios are generated in src/test/scala, but the usage I'm proposing implies generated code that we may not want to commit. Perhaps we need a convention for Gatling codegen in the target directory (which is not in version control).
  • The recorder currently only supports a single HAR file. I would ideally like to convert a directory of HAR files, whose names I may not know ahead of time. Can the harFilePath option support /* globbing to grab multiple files?

Checklist

Make sure these checkboxes are checked before submitting your issue. Thanks you!

@slandelle
Copy link
Member

What are you trying to do exactly? The raw result of an HAR conversion needs to be edited to fix correlation, inject dynamic data...

@chriskilding
Copy link
Author

Hi Stephane,

We've got a bunch of HAR files which are generated from our instrumentation, and are looking to improve the automation in turning them into something Gatling-friendly.

As you say, we expect to do a bit of editing on the generated scenarios so we're not looking for total automation, just 'a bit more' automation by filling in the gaps in the Maven plugin. So that we can bulk convert a directory of HAR files to a bunch of Gatling scenarios, which we can then edit as needed. (Rather than point-and-click in the recorder UI for each one.)

@slandelle
Copy link
Member

Perhaps we need a convention for Gatling codegen in the target directory (which is not in version control).

That doesn't look like a good idea to me. Generated source dirs usually look like src/(main|test)/generated or similar and you then have to play with maven configuration to make it picked by compilation goal.

Anyway, this looks pretty complicated with lots of steps, with some of them not performed by Gatling.
Moreover, I tend to refrain from shipping features that wouldn't have a widespread usage.
I'd like to see some more demand for this.

@chriskilding
Copy link
Author

That's fair, we can leave out that bit of the feature request for now.

@chriskilding
Copy link
Author

Thoughts on whether there should be a single recorder target + mode enum argument for both modes, or one target for each?

@slandelle
Copy link
Member

@chriskilding Sorry, I don't follow.

@chriskilding
Copy link
Author

If we keep a single recorder target, the RecorderMojo would have to do double duty for Proxy mode and Har mode, taking the union of their arguments, and we would have to allow the user to toggle which mode they want with something like <mode>proxy</mode> or <mode>har</mode>.

If we have two targets, each Mojo would only need to take the arguments that the relevant mode requires, and we would not need a mode enum. For example gatling:recorder and gatling:converter.

@slandelle
Copy link
Member

Let's go with one single mojo for consistency so we keep on talking about the Recorder in proxy or har mode.

@slandelle
Copy link
Member

@chriskilding Any update?

@slandelle slandelle changed the title Maven plugin: Should allow headless execution of recorder's HAR mode Maven plugin: support headless execution of recorder's HAR mode Nov 20, 2020
@albertoSoto
Copy link

albertoSoto commented Oct 11, 2023

Is it any update in this headless execution? I can't understand why the recorder allows the conversion with the GUI but there is no way to automate via maven plugin. I have been able to check the documentation and headless mode is documented as stated https://gatling.io/docs/gatling/reference/current/http/recorder/#headless-mode, but maven plugin seems to do not support it, as the output of mvn gatling:help -Ddetail=true -Dgoal=recorder does not show any option.

Picking up the recorder.conf file seems to fail there, although I have tried with the following to inject it.

mvn gatling:recorder -Dgatling.recorder.simulationsFolder="output" -Dgatling.configFolder=""

I am really interested in place the e2e tests from cucumber, which can generate HAR files, to use with Gatling. Thanks in advance.

@slandelle
Copy link
Member

I can't understand why the recorder allows the conversion with the GUI but there is no way to automate via maven plugin.

I am really interested in place the e2e tests from cucumber, which can generate HAR files, to use with Gatling. Thanks in advance.

Executing under load the raw traffic generated from one single user is broken: you're going to test your caches (same database records, application caches, etc) and are going to get super good results that are actually not valid compared to the actual traffic.
You must introduce at least test data so your virtual users use the caches in a realistic way, which typically requires some manual edition.

@albertoSoto
Copy link

albertoSoto commented Oct 11, 2023

I think I have explained too badly my use case:
I have set of e2e tests that want to dynamize, but using HAR conversion from the recorder, seem to be a very good base to automate the workload (as there ir an interface for using it with recorder already)

Unfortunately, I don't see how to execute the headless conversion from HAR files from Maven. Is nothing related to a single user, but to have a base to dynamize it. Otherwise, there is a need to re-code, all the steps on the, for instance, Cucumber pipeline.

HAR conversion works under GUI for Gatling recorder, but I can't convert with maven. The injection for dynamic conf files does not work when you use

mvn gatling:recorder -Dgatling.configFolder="-any-"

The base recorder.conf file can be found https://github.com/gatling/gatling/blob/main/gatling-recorder/src/main/resources/recorder-defaults.conf and a copy from it has been introduce in the project, but anyway, it ignores to run on headless via maven execution.

Is this a usage problem? I can also see that file named recorder.conf does not get packaged in the target folder.
Thank you very much

PD: As a reminder, Current mvn plugin options for mojo executer are:

gatling:recorder
Mojo to run Gatling Recorder.
Available parameters:

  • className
  • configFolder (Default: ${project.basedir}/src/test/resources)
    User property: gatling.configFolder
  • encoding
  • followRedirect
  • localPort
  • packageName (Default: ${project.groupId})
  • proxyHost
  • proxyPort
  • proxySSLPort
  • resourcesFolder (Default: ${project.basedir}/src/test/resources)
  • simulationsFolder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants