I am trying to perform Code Coverage analysis for my JUnit Test Classes but it is throwing following error :
I have created two separate folders (main and test).
I am not able to create a clean build.
Class not found com.automationanywhere.botcommand.oexcelonline.commands.range.DeleteRangeTest
java.lang.ClassNotFoundException: com.automationanywhere.botcommand.oexcelonline.commands.range.DeleteRangeTest
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:773)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:502)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Class not found com.automationanywhere.botcommand.oexcelonline.commands.workbook.OpenWorkbookTest
A very simple and absolute alternative who are trying gradle and want to check up their code Coverage.
Before following steps mentioned below, just add few dependencies within your build.gradle file:
apply plugin: "jacoco"
jacoco {
toolVersion = "0.8.4"
reportsDir = file("$buildDir/")
}
tasks.withType(Test) { task -> jacoco { destinationFile =
file("$buildDir/reports/jacoco/${task.name}.exec") } }
jacocoTestReport {
reports {
html.enabled true
xml.enabled true
csv.enabled true
html.destination file("${buildDir}/jacocoHtml")
}}
follow these steps:
that's all you need. now go to build->jacocoHTML->index.html
Enjoy..