yebihara / apextestplus Goto Github PK
View Code? Open in Web Editor NEWA custom Ant task to make TDD for Apex (Force.com) easier and faster
License: BSD 2-Clause "Simplified" License
A custom Ant task to make TDD for Apex (Force.com) easier and faster
License: BSD 2-Clause "Simplified" License
Hey. I really like this tool. I think it is very useful for automating testmethods and seeing code coverage. There is only one problem I see with it so far. Managed Classes and Trigger from Managed Packages.
A test I ran to confirm this was to create a dev account and create some classes with some testmethods and no installed Packages. Your tool ran perfectly. However, when i installed "EasyDescibe", a managed package with no visibility to classes or triggers, when i ran the tool again i got a null pointer exception:
BUILD FAILED
build.xml:86: java.lang.NullPointerException
at com.force.jp.ant.apextestplus.TestResult.genCoverageResultsHtml(Unknown Source)
at com.force.jp.ant.apextestplus.TestResult.visualizeCoverageResults(Unknown Source)
at com.force.jp.ant.apextestplus.RunTestTask.execute(Unknown Source)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
What i think maybe happening is this. When I ran the metadata API call to Salesforce to runAllTests, it kicked back a portion of XML that was referring to one of the managed classes and telling where exact lines were skipped:
01pE0000001fPVhIAM 0 75 0 -1.0 0 77 0 -1.0 0 88 0 -1.0 0 89 0 -1.0 0 90 0 -1.0 DescribeObjectCon EasyDescribe 50 5 ClassHowever, when you look at the actual class that was downloaded, the only thing inside of it was:
(hidden)
So i think the problem is when you are trying to highlight the missing Line number and you dont see it, it throws a null pointer exception.
The way Salesforce handles this in there UI is to not let the user see the Line missing Hit UI, they do not create a Hyperlink for the Code Coverage Percentage for managed classes or triggers.
I think if you just create a condition where if the class is managed or has "(hidden)" as its content, just report its code coverage percentage and not show the associated Debug log for it and not show the Line Graph thing, then you are in business.
Thanks I hope you can get this done soon!
This issue was split from #1 because the NullPointerException is caused by a different problem from the original issue of #1.
Hi @yebihara,
Here is the exception I run into. I only get this with certain classes but I am thinking it might be the same as the issue above:
[apextestplus:runTest] java.lang.NullPointerException
[apextestplus:runTest] at java.util.TreeMap.getEntry(TreeMap.java:324)
[apextestplus:runTest] at java.util.TreeMap.get(TreeMap.java:255)
[apextestplus:runTest] at com.force.jp.ant.apextestplus.TestResult.separateDebugLog(TestResult.java:187)
[apextestplus:runTest] at com.force.jp.ant.apextestplus.RunTestTask.execute(RunTestTask.java:76)
[apextestplus:runTest] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[apextestplus:runTest] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[apextestplus:runTest] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[apextestplus:runTest] at java.lang.reflect.Method.invoke(Method.java:597)
[apextestplus:runTest] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[apextestplus:runTest] at org.apache.tools.ant.Task.perform(Task.java:348)
[apextestplus:runTest] at org.apache.tools.ant.Target.execute(Target.java:435)
[apextestplus:runTest] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[apextestplus:runTest] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[apextestplus:runTest] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[apextestplus:runTest] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[apextestplus:runTest] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[apextestplus:runTest] at org.apache.tools.ant.Main.runBuild(Main.java:851)
[apextestplus:runTest] at org.apache.tools.ant.Main.startAnt(Main.java:235)
[apextestplus:runTest] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[apextestplus:runTest] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
BTW this tool looks really helpful and I hope to be able to test it further.
If you prefer I open a new case, please let me know.
Thanks!
Could you provide a file, test_result/debuglogs/debug.log?
I think it contains something I didn't expect.
Thanks!
The method validateAttributes() from the type SFDCAntTask is not visible and throws an error. The jar does function correctly with API 31.0. note commons-lang3-3.4.jar did not work and commons-lang2.6.jar is required.
The following error is thrown
java.lang.IllegalAccessError: triedto access method com.salesforce.ant.SFDCAntTask.validateAttributes()V from class
com.force.jp.ant.apextestplus.RunTestTask
at com.force.jp.ant.apextestplus.RunTestTask.execute(RunTestTask.java:38
)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:854)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.