dave08
08/15/2024, 9:43 AMprepared { }
is used, it'll just pour the whole file content out to the test console... that might not always be the behaviour the user wants... I didn't see any prepared setting that would suppress or concatenate that..CLOVIS
08/15/2024, 9:44 AMdave08
08/15/2024, 9:47 AM<xml...>
... doesn't say much...
This issue is probably with not only resource files, but any prepared { }
, that would result in larger output...dave08
08/15/2024, 9:48 AMCLOVIS
08/15/2024, 9:49 AMCLOVIS
08/15/2024, 9:52 AMCLOVIS
08/15/2024, 9:56 AMprepared
function itself (would be more convenient for everyone) is that that would be a binary-breaking changedave08
08/15/2024, 9:56 AMsuspend operator fun <T> Prepared<T>.invoke(outputFormatter: OutputFormatter): T = ...
but that would require putting that parameter at every call and not forgetting it... 😵💫dave08
08/15/2024, 9:57 AMpreparedFormatted(...) { }
?CLOVIS
08/15/2024, 9:59 AMThat's another little issue, I currently find those TestConfigs to be pretty verbose and hard to find (each one is it's own class?)...
Yeah. Currently the best way to find them is in the package-level documentation: https://opensavvy.gitlab.io/groundwork/prepared/api-docs/suite/opensavvy.prepared.suite.config/index.html They work basically the same way as CoroutineContext, to allow anyone (or any test runner) to create custom config, and to avoid breaking changes when configs are added
CLOVIS
08/15/2024, 10:00 AMBut that aside, maybe when calling the prepared, it could have an outputter param...
The value is only printed on the very first use though, so for every other use it's useless And the very idea of prepared values is that you don't care which one is the first use (since they can depend on each other)
CLOVIS
08/15/2024, 10:01 AMdave08
08/15/2024, 10:06 AMAnd the very idea of prepared values is that you don't care which one is the first use (since they can depend on each other)Yeah, that's why the best solution is at declaration point...
to create custom config, and to avoid breaking changes when configs are addedThat's for sure an advantage... but for those that don't know all the options, they're pretty hard to find and to use different settings for each test could be very verbose. It might be nice to group them somehow under a
object TestConfigs
with functions or extension functions for each? Or maybe have common combined settings in one of those functions as parameters?
fun TestConfigs.set(ignored: Boolean = false, timeout: Duration = ..., vararg tags: String)
dave08
08/15/2024, 10:08 AMCLOVIS
08/15/2024, 10:10 AMdave08
08/15/2024, 10:12 AMCLOVIS
08/15/2024, 10:14 AMdave08
08/15/2024, 10:19 AMsetFormatter(...)
to the TestDsl just like you have cleanUp { }
, would that work?dave08
08/15/2024, 10:20 AMCLOVIS
08/15/2024, 10:20 AMdave08
08/15/2024, 10:21 AMdave08
08/15/2024, 10:21 AMCLOVIS
08/15/2024, 10:21 AMdave08
08/15/2024, 10:22 AMCLOVIS
08/15/2024, 10:22 AMthere's no PreparedDsl
Yeah. I hesitated a lot. In the end, I decided not to have one, so it's clearer that
prepared
is just a way to declare a part of the test outside the testCLOVIS
08/15/2024, 10:23 AMdave08
08/15/2024, 10:25 AMit
in the prepared block, since the receiver is already TestDsl), it would only be a one-time migration deprecation... but the question is, how much more would there be to add to prepared?dave08
08/15/2024, 10:25 AMCLOVIS
08/15/2024, 10:26 AMprepared {}
but doesn't in test {}
CLOVIS
08/15/2024, 10:26 AMdave08
08/15/2024, 10:56 AMdave08
08/15/2024, 1:41 PMdave08
08/15/2024, 1:44 PMCLOVIS
08/15/2024, 5:16 PMfun <T> prepared(
…,
display: (T) -> String = { it.toString() },
block: TestDsl.() -> …
) …
but I can't because of the T
variance being different.dave08
08/15/2024, 5:54 PM