Skip to main content

Could not run tests - Solution

Today I have written a test class, having only one test method into it. When I ran the test class to check for code coverage, I got a very strange error saying "could not run tests on <Id of test class>". Whereas it was showing that the test method run successfully with desired result in terms of code coverage. I further tried to update the test class and it again gave very strange error "java.lang.reflect.InvocationTargetException". 

Initially I thought there is something wrong with my class and cross checked for syntax, identifier etc. After making sure that there is nothing wrong with class, I went to see if anyone faced same issue before. I found actually quite a few and below is solution to get rid of this:-


  1. Go to App Setup >> Develop >> Apex Test Execution and click on "Options".
  2. Uncheck 'Disable Parallel Apex Testing' and click on Ok.
  3. Go to App Setup >> Develop >> Apex Test Execution and click on "View Test History".
  4. Click on 'Clear Test Results' button.


Go back to test class, try to run it or edit it and you shoule be able to do so.

Comments

Popular posts from this blog

Mashup Integration in Salesforce

During preparation for TA certification exam, I came across a word Mashup for integration a number of times. I explored about it and below is description:- Mashups, sometimes called “composites,” are hybrid applications created by bringing together several data sources and Web services to create a new application or to add value to an existing application. Behind the scenes, mashups may require different levels of integration, depending on whether the mashed-up data is only meant to be viewed, whether it can be edited, and whether data is actually transferred between systems. There are three types of mashup:- Client Presentation Mashup - In this type of mashup the integration takes place strictly at the visual level. It makes possible to view data from two or more applications in a browser,  without actually moving data between the applications. Example - Google Maps. Client Service Mashup - As mashups evolve, they are becoming more complex and sophisticated. Client...

Make Calls to PageReference.getContent() in Asynchronous Apex - Winter16

You can now make calls to the getContent() and getContentAsPdf() methods of the PageReference class from within asynchronous Apex such as Batch Apex, Schedulable and Queueable classes, and @future methods. This allows you to design much more flexible and scalable services that, for example, render Visualforce pages as PDF files.

Hierarchical Relationship

Recently, I came across one of requirement where client wanted to have a custom lookup field on User object. This lookup will be on User. Based upon certain criteria, value of this field will go to Manager field. They didn't want update of Manager, but on the basis of some business use case. First impression to me was it will be straight forward to create a lookup on user and then in trigger will check for business use case and update Manager field accordingly. However, when I proceed with creating a look on User object, I couldn't find an option ' Lookup Relationship ' on first screen of 'New Custom Field'.  In fact, I saw only available option ' Hierarchical Relationship ' for creating any sort of relationship. I know most of us know about it. But you can't defer on my opinion that we tend to forget these small stuff. Since, on user you can't have any direct relationship, but only user. Salesforce gives you special relationship data t...