Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
feat(): fix pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
DelaunayAlex committed Jan 12, 2024
1 parent 22a86e5 commit 1c68b8d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Status execute(ScenarioExecution scenarioExecution,
iterations.forEach(it -> {
HashMap<String, Object> mergedContext = new HashMap<>(localContext);
mergedContext.putAll(it.getRight());
DefaultStepExecutionStrategy.instance.execute(scenarioExecution, it.getLeft()/*step*/, scenarioContext, mergedContext/*localContext*/, strategies);
DefaultStepExecutionStrategy.instance.execute(scenarioExecution, it.getLeft(), scenarioContext, mergedContext, strategies);
});

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class StepStateTest {

@Test
void should_change_state() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();

stepState.successOccurred();
assertThat(stepState.status()).isEqualTo(Status.SUCCESS);
Expand All @@ -55,7 +55,7 @@ void should_change_state() {

@Test
void should_handle_null_or_empty_errors() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();

stepState.errorOccurred(null, "");
stepState.addErrors(null, "");
Expand All @@ -65,7 +65,7 @@ void should_handle_null_or_empty_errors() {

@Test
void should_handle_null_or_empty_informations() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();

stepState.successOccurred(null, "");
stepState.addInformation(null, "");
Expand All @@ -75,7 +75,7 @@ void should_handle_null_or_empty_informations() {

@Test
void should_manage_watch_with_idempotency() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();

List<Long> durations = new ArrayList<>();
IntStream.range(1, 5).forEach(i -> {
Expand All @@ -100,7 +100,7 @@ void should_manage_watch_with_idempotency() {

@Test
void should_manage_watch_independently_of_status() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
Status initialStatus = stepState.status();

stepState.startWatch();
Expand All @@ -113,7 +113,7 @@ void should_manage_watch_independently_of_status() {
@Test
void should_change_status_and_clean_logs_when_reset() {
// Given
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
stepState.addInformation("...");
stepState.errorOccurred("...");

Expand All @@ -132,7 +132,7 @@ void should_change_status_and_clean_logs_when_reset() {

@Test
void should_begin_execution() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();

stepState.beginExecution();
awaitDuring(100, MILLISECONDS);
Expand All @@ -155,7 +155,7 @@ void should_begin_execution() {

@Test
void should_end_execution() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
stepState.startWatch();
Status initialStatus = stepState.status();
awaitDuring(100, MILLISECONDS);
Expand All @@ -175,7 +175,7 @@ void should_end_execution() {

@Test
void should_change_parent_step_running_status_when_end_execution() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
stepState.beginExecution();
assertThat(stepState.status()).isEqualTo(Status.RUNNING);

Expand All @@ -191,7 +191,7 @@ class ConcurrentMessagesModification {
class Informations {
@RepeatedTest(20)
void add_information() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
for (int i = 0; i < 10000; i++) {
stepState.addInformation("info " + i);
}
Expand All @@ -208,7 +208,7 @@ void add_information() {

@RepeatedTest(20)
void success_occurred() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
for (int i = 0; i < 10000; i++) {
stepState.addInformation("info " + i);
}
Expand All @@ -228,7 +228,7 @@ void success_occurred() {
class Errors {
@RepeatedTest(20)
void add_error() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
for (int i = 0; i < 10000; i++) {
stepState.addErrors("error " + i);
}
Expand All @@ -245,7 +245,7 @@ void add_error() {

@RepeatedTest(20)
void error_occurred() {
StepState stepState = new StepState("Test");
StepState stepState = new StepState();
for (int i = 0; i < 10000; i++) {
stepState.addErrors("error " + i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,24 @@ public void should_accept_nested_loops_and_override_dataset() {
public void should_accept_nested_loops_with_different_dataset() {
// G
final TestEngine testEngine = new ExecutionConfiguration().embeddedTestEngine();
ExecutionRequestDto requestDto = Jsons.loadJsonFromClasspath("scenarios_examples/forEachStrategy/step_nested_iterations_with_extended_dataset.json", ExecutionRequestDto.class);
ExecutionRequestDto requestDto = Jsons.loadJsonFromClasspath("scenarios_examples/forEachStrategy/step_nested_iterations_with_different_dataset.json", ExecutionRequestDto.class);

// W
StepExecutionReportDto result = testEngine.execute(requestDto);

// T
StepExecutionReportDto parentIterativeStep = result.steps.get(0);
assertThat(parentIterativeStep.steps).hasSize(2); // has 2 iterations
assertThat(result.status).isEqualTo(SUCCESS);
assertThat(result).hasFieldOrPropertyWithValue("status", SUCCESS);
assertThat(result.name).isEqualTo("Test iterations");
assertThat(result.steps).hasSize(1);
assertThat(result.steps.get(0).name).isEqualTo("<i> - Hello env ${#env} ");
assertThat(result.steps.get(0).steps).hasSize(2);
assertThat(result.steps.get(0).steps.get(0).name).isEqualTo("0 - Hello env envX ");
assertThat(result.steps.get(0).steps.get(1).name).isEqualTo("1 - Hello env envY ");
assertThat(result.steps.get(0).steps.get(0).steps).hasSize(1);
assertThat(result.steps.get(0).steps.get(0).steps.get(0).name).isEqualTo("<j> - Hello nested on envX with user ${#user}");
assertThat(result.steps.get(0).steps.get(0).steps.get(0).steps).hasSize(2);
assertThat(result.steps.get(0).steps.get(0).steps.get(0).steps.get(0).name).isEqualTo("0 - Hello nested on envX with user userA");
assertThat(result.steps.get(0).steps.get(0).steps.get(0).steps.get(1).name).isEqualTo("1 - Hello nested on envX with user userB");
}

@Test
Expand Down

0 comments on commit 1c68b8d

Please sign in to comment.