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

Random data (from fake-data) doesn't work in before section #2756

Open
RemiBardon opened this issue May 15, 2024 · 2 comments
Open

Random data (from fake-data) doesn't work in before section #2756

RemiBardon opened this issue May 15, 2024 · 2 comments

Comments

@RemiBardon
Copy link

RemiBardon commented May 15, 2024

Version info:

Artillery: 2.0.12
Node.js: v22.1.0
OS: darwin

Running this command:

DEBUG=http* artillery run init.yaml --solo

I expected to see this happen:

JSON body has "name" key.

Instead, this happened:

JSON body is empty (fake data not generated):

  http request: {
    "url": "http://127.0.0.1:8000/v1/workspace",
    "method": "PUT",
    "headers": {
      "user-agent": "Artillery (https://artillery.io)"
    },
-   "json": {
-     "name": "…"
-   }
+   "json": {}
  }

I suspect it's because

script.scenarios = script.scenarios.map((scenario) => {
scenario.beforeScenario = [].concat(scenario.beforeScenario || []);
scenario.beforeScenario.push('falsoHandler');
return scenario;
});

only maps scenarios in the scenarios section and not the ones in [before](https://www.artillery.io/docs/reference/test-script#before-and-after-sections) and [after](https://www.artillery.io/docs/reference/test-script#before-and-after-sections) sections.

Files being used:

config:
  target: http://127.0.0.1:8000
  plugins:
    fake-data: {}
  
before:
  flow:
    - put:
        url: "/v1/workspace"
        json:
          name: "{{ $randBrand() }}"
  
scenarios: []
@hassy
Copy link
Member

hassy commented May 16, 2024

thanks @RemiBardon! definitely looks like a bug /cc @bernardobridge

@bernardobridge
Copy link
Contributor

👋 Thanks for the bug report @RemiBardon. I will take a look to see what can be done here

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

No branches or pull requests

3 participants