Skip to content

Commit c4c565c

Browse files
authored
Merge pull request #437 from TESTARtool/master_development
Refactor and bug fixes of the Generate mode logic
2 parents 149df10 + 6836f85 commit c4c565c

17 files changed

Lines changed: 686 additions & 309 deletions

File tree

.github/workflows/test-windows-desktop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: Build TESTAR with Gradle
3434
run: ./gradlew build
3535

36+
- name: Check TESTAR JUnit summary
37+
run: ./gradlew coverageReportSummary
38+
3639
- name: Prepare installed distribution of TESTAR with Gradle
3740
run: ./gradlew installDist
3841

.github/workflows/test-windows-webdriver.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: Build TESTAR with Gradle
3434
run: ./gradlew build
3535

36+
- name: Check TESTAR JUnit summary
37+
run: ./gradlew coverageReportSummary
38+
3639
- name: Prepare installed distribution of TESTAR with Gradle
3740
run: ./gradlew installDist
3841

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.2
1+
2.7.3

build.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'checkstyle'
2+
apply from: 'coverage-report.gradle'
23

34
subprojects {
45
apply plugin: 'java'
@@ -46,5 +47,27 @@ subprojects {
4647
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.1'
4748
}
4849

50+
jacoco {
51+
toolVersion = '0.8.12'
52+
}
53+
54+
test {
55+
useJUnit()
56+
finalizedBy jacocoTestReport
57+
}
58+
4959
buildDir = new File('./target')
60+
61+
jacocoTestReport {
62+
dependsOn test
63+
64+
reports {
65+
xml.required.set(true)
66+
html.required.set(false)
67+
csv.required.set(false)
68+
html.outputLocation.set(file("${buildDir}/jacocoHtml"))
69+
xml.outputLocation.set(file("${buildDir}/jacoco.xml"))
70+
}
71+
}
72+
5073
}

core/src/org/testar/monkey/alayer/Verdict.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public enum Severity {
7171

7272
UNREPLAYABLE(0.5, "UNREPLAYABLE"), // Sequence not replayable
7373
SUSPICIOUS_TAG(0.8, "SUSPICIOUS_TAG"), // Suspicious tag
74+
SUSPICIOUS_PROCESS(0.87, "SUSPICIOUS_PROCESS"), // Suspicious message in the process standard output/error
7475
SUSPICIOUS_LOG(0.89, "SUSPICIOUS_LOG"), // Suspicious message in log file or command output (LogOracle)
7576
NOT_RESPONDING(0.99999990, "NOT_RESPONDING"), // Unresponsive
7677
UNEXPECTEDCLOSE(0.99999999, "UNEXPECTEDCLOSE"), // Crash? Unexpected close?

coverage-report.gradle

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import groovy.xml.XmlSlurper
2+
3+
task coverageReportSummary {
4+
group = 'Verification'
5+
description = 'Prints Jacoco coverage summary for all subprojects'
6+
7+
doLast {
8+
def totalCovered = 0
9+
def totalMissed = 0
10+
def results = []
11+
12+
println ""
13+
println "+---------------------------+---------------------+"
14+
println "| Project | Branch Coverage (%) |"
15+
println "+---------------------------+---------------------+"
16+
17+
subprojects.each { subproject ->
18+
def reportFile = file("${subproject.name}/target/jacoco.xml")
19+
if (reportFile.exists()) {
20+
def xmlText = reportFile.text.replaceFirst(/<!DOCTYPE[^>]*>\s*/, '')
21+
def report = new XmlSlurper().parseText(xmlText)
22+
def counter = report.counter.find { it.@type == 'BRANCH' }
23+
24+
if (counter) {
25+
def missed = counter.@missed.toInteger()
26+
def covered = counter.@covered.toInteger()
27+
def total = missed + covered
28+
def percent = total > 0 ? (covered * 100.0 / total) : 0
29+
30+
results << [project: subproject.name, percent: percent]
31+
32+
totalCovered += covered
33+
totalMissed += missed
34+
} else {
35+
results << [project: subproject.name, percent: null]
36+
}
37+
} else {
38+
results << [project: subproject.name, percent: null]
39+
}
40+
}
41+
42+
results.each {
43+
def name = it.project.padRight(26)
44+
def coverage = it.percent != null ?
45+
String.format("%20.2f", it.percent) :
46+
" N/A "
47+
println "| ${name}|${coverage} |"
48+
}
49+
50+
println "+---------------------------+---------------------+"
51+
52+
def grandTotal = totalCovered + totalMissed
53+
if (grandTotal > 0) {
54+
def totalPercent = totalCovered * 100.0 / grandTotal
55+
println "| TOTAL |" +
56+
String.format("%20.2f", totalPercent) + " |"
57+
} else {
58+
println "| TOTAL | N/A |"
59+
}
60+
61+
println "+---------------------------+---------------------+\n"
62+
}
63+
}

testar/src/org/testar/ProcessListener.java

Lines changed: 0 additions & 263 deletions
This file was deleted.

0 commit comments

Comments
 (0)