-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Enable easier configuration of recording file name formatting #500
Comments
Alternative refactor: public BrowserWebDriverContainer() {
....
withRecordingFileFormatter((description, succeeded) -> new File(vncRecordingDirectory, "recording-" ...);
}
public SELF withRecordingFileFormatter(BiFunction<Description, Boolean, File> recordingFileFormatter) {
this.recordingFileFormatter = recordingFileFormatter;
return self();
}
private void stopAndRetainRecording(Description description, boolean successful) {
File recordingFile = recordingFileFormatter.apply(description, successful);
....
} |
@ldeck good idea - I'd certainly be in favour of the filenames being easier to identify (by default!) I think your second suggested alternative looks good as an approach for customisation, but if you have time to create a PR would you mind also changing the default filename formatter? Something like this might be useful: |
By default this returns a file in the given vlc recording directory named '<RESULT>-<TestClassName>-<testMethodName>-<YYYYMMdd-HHmmss>.flv', where RESULT is either 'PASSED' or 'FAILED'. A custom factory can be provided to BrowserWebDriverContainer#withRecordingFileFactory. The factory is only applicable if the BrowserWebDriverContainer#recordingMode enables the retention of recordings. Fixes testcontainers#500.
@rnorth sounds good. |
@rnorth are you happy to accept the merge or would you like anything changed? |
Add RecordingFileFactory with default implementation By default this returns a file in the given vlc recording directory named '<RESULT>-<TestClassName>-<testMethodName>-<YYYYMMdd-HHmmss>.flv', where RESULT is either 'PASSED' or 'FAILED'. A custom factory can be provided to BrowserWebDriverContainer#withRecordingFileFactory. The factory is only applicable if the BrowserWebDriverContainer#recordingMode enables the retention of recordings. Fixes #500.
When using scalatest I'd like to be able to use the test
Description.getDisplayName
(perhaps with a date and/or failed/passed string) to make it easier to find the relevant file for a test.Currently, BrowserWebDriverContainer#stopAndRetainRecording is private and we can only access currentVncRecordings via reflection if we override BrowserWebDriverContainer#failed, for example.
I'd like to suggest the following refactor:
becomes:
Naturally, failed and succeeded would pass along the relevant flag.
I'm happy to create a pull-request with these changes with any suggested alterations to the above.
The text was updated successfully, but these errors were encountered: