Salesforce Summer ’13: Developer Features

There has been so much to cover in the release notes for Summer ’13, that I haven’t even touched on the features available for developers. There are some great things in this release for the developers as well! Here are some of my favorites.

RecentlyViewed Object

There is a new object called RecentlyViewed, that will be quite helpful. It allows you to query the recently viewed items list. It looks like the list stores the last 200 records per object that a user has viewed. You can’t query what another user has viewed, it only shows the current user’s recently viewed records.

In addition to this new object there are some new SOQL clauses: FOR VIEW and FOR REFERENCE. When you use either of these clauses in your SOQL queries, it will add the records returned to the RecentlyViewed object. While both clauses will update the RecentlyViewed object, they are meant to be used slightly differently. VIEW means the record has been viewed. REFERENCE means a related record has been viewed.

New Developer Console

The Developer Console has been updated with a new look and feel. That is all well and good, but the coolest new feature is Apex Code Completion. Completions are provided for Apex system objects and methods, user-defined objects and methods, and sObjects and fields. Just type Ctrl+Space to see your options.

TestVisible Annotation

This is a great new feature that will make testing your classes much easier. If you have private methods in a class, you can use the TestVisible annotation to make those private methods visible to test classes. This allows you to directly test the methods rather than rely on methods you do have access to. It makes finding bugs much simpler. There’s a good example in the release notes that shows how to use this new annotation.

DML Before Mock Callouts

Finally, this has been fixed! Mock callouts are great because they allow you to test your callouts rather than wrapping them with System.isRunningTest. The problem with these mockups before the summer release is that you can’t do any DML before the mock callout. That means you can’t setup any test data. Now you can insert test data before the callout is tested.

Test Methods Must Be in Test Classes

OK, this isn’t really something to be excited about, but it is important to note. To read up on why this change is important, read this great post on the topic.

2 thoughts on “Salesforce Summer ’13: Developer Features”

  1. I’m “cautiously optimistic” about the release in general. There are some good points to it, others that I think attention could have been spent better elsewhere. Take the Developer Console for instance. Code completion is ok, but is not essential. Couple that with the fact that the developer console has been very buggy, especially with Chrome, leads me to think they could have spent more effort in securing the stability of the developer console.

    The TestVisible annotation is another one I see as more of a “meh” functionality. Nice that they’re helping developers with some core unit testing functionality. However, I should, as a developer, have to access those variables through constructors or public methods. Otherwise, I have a problem with useless variables or I have way too much logic in my code. The TestVisibile annotation is another way for less than stellar developers to get around their fundamental design issues in their code.

    I like the last two features though. Forcing developers, for api versions of 28 or > at least, to write their test methods in separate classes is a good thing as it separates the tests from the application logic. It should also encourage developers to write more than a single unit test per each class, and hopefully test not only successful, but negative and boundary conditions as well. I wonder though if for auto generated classes, if they will adhere to the new test class shift. E.g. for Sites (kind of a bad example, I know), they create a test class for the SiteLoginController in the same class as the logic.

    I’m also glad they fixed the DMLException, supposedly. The Mock callout feature is/was pretty slick, until you hit that DML before a callout exception.

Leave a Reply