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

Trigger reset environment (before a test suite) #225

Closed
sir-farfan opened this issue Sep 22, 2023 · 6 comments
Closed

Trigger reset environment (before a test suite) #225

sir-farfan opened this issue Sep 22, 2023 · 6 comments

Comments

@sir-farfan
Copy link

Hello
Because reasons, I need to remove all cookies and variables before running a whole file.

"httpYac: Reset Environments" is at the top when I press F1.

I only need to reset when running all the tests in a file, not when I'm sending individual requests one by one.

Sometimes I forget to do it and half of the tests fails xD
Is there a configuration or directive I can put somewhere to make that happen automatically?

@AnWeber
Copy link
Owner

AnWeber commented Sep 25, 2023

@sir-farfan It is easily possible via script in the file to reset the environments, but this would always be for all executions. This is probably rather undesirable. I would suggest that I include these changes.

  • An indicator so that scripts can recognize the execution within the Test Runner.
  • add a config setting testRunResetEnvBeforeRun to reset current environment before a test run
  • add a config setting testRunAlwaysUseEnv to set a specific environment for all test run

Does that sound good? It will take a few days though, as I just started a little side project.

@sir-farfan
Copy link
Author

Hi @AnWeber yeah, that sounds good. I appreciate the intention, the plugin has been a big help so far :)

@AnWeber
Copy link
Owner

AnWeber commented Sep 28, 2023

The feature will be delivered with the next version. I will release this in the next few days, probably on Sunday.

@AnWeber AnWeber closed this as completed Sep 28, 2023
@alekdavisintel
Copy link

alekdavisintel commented Jun 21, 2024

Where do you set testRunResetEnvBeforeRun? I added it to the .httpyac.config.js file but it made no difference.

module.exports = {
  "log": {
    "level": "debug",
    "supportAnsiColors": true,
  },
  "cookieJarEnabled": true,
  "envDirName": 'env',
  "proxyExcludeList": [
    "localhost"
  ],
  "request": {
    "https":  {
      "rejectUnauthorized": false
     }
  },
  "testRunResetEnvBeforeRun": true
}

I assume that every time I run tests from the Testing menu, it would execute httpYac: Reset Environments, but it doesn't seem to do so, at least, I do not see it generating a new token every time I run a file or folder.

@AnWeber
Copy link
Owner

AnWeber commented Aug 3, 2024

@alekdavisintel it is a vscode setting: httpyac.testResetEnvBeforeRun

@alekdavisintel
Copy link

@AnWeber Thanks, it works.

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