• ABL
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi!

I have a trigger that I got off a comment in the Success Community (thanks Subramani!) that adds Case Comments to Cases during the same import (rather than first importing Cases and then Case Comments based on the parent ID). The trigger is in the Sandbox and I am unable to deploy it because there is not enough code covereage. I am told that I need to have a test class for this trigger in order to be able to test and deploy it to Production. I am pretty new to SF administration and have almost no experience writing in Apex. Would anyone be able to help me create a test class for the following trigger?

trigger CreateCaseComment on Case (after insert) {

List<CaseComment > casecmlist=new list<CaseComment >();

for(Case c : Trigger.new){
     if(c.commentCL__c!= ''){

        CaseComment cc = new CaseComment();
        cc.commentBody = c.commentCL__c;
        cc.ParentId = c.Id;
        casecmlist.add(cc);
     }
 }
 if(casecmlist!=null){
 insert casecmlist;
 }
}

I really appreciate any assistance I can get! Thank you!
We have a requirement to get the overall test class coverage and individual classes there in salesforce production org. automatically based on time interval. The challenge is how to execute it programmatically and get the latest coverage? 
 Thanks in Advance 
-Lokesh
I am new to salesforce, how to write a test class in apex and what are the things that have to be considered while writing a test class.

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.

 

Would like to check  whether is there any preferred/recommended  testing tool that can be best suited for SFDC(Salesforce) application for Test automation or can we use any tool(eg. QTP/Rational) to do that.

 

 

The Automation test that we refer hear is aimed to decrease the Duration of execution and can include below Test Automation Frameworks.
 -Creation of small,independent scripts that represent the modules are then used to construct larger tests to realize specific business scenarios.
 -Data driven tests that read input values from CSV/Excel files that can be used in the coded scripts for creation of objects like Contacts/Accounts etc.

 

Regards

Gopi chand P

  • August 16, 2012
  • Like
  • 0