You need to sign in to do that
Don't have an account?
Installing my first piece of Apex code
I am now, finally, in a position to deploy the code which a kind developer on this board wrote for me a couple of weeks ago. The hold-up was in getting our organisation upgraded to Enterprise edition, which has now been done.
I have downloaded and installed the force.com IDE, but I am a complete newbie and am now absolutely terrified. What do I need to do to get this code actually installed on our company's Salesforce system?
I notice thae Salesforce.com have a requirement that 75%, and preferably 100% of the code be covered by automated tests. I assume I need to find out how to do this?
Someone, please help!
Best regards,
Alex.
you have to add a test class like here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_test.htm
Your triggers need a minimum of 1 % and all classes and triggers must be covered in average by 75%
Christian
Sorry, I'm really new to this and am out of my depth. Can you walk me through this please?
The force.com IDE is an editor for apex and visulforce code (and other metadata). You should create for every class and trigger a test class that looks like this. Using the IDE you can create a new class like one of these:
Here is a sample class for you
public class helloWorld
{
public String sayHelloTo(String name)
{
return 'Hello! '+name;
}
}
//Test Class
@isTest
public Test_helloWorld
{
static testMethod void myUnitTest() {
helloWorld computer = new helloWorld();
System.assertEquals('Hello Peter', computer.sayHelloTo('Peter'));
}
}
Sorry, just to be clear - I need help putting the code into place.
The code is this.
Please could someone help me use the force.com IDE (or whatever is most appropriate) to deploy this in my company's Salesforce org?
Actually, an updated version of that code is this:
Anyone who can help me get this installed on my org ASAP, I shall be very grateful indeed.
Or even, with better formatting: