Conversation
Bumps [database](https://github.com/jenkinsci/database-plugin) from 117.va2009e38b882 to 128.vaa83e142f7f2. - [Release notes](https://github.com/jenkinsci/database-plugin/releases) - [Commits](https://github.com/jenkinsci/database-plugin/commits) --- updated-dependencies: - dependency-name: org.jenkins-ci.plugins:database dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts: # pom.xml
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts: # pom.xml
|
|
||
| JUnitBuildSummary buildSummary = new JUnitBuildSummary(build); | ||
|
|
||
| assertThat(buildSummary.getTitleText()).containsAnyOf("no failures", "0 failures"); |
There was a problem hiding this comment.
It would make sense to split the title into the link and the text in the brackets and check both of them
| JUnitBuildSummary buildSummary = new JUnitBuildSummary(build); | ||
|
|
||
| assertThat(buildSummary.getTitleText()).containsAnyOf("no failures", "0 failures"); | ||
| assertThat(buildSummary.getFailureNames()).isEmpty(); |
There was a problem hiding this comment.
Use the generated assertions:
| assertThat(buildSummary.getFailureNames()).isEmpty(); | |
| assertThat(buildSummary).hasNoFailureNames(); |
| assertThat(buildSummary.getFailureNames()) | ||
| .containsExactlyInAnyOrder("JUnit.testScore[0]", "JUnit.testScore[1]", "JUnit.testScore[2]", "TestNG.testScore", "TestNG.testScore", "TestNG.testScore"); | ||
| } | ||
| } |
There was a problem hiding this comment.
Since the build summary supports navigation using links, it would be helpful to check these as well (and navigate to the detail pages)
| assertThat(buildTestResultsByClass.getTestTableEntries()).extracting(List::size).isEqualTo(2); | ||
|
|
||
| TestUtils.assertElementInCollection(buildTestResultsByClass.getTestTableEntries(), | ||
| testTableEntry -> testTableEntry.getTestName().equals("testAppFailNoMessage"), | ||
| testTableEntry -> testTableEntry.getTestName().equals("testAppFailNoStacktrace")); |
There was a problem hiding this comment.
AssertJ is your friend, make usage of the API:
assertThat(buildTestResultsByClass.getTestTableEntries())
.hasSize(2)
.extracting(TestTableEntry::getTestName)
.containsExactly("testAppFailNoMessage", "testAppFailNoStacktrace");
Seems that your import is wrong (in all tests!), you need to import
import static io.jenkins.plugins.analysis.junit.Assertions.*;
| .openTestResultsByClass("ApplicationTest"); | ||
|
|
||
| TestUtils.assertElementInCollection(buildTestResultsByClass.getTestTableEntries(), | ||
| tableEntry -> tableEntry.getTestName().equals("testAppFail") && tableEntry.getStatus().equals("Failed"), |
| * @param predicates assertion criteria | ||
| * @param <E> the type of elements in this collection | ||
| */ | ||
| public static <E> void assertElementInCollection(Collection<E> collection, |
There was a problem hiding this comment.
Should work out of the box with standard AssertJ
| */ | ||
| public class BuildChartEntry { | ||
|
|
||
| final int buildId; |
| WebElement mainPanel = getElement(By.cssSelector("#main-panel")); | ||
| packageLinks = TestResultsTableUtil.getLinksOfTableItems(mainPanel); | ||
| packageTableEntries = initializePackageTableEntries(mainPanel); |
There was a problem hiding this comment.
Extract duplicate code into method
| WebElement mainPanel = getElement(By.cssSelector("#main-panel")); | ||
| testLinks = TestResultsTableUtil.getLinksOfTableItems(mainPanel); | ||
| testTableEntries = initializeTestTableEntries(mainPanel); |
There was a problem hiding this comment.
Extract duplicate code into method
| WebElement mainPanel = getElement(By.cssSelector("#main-panel")); | ||
| classLinks = TestResultsTableUtil.getLinksOfTableItems(mainPanel); | ||
| classTableEntries = initializeClassTableEntries(mainPanel); |
There was a problem hiding this comment.
Extract duplicate code into method
See #342.
The first two commits have been moved to a separate branch so that GitHub UI will not freeze during reviews anymore.