Skip to content

Commit

Permalink
Add functional test for XML report & unknown version number
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Oct 9, 2024
1 parent 7b97140 commit a959b1c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/groovy/me/champeau/gradle/BaseFunctionalTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ abstract class BaseFunctionalTest extends Specification {
hasReport('japi', 'html', lookup)
}

void hasXmlReport(String lookup = '') {
hasReport('japi', 'xml', lookup)
}

void hasRichReport(String lookup = '') {
hasReport('rich', 'html', lookup)
}
Expand All @@ -88,6 +92,10 @@ abstract class BaseFunctionalTest extends Specification {
assert !getReport('japi', 'html').exists()
}

void noXmlReport() {
assert !getReport('japi', 'xml').exists()
}

void noRichReport() {
assert !getReport('rich', 'html').exists()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class BomFunctionalTest extends BaseFunctionalTest {
hasTextReport('CLASS FILE FORMAT VERSION: 50.0 <- 50.0')
noSemverReport()
noHtmlReport()
noXmlReport()
noMarkdownReport()
noRichReport()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ClasspathIsUsedFunctionalTest extends BaseFunctionalTest {
noSemverReport()
noMarkdownReport()
noHtmlReport()
noXmlReport()
noRichReport()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Compare2JarsFunctionalTest extends BaseFunctionalTest {
noSemverReport()
noMarkdownReport()
noHtmlReport()
noXmlReport()
noRichReport()

when:
Expand All @@ -36,6 +37,7 @@ class Compare2JarsFunctionalTest extends BaseFunctionalTest {
noSemverReport()
noMarkdownReport()
noHtmlReport()
noXmlReport()
noRichReport()

when:
Expand Down
28 changes: 28 additions & 0 deletions src/test/groovy/me/champeau/gradle/ReportsFunctionalTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
noTxtReport()
noMarkdownReport()
noSemverReport()
noXmlReport()
noRichReport()

when:
Expand All @@ -34,6 +35,29 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
result.task(":japicmp").outcome == TaskOutcome.UP_TO_DATE
}

def "can generate an XML report"() {
when:
def result = run 'japicmpXml'

then:
result.task(":japicmpXml").outcome == TaskOutcome.SUCCESS
hasXmlReport('oldJar="commons-lang3-3.5.jar"')
hasXmlReport('newJar="commons-lang3-3.6.jar"')
hasXmlReport('oldVersion="unknown version"')
hasXmlReport('newVersion="unknown version"')
noTxtReport()
noMarkdownReport()
noSemverReport()
noHtmlReport()
noRichReport()

when:
result = run 'japicmpXml'

then:
result.task(":japicmpXml").outcome == TaskOutcome.UP_TO_DATE
}

def "can generate rich report"() {
when:
def result = run 'japicmpRich'
Expand All @@ -46,6 +70,7 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
noMarkdownReport()
noSemverReport()
noHtmlReport()
noXmlReport()

when:
result = run 'japicmpRich'
Expand All @@ -64,6 +89,7 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
noTxtReport()
noMarkdownReport()
noHtmlReport()
noXmlReport()
noRichReport()

when:
Expand All @@ -84,6 +110,7 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
noTxtReport()
noSemverReport()
noHtmlReport()
noXmlReport()
noRichReport()

when:
Expand All @@ -104,6 +131,7 @@ class ReportsFunctionalTest extends BaseFunctionalTest {
noTxtReport()
noSemverReport()
noHtmlReport()
noXmlReport()
noRichReport()

when:
Expand Down
6 changes: 6 additions & 0 deletions src/test/test-projects/html-report/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ task japicmpSemver(type: me.champeau.gradle.japicmp.JapicmpTask) {
newClasspath.from(configurations.current)
semverOutputFile = layout.buildDirectory.file('reports/japi.semver').get().asFile
}

task japicmpXml(type: me.champeau.gradle.japicmp.JapicmpTask) {
oldClasspath.from(configurations.baseline)
newClasspath.from(configurations.current)
xmlOutputFile = layout.buildDirectory.file('reports/japi.xml').get().asFile
}

0 comments on commit a959b1c

Please sign in to comment.