Skip to content

Commit fadf201

Browse files
author
MohitMaliFtechiz
committed
Run test cases via gradle task
We are compiling and running test cases via gradle task and removing compile_and_run_test.sh as it is only for running test cases.
1 parent 14109ec commit fadf201

3 files changed

Lines changed: 14 additions & 48 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
./gradlew assemble
3838
39-
- name: Genrate Source jar
39+
- name: Generate Source jar
4040
run: |
4141
./gradlew androidSourcesJar
4242

lib/build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,21 @@ task renameLibkiwixSoFile(type: Copy) {
281281
}
282282
}
283283

284+
task compileTestFile(type: Exec) {
285+
workingDir "${projectDir}/src/test/"
286+
commandLine 'javac', '-g', '-d', '.', '-s', '.', '-cp', 'junit-4.13.jar:' + buildDir.path +'/libs/*', 'test.java'
287+
}
288+
289+
task runTests(type: Exec) {
290+
workingDir "${projectDir}/src/test/"
291+
dependsOn compileTestFile
292+
commandLine 'java', '-Djava.library.path=' + buildDir.path, '-javaagent:jacoco-0.8.7/lib/jacocoagent.jar', '-cp', 'junit-4.13.jar:hamcrest-core-1.3.jar:' + buildDir.path +'/libs/*lib*.jar' + ':.', 'org.junit.runner.JUnitCore', 'test'
293+
}
294+
284295
task createCodeCoverageReport(type: Exec) {
285296
workingDir "${projectDir}/src/test/"
286-
commandLine 'sh', '-c', "bash 'compile_and_run_test.sh' ${buildDir}/libs/*lib*.jar $buildDir"
297+
dependsOn runTests
298+
commandLine 'java', '-jar', 'jacoco-0.8.7/lib/jacococli.jar', 'report', 'jacoco.exec', '--classfiles', 'org/kiwix/libkiwix/', '--classfiles', 'org/kiwix/libzim/', '--html', '../../build/coverage-report', '--xml', 'coverage.xml'
287299
}
288300

289301
task checkCurrentJavaVersion() {

lib/src/test/compile_and_run_test.sh

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

0 commit comments

Comments
 (0)