Skip to content
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

feat(#1218): add events on TestListener #1313

Conversation

phos-web
Copy link
Contributor

@phos-web phos-web commented Feb 6, 2025

Related issue.

The following methods have been added to the TestListener interface:

default void onTestEnd(TestCase test)
default void onFinalActionsEnd(TestCase test)
default void onAfterSequenceBeforeTest(TestCase test)
default void onAfterSequenceAfterTest(TestCase test)
default void onBeforeSequenceBeforeTest(TestCase test)
default void onBeforeSequenceAfterTest(TestCase test)

Tests have been written in DefaultCaseTest

@christophd
Copy link
Member

what is the difference of onTestEnd compared to the existing onTestFinished?

@christophd
Copy link
Member

Maybe we can rename onAfterSequenceBeforeTest to onBeforeTestFinished and onAfterSequenceAfterTest to onAfterTestFinished

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch 2 times, most recently from 97fb8b8 to 32f2a48 Compare February 6, 2025 10:10
Copy link
Member

@christophd christophd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments to better understand the use case. Many thanks!

@phos-web phos-web changed the title feat(#1218): add events on TestListener Draft: feat(#1218): add events on TestListener Feb 6, 2025
@phos-web phos-web marked this pull request as draft February 6, 2025 11:08
@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from 32f2a48 to 6de0174 Compare February 6, 2025 11:38
@tschlat
Copy link
Collaborator

tschlat commented Feb 6, 2025

Some comments to better understand the use case. Many thanks!

Could you please check the associated issued #1218? I added an example there. Hope the use case gets clear from that.

@tschlat
Copy link
Collaborator

tschlat commented Feb 6, 2025

what is the difference of onTestEnd compared to the existing onTestFinished?

Please re-check the javadoc. Hope that we have documented it well now.

@tschlat
Copy link
Collaborator

tschlat commented Feb 6, 2025

Maybe we can rename onAfterSequenceBeforeTest to onBeforeTestFinished and onAfterSequenceAfterTest to onAfterTestFinished

Sry for bringing up a MR in draft state. I think it is now ready for review. Some things have changed after our internal review. Could you please re-check the methods on the interface, having in mind the sketched use case in #1218.

From that please give your final opinion on the feature and method names.
Thx.

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from 1f1d462 to 35a4eaf Compare February 7, 2025 07:25
@phos-web phos-web marked this pull request as ready for review February 7, 2025 07:32
@phos-web phos-web marked this pull request as draft February 7, 2025 07:32
@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch 2 times, most recently from 10d1e28 to 22a89d4 Compare February 7, 2025 08:21
@tschlat
Copy link
Collaborator

tschlat commented Feb 7, 2025

Looks good to me.
Well done.

@phos-web phos-web marked this pull request as ready for review February 7, 2025 08:23
@tschlat
Copy link
Collaborator

tschlat commented Feb 7, 2025

Still I would like a comment from @christophd as this significantly touches the heart of the framework.
Please check again for suggestions on methods and namings.

@tschlat tschlat requested a review from christophd February 7, 2025 08:24
@phos-web phos-web changed the title Draft: feat(#1218): add events on TestListener feat(#1218): add events on TestListener Feb 7, 2025
@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from 22a89d4 to fa8b9b4 Compare February 7, 2025 09:12
Copy link
Collaborator

@bbortt bbortt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done. no change requested from my side, maybe suggested 😉 up to you.

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch 2 times, most recently from fd7490b to 7dc45b5 Compare February 10, 2025 07:58
@christophd
Copy link
Member

okay folks, I have had a tough week last week. I am back on having a look this week. Sorry for the delay

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch 2 times, most recently from ce9ac5b to e431265 Compare February 10, 2025 14:43
Copy link
Member

@christophd christophd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the enhancement. Looks good.

As mentioned in one of the comments I would prefer to move the onTestFinish() method after the final actions have finished. It feels more natural IMO as the final actions belong to the test. Sort of a breaking change, but someone can use the new onFinalActionsStart().

Also, still not a fan of the method names onBeforeSequenceBeforeTest(). I'd suggest to use onBeforeTestStart() instead.

So we end up with this:

  • onBeforeSequenceBeforeTest -> onBeforeTestStart
  • onAfterSequenceBeforeTest -> onBeforeTestFinish
  • onBeforeSequenceAfterTest -> onAfterTestStart
  • onAfterSequenceAfterTest -> on AfterTestFinish

We could also use *End instead of *Finish. No strong opinion on that detail

Many thanks. Please let me know what you think

@tschlat
Copy link
Collaborator

tschlat commented Feb 12, 2025

Thanks a lot for the enhancement. Looks good.

As mentioned in one of the comments I would prefer to move the onTestFinish() method after the final actions have finished. It feels more natural IMO as the final actions belong to the test. Sort of a breaking change, but someone can use the new onFinalActionsStart().

Also, still not a fan of the method names onBeforeSequenceBeforeTest(). I'd suggest to use onBeforeTestStart() instead.

So we end up with this:

  • onBeforeSequenceBeforeTest -> onBeforeTestStart
  • onAfterSequenceBeforeTest -> onBeforeTestFinish
  • onBeforeSequenceAfterTest -> onAfterTestStart
  • onAfterSequenceAfterTest -> on AfterTestFinish

We could also use *End instead of *Finish. No strong opinion on that detail

Many thanks. Please let me know what you think

Thanks for the valuable feedback. I think we mixed implementation name 'SequenceBefore' with the interface name 'BeforeTest'. Finally, we come up with the following naming:

onTestStart (very beginning)
   onBeforeTestStart
   onBeforeTestEnd
   onTestExecutionStart
      onFinalActionStart
      onFinalActionEnd
   onTestExecutionEnd (previously onTestFinish which is now deprecated)
   onAfterTestStart
   onAfterTestEnd
onTestEnd (very end)

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from 6ee2b6c to 49d1363 Compare February 12, 2025 12:42
@phos-web phos-web requested a review from tschlat February 12, 2025 12:43
@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from 49d1363 to 824d69f Compare February 12, 2025 12:51
Copy link
Collaborator

@tschlat tschlat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@tschlat
Copy link
Collaborator

tschlat commented Feb 12, 2025

Please check that the pipeline executes.

@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch 2 times, most recently from 2f903a4 to a04c129 Compare February 12, 2025 14:24
@phos-web phos-web force-pushed the fix/TAT-1848-Buffered-Logging-for-Parallel-Test-Execution branch from a04c129 to 332b6d0 Compare February 12, 2025 14:29
@tschlat
Copy link
Collaborator

tschlat commented Feb 12, 2025

Ok everyone, the pipeline is green. I'll proceed with the merge if there are no further objections.

@tschlat tschlat merged commit 56a054a into citrusframework:main Feb 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend LoggingReporter to report on Sequence execution and TestAction failure
4 participants