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

Use Python generators for test generation #2

Open
5 tasks
heinezen opened this issue Dec 24, 2022 · 0 comments
Open
5 tasks

Use Python generators for test generation #2

heinezen opened this issue Dec 24, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@heinezen
Copy link
Collaborator

In the current implementation, the test generation logic puts all generated tests into a big list and passes this list to the engine for execution. This is fine for smaller test runs, but could result on a heavy memory footprint if runs contain a large number of tests or if individual TestCase objects is high. Generating the test
cases using generators could improve this situation, since tests would be generated on-the-fly.

It should still be possible to generate all tests at once, so that a run can be saved to file and executed later. The test engine should accept a list of tests or a list of generators.

Implementing Python generators would probably involve the following tasks:

  • Redesign all existing TestCase.generate as generators (should be trivial)
  • Store generators and pass them to the engine
  • Test IDs need to be generated on-the-fly during test execution (a simple counter should be enough).
  • Test results need to be stored after test execution, so that we can destroy the test object after execution to save memory.
  • Tests should not be destroyed immediately, since the engine may want to execute it a second time. This can happen if the engine detects that the rate limit of a service has been reached and the last X tests have to be redone.

You can use the Python module tracemalloc to monitor memory usage.

@heinezen heinezen added the enhancement New feature or request label Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant