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

Run external program from within a test #606

Closed
bartekpacia opened this issue Nov 15, 2022 · 5 comments
Closed

Run external program from within a test #606

bartekpacia opened this issue Nov 15, 2022 · 5 comments
Labels
feature New feature request package: patrol Related to the patrol package (native automation, test bundling)

Comments

@bartekpacia
Copy link
Contributor

bartekpacia commented Nov 15, 2022

@mateuszwojtczak mentioned that one of our big customers has complex tests and sometimes needs to run external scripts, e.g to perform the request to the database.

We've gained the ability to perform actions on behalf of the host from within the test in #593.

We need to think of the API that our users will use for running programs on the host machine.

Here's my initial proposal for the HostAutomator.runScript() method:

Future<void> runScript(String programName, List<String> args]);

Example usage:

// integration_test/database_test.dart

await $.host.runScript('bash', ['./create_user.sh', '--username', 'user', '--some-other-param']);

For consideration:

  • do we want to resemble dart:io's Process.run() and Process.start()?
  • how will we share stdout and stderr with the user (possibly in real-time with the start-variant)?
  • ??? please chip in :)

cc: @jBorkowska, @mateuszwojtczak, @jakubfijalkowski, @shilangyu, @fylyppo

@bartekpacia bartekpacia added feature New feature request package: patrol Related to the patrol package (native automation, test bundling) labels Nov 16, 2022
@shilangyu
Copy link
Contributor

Personally not a fan of the name runScript (the script part) since it can be used for any process, really.

how will we share stdout and stderr with the user (possibly in real-time with the start-variant)?

What is the scope of this feature? On one hand I feel like exposing too many features would just encourage usage of it (and I am not sure if it is something worth encouraging), but on the other hand lack of feature might be a blocker for some.

@bartekpacia
Copy link
Contributor Author

True, I agree it's not a good name. What about runProcess (and, possibly an async equivalent, startProcess)?

What is the scope of this feature?

Haha, good question! I hope to gather some info from our users: @jBorkowska, @fylyppo, @Kendru98, @zoskar, @lmlikota – what do you want? :)

@jBorkowska
Copy link
Collaborator

I don't know bc I never needed it :) That doesn't mean it's a useless feature, just me not knowing what to propose.

@bartekpacia
Copy link
Contributor Author

This has been implemented in #630.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request package: patrol Related to the patrol package (native automation, test bundling)
Projects
None yet
Development

No branches or pull requests

3 participants