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

Added blocks to start and edit #1823

Closed

Conversation

TWoeste
Copy link

@TWoeste TWoeste commented Jul 23, 2021

This will allow people to add different options to start and edit a test with.

… tabs of a loadtest. This will allow people to add different options to start a test with.
@TWoeste
Copy link
Author

TWoeste commented Jul 23, 2021

PR for #1822 (comment)
@cyberw

@cyberw
Copy link
Collaborator

cyberw commented Jul 23, 2021

I dont understand how this would work and it needs some documentation and ideally a test case.

@TWoeste
Copy link
Author

TWoeste commented Jul 26, 2021

{% block extended_start %}{% endblock extended_start %} & {% block extended_edit %}{% endblock extended_edit %}

The two lines added are block statements that work the same way as the three already added block statements do. It will allow the user to add html code inside these blocks to extend the way their code starts and stops load tests. You can couple this with the scripts block at the bottom of index.html to handle the requests and in turn start the load tests. I am not sure of a good way to write tests for this addition. If you point me towards a place you may want more documentation I will. The current place that has the documentation for the currently added blocks is just a example project that uses them.

@cyberw
Copy link
Collaborator

cyberw commented Jul 26, 2021

I guess you can add the example in a new folder under examples, like the other example. Explain what it does and link it from the same place (extending-locust.rst / https://docs.locust.io/en/stable/extending-locust.html#extending-web-ui)

I guess a test may be overly ambitious. You can skip that.

@TWoeste
Copy link
Author

TWoeste commented Jul 29, 2021

@cyberw Just added an example to the examples file.
I had to change where the blocks statements were in the code because with how the extending framework is set up I need the user to click a button to submit the changes of the new forms to a new route in the backend.

image

That is what the example UI looks like. Let me know if you have any other suggestions 😄

@cyberw
Copy link
Collaborator

cyberw commented Jul 29, 2021

Hmm. This is really a nice feature and I understand why you'd want it. But I think we need to make it nicer & more integrated into Locust.

Locust already has a (poorly documented) way to add custom arguments https://docs.locust.io/en/latest/api.html#locust.event.Events.init_command_line_parser (example usage: https://github.com/locustio/locust/blob/master/examples/add_command_line_argument.py)

If we just showed any custom arguments as input fields it would be very flexible and much easier for the user to use (no need to know jinja to be able to add arguments)

It would also be nice to make an "advanced" tab that lists all the arguments (but that is just nice to have, and some arguments are not possible to change at test start time)

@TWoeste
Copy link
Author

TWoeste commented Jul 29, 2021

Hmm ya that would probably be a more sustainable way to add custom starts params. I do not have the time now to make all of that so I will probably just proceed with my private fork. Thanks for you help.
You can close this PR if you want to.

@cyberw
Copy link
Collaborator

cyberw commented Jul 29, 2021

Ok!

@cyberw cyberw closed this Jul 29, 2021
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

Successfully merging this pull request may close these issues.

2 participants