GithubHelp home page GithubHelp logo

yebihara / apextestplus Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 11.0 499 KB

A custom Ant task to make TDD for Apex (Force.com) easier and faster

License: BSD 2-Clause "Simplified" License

CSS 10.50% Java 89.50%

apextestplus's People

Contributors

yebihara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apextestplus's Issues

Managed Classes and Triggers causing NullPointerException

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 Class

However, 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!

NullPointerException caused by splitting a debug log

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!

@meramo64,

Could you provide a file, test_result/debuglogs/debug.log?
I think it contains something I didn't expect.

Thanks!

force.com api 37 is not supported

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.