Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Refactor
new
command #4153base: master
Are you sure you want to change the base?
Refactor
new
command #4153Changes from 6 commits
d254f00
e7e95f1
c3f84ba
fea3e7f
b1af40f
b3e99b8
6423d09
1d8d321
5cf5916
beda4b1
9b0ab6d
833e52f
c0fc8d0
bd121da
4c62035
3a63869
9b26b9a
d0ae761
a5706c4
a6ed6c9
20f58ca
34b8624
5e08739
5cdb186
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 31 in cmd/new.go
GitHub Actions / lint
Check failure on line 49 in cmd/new.go
GitHub Actions / lint
Check failure on line 66 in cmd/new.go
GitHub Actions / lint
Check failure on line 107 in cmd/new_test.go
GitHub Actions / lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see in other examples we set duration/vus, should we set some "scope" here as well?
Otherwise, does it bring any value to define the executor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Furthermore, my understanding is that in general users tend to run browser tests with 1 VU/1 iteration, at least when they get started. I know it's the default anyway, but as we're all addressing beginners with this command, it could be helpful to remove as much implicit as possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! I have added VUs/Iterations.
It is needed to be able to run a browser test. You must use scenarios, and scenarios must have an executor.
Btw... we do this same thing in lots of other places; maybe it is something we should change? cc @ankur22
e.g. https://grafana.com/docs/k6/latest/using-k6-browser/#a-simple-browser-test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean adding the VU/iteration to all the other examples too? The situation with scenarios and browser tests isn't great tbh, and being forced to add an executor. I think we wanted to avoid making a very large options block, and the minimal is:
Adding iteration and vus adds a couple more lines to it.
If the general consensus is that it makes is clearer for new users then it's something to consider. CC @inancgumus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like being explicit in this k6 new command’s output and including VUs and iterations as outputted examples. Sure, we can also mention VUs and iterations in k6-docs here and there, but in general (all k6-docs, if that’s what we mean), I don’t believe we should add more clutter to that already crowded browser options block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would adding a
catch
here be a recommended practice? 🤔If so, I'd prefer to have it in place, as this not being a simple test, but likely an entrypoint for k6 newcomers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in this case, if the error is not caught, the iteration will be aborted with an error anyway. But it would make sense indeed, if possible to catch the error in order to maybe explicitly call
fail
orexec.test.abort
with a custom message guiding the user through what failed, why, and what they can do about it 👍🏻There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added catch + fail 👀
Also, another thing we can maybe use in all examples cc @ankur22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also changed the
setup()
of the browser and protocol tests to useexec.test.abort
instead ofthrow