Home  >  Blog  >   Salesforce

SalesForce Deployment and Assertions

Rating: 5
  
 
11598
  1. Share:
Salesforce Articles

In this particular section let us explore various SalesForce Deployment and Assertions.
First, let us see “What is Deployment?” The answer is very simple, Deployment is nothing but the connection between sandbox and PRD environment (production organization)

Several mechanisms of Deployment are:
                             |→    Changeset

                             |→     Force.com eclipse

                             |→      ANT builder

                             |→      WEB SERVICE

Hot Deployment:

During the Hot Deployment, if we exclude an object from the sandbox then it will be omitted from the PRD environment as well. However, the PRD environment can be modified by the Development environment without stopping the apps at prod area.

Want to enhance your skills in dealing with the worlds best CRM, enroll in our Salesforce Training 

Differences Between The SOQL and SOSL :

Let us evaluate between SOQL (Salesforce Object Query Language) and SOSL (Salesforce Object Search Language).

SOQL and SOSL

SOQLSOSL
Returns recordsReturns fields
Records are stored in collectionsAll records are pertaining to different  S objects
All records are pertaining to single S ObjectSelecting fields in different tables from DB

Search in table single < S object > only returns records only

Search in entire Org (or) DB returns fields only
One dimensionalTwo dimensional 
Contains :

SOQL
Contains

SOSL


SOQL Syntax:-

  • Select fn1,fn2,fn3,- – –  – fun from < S object >

SOSL Syntax:-

  • List < list > ss=Find ‘ pattern’ IN Fields

Returning field name1, field name2, – – – –  –

MindMajix Youtube Channel

Assertions

  • Assertions are used to terminate the execution of the program based upon a condition
  • If some condition matches, the program won’t execute
  • If the condition is true, execution stops at that point, or else it will continue till the end.

How to Put Assertions into the Code:

Assertions into the Code

There are generally two ways to Put Assertions into a Code:

1.System.asserts equals ( val1, val2, ‘string’) ;
2.System.asserts not equals ( var1, var2, ‘string’) ;
 

2 ways to Put Assertions

Second way

Winter ’12 for developers’

       →  App logic

1) Public Test Classes In Apex:

  • Classes annotated with @istest no longer have to be private. You can now create public test classes that expose common methods for test data creation . These public methods can be called by tests outside the test class for setting up data that the tests need to run against.
  • Let us look at an example of a public test class that contains utility methods for test data creation:

             @ Is Test

         

      public class TestUtil {

                 public static void create TestAccounts () {

                  // create some test accounts

                 }

                 public static void create TestContacts () {

                   // create some test contacts

                  }

                }  

                        

Checkout SalesForce Sample Resumes

2) JSON Support In Apex:

Native classes for serializing and deserializing JSON

  • Native JavaScript Objects Notation (JSON) has been added to Apex in Winter’12
  • Using JSON classes, you can now parse (resolve) JSON content and serialize Apex objects in the JSON format

The following classes have been added for JSON support:

  • System.JSON: It contains methods for serializing Apex objects into JSON format and deserializing JSON content that was already serialized using the serialize method in this class.
  • System.JSONGenerator:  Contains methods to serialize Apex objects into JSON content using the standard JSON encoding
  • System.JSONParser: Represents a parser for JSON– encoded content

Eg: List invoices = new List ();
     invoices.add (inv1);
     invoices.add (inv2);
     //Serialize the list of Invoice Statement objects.
     String JSON String = JSON.serialize (invoices);
     System.debug (‘serialized list of invoices into JSON format:’+ JSON String);
      // Deserializing the list of invoices from the JSON string
      List deserialized Invoices = (list) JSON.deserialize(JSON String, List.class);
       System.assertEquals(invoices.size(), deserializedInvoices.size());

Eg: Http httpProtocal = new Http();
      // create an HTTP request to send.
      Http Request request = new Http request();
 …..
       Http Response response = http protocol.send (request);
        // Create JSON parser with the http response body
       // as an input string.
       JSON Parser parser= JSON.create Parser (response.get Body());

Checkout Salesforce Interview Questions

3) Async Test API (Beta):

Integrate With Testing For Continuous Integration Apps:
Two API objects are now available to enable starting asynchronous test runs as well as for checking test results:
Apex test queue item: Represents a single Apex class in the Apex Job Queue
Apex test result: Represents the result of an Apex test method execution
You can use this functionality to better integrate with test execution in continuous integration applications.

4) New System Methods:

New methods are being used for determining the execution content in the system class:
isBatch:
Determines if the currently executing code is invoked by batch Apex Job 
isFuture:
Determines if the currently executing code is invoked by code containing in a method annotated with @future
isScheduled:
Determines if the currently executing code is invoked by a scheduled Apex job.

Checkout SalesForce Tutorial

Are you looking to get trained on Salesforce, we have the right course designed according to your needs. Our expert trainers help you gain the essential knowledge required for the latest industry needs. Join our Salesforce Certification Training program from your nearest city.

Salesforce Training ChennaiSalesforce Training DallasSalesforce Training BangaloreSalesforce Training Hyderabad, Salesforce Training Mumbai, Salesforce Training Delhi, Salesforce Training Noida, Salesforce Training New York, Salesforce Training Chicago, Salesforce Training Kolkata, Salesforce Training Gurgaon, Salesforce Training Pune.

These courses are equipped with Live Instructor-Led Training, Industry Use cases, and hands-on live projects. Additionally, you get access to Free Mock Interviews, Job and Certification Assistance by Certified Salesforce Trainers

Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts

Salesforce Administration TrainingSalesforce Lightning Training
Salesforce Advanced Developer TrainingSalesforce Developer Training
Salesforce IoT TrainingSalesforce App Builder Certification Training
Salesforce AppExchange TrainingSalesforce Service Cloud Training
Salesforce Vlocity TrainingSalesforce Marketing Cloud Training
and many more... 
Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Salesforce TrainingMar 30 to Apr 14View Details
Salesforce TrainingApr 02 to Apr 17View Details
Salesforce TrainingApr 06 to Apr 21View Details
Salesforce TrainingApr 09 to Apr 24View Details
Last updated: 03 Apr 2023
About Author

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.

read more
Recommended Courses

1 / 15