Skip to content

Conversation

aprowe
Copy link
Contributor

@aprowe aprowe commented Jul 25, 2025

It will first try to find it in the lifecycle folder, and if not found will treat it like a path.

--prerun="my/path/to.yaml"
or
--prerun="my_prerun"

It will first try to find it in the lifecycle folder, and if not found
will treat it like a path.

--prerun="my/path/to.yaml"
or
--prerun="my_prerun"
@aprowe aprowe force-pushed the alexrowe/lifecycle-args branch from 48d658f to fbaebe4 Compare July 25, 2025 19:55
@ianjennings
Copy link
Contributor

@aprowe, @ericclemmons believes that we should not be automatically finding files (prerun, postrun, etc) and instead require them (likk with run) and use a syntax like GitHub action's if: always().

I feel like this is the correct solution to the whole prerun, postrun thing, wdyt?

https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f

@chottuthejimmy
Copy link
Contributor

chottuthejimmy commented Jul 26, 2025

@aprowe so with this I would have to use these flags to run these meta files correct ?
so I would need to do something like as a minimal thing

npx testdriverai@beta run <file-path>.yaml --prerun --provision --postrun

or do I need to do this

npx testdriverai@beta run <file-path>.yaml --prerun= "my_prerun" --provision="my_provision" --postrun="my_postrun"

In both the cases, imo, we shouldn't put this burden onto the user.
But if this is what's gonna work, then lmk, I can push in a change where it auto runs these files during CI runs w/o the flags.

@aprowe
Copy link
Contributor Author

aprowe commented Jul 26, 2025

@ianjennings
I can see a case for both-
Putting it as a cli arg means the test yaml doesn't need to be aware of its context in a away. Having to explicitly do a step before and after could be tedious.

I do think an "always run" clause is needed but not totally convinced it over shadows a pre / post run cli arg. Could do without the implicit though.

@chottuthejimmy this doesn't change any behavior, it keeps all the default the same. Just lets the user change the pre and post.

--prerun=my_file or --prerun=./myfile.yaml

@misterludden
Copy link
Contributor

I think we need something like this.
@ianjennings @ericclemmons for example when writing a new test, I might want to do 3 'prerun-like' things first if this test is an intermediary step or module that I don't need to do when I call it later in another test etc.
What's weird now:

  • if I run testdriverai edit mytest - prerun isn't run, but if I do an interactive /run login.yaml to do my setup then the prerun will run. It might be nice if I could just say testdriverai edit mytest --load test1, test2, test3 --finish somepostrun or something like that - similar to what @aprowe might be proposing here?

@ericclemmons
Copy link
Member

I think all of this just inches us towards the need for interactivity.

Today I'm doing something similar where I need the provision to keep Chrome open, the prerun to setup the initial state, or postrun to basically do that reset so I can run it again.

I'm down to merge this as part of v6 because we'll need the product UX to negate this need entirely long-term.

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.

5 participants