Search
Twitter

Entries in development testing (2)

Wednesday
May012013

Explore the Different Messaging Options in VisualForce (Part 2)

This post begins where Part 1 left off; continuing to explore the different messaging options in VisualForce.

  • apex:message allows for field-specific errors. Let's look the code below and see how it renders:
<apex:page controller="TestMessageController">
    <apex:form >
        <apex:outputLabel value="Test String" /><apex:inputField value="{!test.Name}" id="test"/>
        <br/><apex:message for="test"/>
    </apex:page>
 
public class TestMessageController{
    public Account test {get;set;}
    public TestMessageController(){
        test = new Account();
        test.Id.addError('Correct');
        test.Name.addError('Wrong');
 
    }
}
  • The last option we have is apex:messages, which is similar to apex:message, except that it displays all errors in a list. Let's incorporate the apex:messages in the previous code and see how it renders:
<apex:page controller="TestMessageController">
    <apex:messages />
    <apex:form >
      <apex:outputLabel value="Test String" /><apex:inputField value="{!test.Name}" id="test"/>
      <br/><apex:message for="test"/>
    </apex:form>
</apex:page>
 
public class TestMessageController{
    public Account test{get;set;}
    public TestMessageController(){
        test = new Account();
        test.Id.addError('Correct');
        test.Name.addError('Wrong');
    }
}
Thursday
Jun162011

Test Org or Sandbox?

As a Salesforce developer, I am constantly in need of test environments.  Fortunately Salesforce makes it fairly easy to access various flavors of the Salesforce platform for development and testing.  I’m sure this isn’t news to anyone out there, but it took me a few weeks to understand how to work with the resources that Salesforce makes available.

We’d all love to have a complex test environment that mirrors, or at least closely mirrors, real life scenarios.  But for most of us, that’s not always possible.  I use a list of friendly testers who have real Salesforce orgs, but it’s not always possible to take advantage of their time or their orgs.  And as an independent developer, my own Salesforce orgs aren’t heavily populated with diverse kinds of data that can be manipulated.

So I turned to the dev and test orgs that Salesforce makes available.  But I was left somewhat confused by the differences in these orgs and say a sandbox org.  Trial and error and some questions to Salesforce helped to clarify the issue for me.  You’d think as a developer, something as simple as test orgs vs. sandbox would be an easy thing to sort out.

Access to test orgs can be requested via the Salesforce partner portal (you do have to register as a partner, but doing so is free).  Just about any edition of Salesforce can be requested as a test org, and any special configurations that are needed (for example disabling the API or enabling Person Accounts) are requested by opening tickets.  The biggest limitation to these test orgs is that their storage capacity is very limited.  The result is that though they come with all of the Salesforce functions, they don’t always truly reflect real-world use cases.

Sandbox orgs do a much better job of giving a true picture of real-world use.  A sandbox is a replica of an existing Salesforce org configuration, and it may or may not include the data from the org it’s mirroring.  This is a great option for users who want to experiment with integrations, new configurations, or add-on apps.  But for developers like myself, a mirror of my production org doesn’t get me very far as my production org is pretty simple.  In addition, Salesforce charges for the sandbox. 

Nothing is ever perfect, but I think we can get pretty far along with Salesforce’s resources.