-
Notifications
You must be signed in to change notification settings - Fork 34
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
Provide common test helpers. #407
Comments
|
``` org.metafacture.flowcontrol.ObjectExceptionCatcherTest > shouldCatchException STANDARD_ERROR [Test worker] ERROR org.metafacture.flowcontrol.ObjectExceptionCatcher - 'Exception Message' while processing object: data org.metafacture.flowcontrol.ObjectThreaderTest > shouldSplitAllObjectsToAllThreadedDownStreamReceivers STANDARD_ERROR [Test worker] INFO org.metafacture.flowcontrol.ObjectThreader - Adding thread 1 [Test worker] INFO org.metafacture.flowcontrol.ObjectThreader - Adding thread 2 org.metafacture.json.JsonDecoderTest > testShouldProcessRecordsInArrayRoot STANDARD_ERROR SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. org.metafacture.monitoring.StreamLoggerTest > shouldActAsSinkIfNoReceiverIsSet STANDARD_ERROR [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - start record 1 [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - start entity entity [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - literal literal=value [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - end entity [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - end record [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - resetStream [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - closeStream org.metafacture.monitoring.StreamLoggerTest > shouldForwardAllReceivedEvents STANDARD_ERROR [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - start record 1 [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - start entity entity [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - literal literal=value [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - end entity [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - end record [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - resetStream [Test worker] DEBUG org.metafacture.monitoring.StreamLogger - closeStream org.metafacture.monitoring.ObjectTimerTest > testShouldHandleImmediateCloseStreamWithNoProcessing STANDARD_ERROR [Test worker] INFO org.metafacture.monitoring.TimerBase - Executions: 0; Cumulative duration: 0s; Average duration: 0s [Test worker] INFO org.metafacture.monitoring.TimerBase - Time to close stream: 14µs 965ns org.metafacture.monitoring.ObjectTimerTest > testShouldMeasureExecutionTime STANDARD_ERROR [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 1: 150ms 138µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 2: 20ms 82µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 3: 30ms 130µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 4: 202ms 164µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Executions: 4; Cumulative duration: 402ms 515µs; Average duration: 100ms 629µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Time to close stream: 6µs 170ns org.metafacture.monitoring.StreamTimerTest > testShouldHandleImmediateCloseStreamWithNoProcessing STANDARD_ERROR [Test worker] INFO org.metafacture.monitoring.TimerBase - Executions: 0; Cumulative duration: 0s; Average duration: 0s [Test worker] INFO org.metafacture.monitoring.TimerBase - Time to close stream: 1µs 470ns org.metafacture.monitoring.StreamTimerTest > testShouldMeasureExecutionTime STANDARD_ERROR [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 1: 150ms 242µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 2: 20ms 149µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 3: 30ms 123µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Execution 4: 202ms 170µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Executions: 4; Cumulative duration: 402ms 685µs; Average duration: 100ms 671µs [Test worker] INFO org.metafacture.monitoring.TimerBase - Time to close stream: 5µs 111ns org.metafacture.metamorph.test.validators.StreamValidatorTest > shouldFailIfEndRecordEventIsMissing STANDARD_ERROR [Test worker] INFO org.metafacture.metamorph.test.validators.StreamValidator - Event Stream: 1{} ```
Maybe also print Morph/Fix script on failure. |
As these scripts can comprise several thousand lines a snippet would be fine. |
Not usually in tests, though, right? Those are (almost?) always small scripts with the minimum number of instructions required for the particular test. |
BTW: This idea was inspired by the Metafix test helper, only limited to test failures so it wouldn't clutter the regular test output. |
Ah, right, sorry, of course - it's about tests ... so just ignore my comment :) |
Already done in #417. |
As mentioned in #386, it would be nice to be able to reuse the stream test pattern (cf. #339) across modules. Currently
metamorph
andmetafacture-mangling
make use of it, plusmetafacture-yaml
once #400 is accepted. There are more candidates that could potentially benefit from it.I'd like to propose
metafacture-test
as a new module, withorg.metafacture.test.StreamTestHelpers
(or maybeorg.metafacture.test.helpers.StreamTest
) as a starting point. There's always the possibility to extract more test patterns in the future.It would be a
testImplementation
dependency for the aforementioned modules.Would something like this be acceptable? (See also the brief discussion in #386.)
P.S.: While at it, it might make sense to configure test logging (
showStandardStreams = true
andexceptionFormat = 'full'
) globally for all subprojects. Unwanted output should be suppressed or otherwise dealt with.The text was updated successfully, but these errors were encountered: