use of com.github.valfirst.slf4jtest.LoggingEvent in project vividus by vividus-framework.
the class VariableTestContextTests method shouldPutVariablesIntoAllPassedScopes.
@Test
void shouldPutVariablesIntoAllPassedScopes() {
Set<VariableScope> variableScopes = Set.of(VariableScope.STEP, VariableScope.SCENARIO, VariableScope.STORY, VariableScope.NEXT_BATCHES);
Variables variables = new Variables(Map.of());
variables.initStepVariables();
when(variablesFactory.createVariables()).thenReturn(variables);
variableTestContext.putVariable(variableScopes, VARIABLE_KEY, VALUE);
assertEquals(VALUE, variables.getVariable(VARIABLE_KEY));
variables.clearStepVariables();
assertEquals(VALUE, variables.getVariable(VARIABLE_KEY));
variables.clearScenarioVariables();
assertEquals(VALUE, variables.getVariable(VARIABLE_KEY));
List<LoggingEvent> loggingEvents = logger.getLoggingEvents();
assertThat(loggingEvents, hasSize(4));
assertThat(loggingEvents, hasItems(info(SAVE_MESSAGE_TEMPLATE, VALUE, STEP, VARIABLE_KEY), info(SAVE_MESSAGE_TEMPLATE, VALUE, "scenario", VARIABLE_KEY), info(SAVE_MESSAGE_TEMPLATE, VALUE, "story", VARIABLE_KEY), info(SAVE_MESSAGE_TEMPLATE, VALUE, "next batches", VARIABLE_KEY)));
verify(variablesFactory).addNextBatchesVariable(VARIABLE_KEY, VALUE);
}
use of com.github.valfirst.slf4jtest.LoggingEvent in project vividus by vividus-framework.
the class FilesystemScreenshotDebuggerTests method shouldSaveScreenshotIntoDebugFolder.
@Test
void shouldSaveScreenshotIntoDebugFolder(@TempDir File debugFolder) {
filesystemScreenshotDebugger.setDebugScreenshotsLocation(Optional.of(debugFolder));
filesystemScreenshotDebugger.debug(FilesystemScreenshotDebuggerTests.class, SUFFIX, new BufferedImage(10, 10, 5));
List<LoggingEvent> loggingEvents = testLogger.getLoggingEvents();
assertThat(loggingEvents, Matchers.hasSize(1));
LoggingEvent loggingEvent = loggingEvents.get(0);
String message = loggingEvent.getMessage();
assertEquals("Debug screenshot saved to {}", message);
assertEquals(Level.DEBUG, loggingEvent.getLevel());
assertThat(loggingEvent.getArguments().get(0).toString(), stringContainsInOrder(List.of(debugFolder.toString(), "FilesystemScreenshotDebuggerTests_suffix.png")));
assertEquals(1, debugFolder.listFiles().length);
}
use of com.github.valfirst.slf4jtest.LoggingEvent in project vividus by vividus-framework.
the class SshOutputPublisherTests method publishOutputWithoutError.
@Test
void publishOutputWithoutError() {
String output = "success";
SshOutput sshOutput = new SshOutput();
sshOutput.setOutputStream(output);
sshOutputPublisher.publishOutput(sshOutput);
LoggingEvent loggingEvent = verifyStdoutAttachmentPublishing(output);
verifyNoMoreInteractions(attachmentPublisher);
assertThat(logger.getLoggingEvents(), equalTo(List.of(loggingEvent)));
}
Aggregations