This repository was archived by the owner on Jun 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
057340c
Ignore broken algolia links
jt-nti d0270e0
Ignore broken algolia links (#863)
jt-nti c3bc0f3
Add IMS TM Managers link to top level Managers page
ideeley ccd9b85
Add IMS TM Managers link to top level Managers page (#861)
jt-nti 039b186
Exclude github.com from link checks
jt-nti 6bc22d4
Exclude github.com from link checks (#872)
jt-nti 117814b
Fix incorrect annotation in documentation
jadecarino 24ebc0f
Add documentation for the TestResultProvider annotation
jadecarino 57c938f
docs: Add information about the --tags flag for galasactl runs get
eamansour 2c31d31
Update docs for 0.41.0 release
jt-nti e71260a
Release 0.41.0 doc updates (#873)
jt-nti 32daaed
Merge remote-tracking branch 'upstream/main' into merge-main-20250509
jt-nti 743ddbc
Merge main 20250509 (#875)
jt-nti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/markdown-pages/docs/writing-own-tests/test-result-provider.md
jt-nti marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| path: "/docs/writing-own-tests/test-result-provider" | ||
| title: "Controlling code execution after test failure" | ||
| --- | ||
|
|
||
| As a tester, you may want the ability to access the result so far of a Galasa test at different points during the test lifecycle, to control the execution of code based on that result. | ||
|
|
||
| The `ITestResultProvider` can be used to get the test result so far after the first method invokation in a test. It can give you access to if the test is in Passed or Failed state. You can then check the result so far in your test code and choose to call or not call non-test methods based on this. | ||
|
|
||
| The annotation `@TestResultProvider` injects a `ITestResultProvider` object into your test class. The Core Manager updates the provider with the test result so far after each `@BeforeClass`, `@Before`, `@Test`, `@After` and `@AfterClass` method. | ||
|
|
||
| To use this capability, simply include the lines of code below in your test: | ||
|
|
||
| ```java | ||
| @TestResultProvider | ||
| public ITestResultProvider testResultProvider; | ||
| ``` | ||
|
|
||
| In the example below, the `@AfterClass` method retrieves the result from the `ITestResultProvider` and checks if it is Failed. If the result is Failed, the method `myCustomCleanupMethod` is called which could contain some diagnostic collection or clean up of resources, which the tester only wants to be run if the test Failed. | ||
|
|
||
| ```java | ||
| @AfterClass | ||
| public void afterClassMethod() throws FrameworkException { | ||
| if (testResultProvider.getResult().isFailed()) { | ||
| myCustomCleanupMethod(); | ||
| } | ||
| } | ||
|
|
||
| private void myCustomCleanupMethod() { | ||
| try { | ||
| // Some custom cleanup logic that only happens on failures. | ||
| } catch(Exception ex) { | ||
| logger.error("Failing while cleaning up in myCustomCleanupMethod()"); | ||
| // Ignore the problem. | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.