function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Puneet SardanaPuneet Sardana 

Test Class Code Coverage Problem

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.

Best Answer chosen by Admin (Salesforce Developers) 
Puneet SardanaPuneet Sardana

A quick solution for this :-

 

Open class in developer console, edit and save. Now class will show up in overall code coverage and we can see the colors that shows which lines are covered.

This is a bug in Salesforce which is not yet fixed, this is a workaround for the time being.

 

Thanks.

All Answers

Satish_SFDCSatish_SFDC
Well there are some internal issues in Salesforce and this has been documented here:
https://success.salesforce.com/issues_view?id=a1p30000000T0kUAAS

Please check if this known issue affects you.

Regards,
Satish Kumar
Subhani PSubhani P

Hi Puneet,

 

Salesforce is trying to push the use of the developer console. You can still view the color coded view of your classes to see which lines are covered or not in the developer console.

I also find this highly annoying as the old way was much more useful, but SF is really trying to push the developer console.

After running your tests, you need to select the tests you want to look at and click the 'Developer Console' button. You can then choose the test in the Class Code Coverage tab

 

check the similar post in below link.

 

http://salesforce.stackexchange.com/questions/16592/code-coverage-column-for-apex-class-missing

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks,
Subhani,
Salesforce Certified Developer,
www.mydbsync.com

 

Puneet SardanaPuneet Sardana

The problem is that the class that I am testing does not appear on Overall Code Coverage Section. It appears in Class Code Coverage Section. When I open it it shows shows coverage but the color indicating which line is covered and which is not (red & blue) is missing. This is happening after winter 14 release.

 

 

NeezenNeezen

I am having the same problem, the developer console is seriously lacking as is:

 

  1. Run all tests and go to the console.
  2. Individual tests show the code coverage for some classes and triggers for that particular test in "Class Code Coverage".
  3. Overall Code Coverage do not show some of these triggers and classes although I saw the code coverage in 2. 

This is really bad. As developers we need to be able to see full overall code coverage for all triggers and classes without having to calculate this ourselves.

 

What we need:

  • Being able to see the overall code coverage for ALL classes and triggers.
  • Being able to see which classes have 0% code coverage in the same list as the those that have at least 1% code coverage.
  • Being able to export this list to Excel (by CSV format or whichever is convenient).

There must be more people having the same problem, how is this being solved?

Thanks.

Puneet SardanaPuneet Sardana

A quick solution for this :-

 

Open class in developer console, edit and save. Now class will show up in overall code coverage and we can see the colors that shows which lines are covered.

This is a bug in Salesforce which is not yet fixed, this is a workaround for the time being.

 

Thanks.

This was selected as the best answer
Urvi MehtaUrvi Mehta

Hi Puneet,

I am facing same issue in my sandbox environment. In Developer console it is showing some % code covered for particular class but when I try to see which lines are missed then it is not even showing me colored lines. It is showing "Code Coverage :None" .

 

I tried applying solution you have provided but that also didn't worked for me.

Please help.

 

Thanks

Urvi

 

mharikian1.3892229047844834E12mharikian1.3892229047844834E12
This is really bad especially since Salesforce requires us to cover a percentage of lines in our unit tests. Salesforce, until you get this buggy Developer Console fixed and functional, why can't we have back what you had before where I could click in the test class results and see the lines of code which were covered and which were not? The developer console does not work at this point. I continually get pop-up messages asking me if I would like to wait/continue for pages to load and they don't go away. I have to close down the console and reopen it again, and it wasts my time. I need to be developing, not troubleshooting some garbage development environment.  Why has the developer console been such a pain to get up and functional and why wasn't it tested further before releasing and forcing developers to use it? This isn't what you guys do.
unidhaunidha
Ya.It is really irritating especially for beginner.Imagine that you think it is your fault, maybe you click wrong button/etc and  try to figure out how to do it right way and at the end , you find it due to the bug in SF.
vinodrajput1.3947816596948318E12vinodrajput1.3947816596948318E12

Hi All, 
Could please any buddy help me for same issue. I am facing big problem. i want Color code of coverage but i am not getting anybody plz hell.

Plzz save from hell!!!
plz show u r expertise.. :)

unidhaunidha
@vinodrajput1.3947816596948318E12 , you can try edit your class in developer console, save and run the test again.
Jen BennettJen Bennett
Ran into this same issue and found this solution (http://salesforce.stackexchange.com/questions/24082/code-coverage-on-dev-console) that worked for me...

Goto setup -> Develop -> Apex Test Execution and click the Options button.

Make sure "Store Only Aggregated Code Coverage" is UNCHECKED

That fixed the issue for me.
Miroslav SmukovMiroslav Smukov

I had same issues but non of the suggested solutions seemed to help me. In the end I managed to get the code coverage in the following way:

For me the Test Code Coverage only appears if I run the tests from Setup > Build > Develop > Apex Test Execution > Select Tests..

This way I get both the code highlight and coverage percentage in Developer Console immediately after the tests completes. On the other hand, if I run the tests directly from Developer Console I get non of those.

Kelly KKelly K
Couldn't get the suggested answer to work for me. Also, 'store only aggregated coverage' wasn't checked to begin with when I started running my tests.

Miroslav's suggestion did work for me.

The test speeds under Apext Test Execution versus running it in the Developer Console are noticeably different (Apext Test Execution is much slower). Hope this fix this soon ish as this is irritating.
Bill McBill Mc
In my case, often when using Developer Console and running a test, the code coverage colours do not show up when double-clicking the class name in the "Overall Code Coverage" list at the bottom right.

But double-clicking the class name a second time does make them show up. 

Got lucky in finding this.  Hope it helps others

Cheers

Bill

 
Amiya DasAmiya Das
Test Class coverage failed :-

Below is the apex email service class :-
Global class CSVFileDataImportEmail implements Messaging.InboundEmailHandler
{
    Global string nameFile{get;set;}
    Global blob contentFile{get;set;}
    global String errorMessage{Get;set;}
    global list<Transfer__c> licustomobject = new list<transfer__c>();
    String[] filelines = new String[]{};
    Boolean processSheet = True;
    List<Transfer__c> SCupload;    
    List <Messaging.SingleEmailMessage> Mail = new List <Messaging.SingleEmailMessage>();
    List <Messaging.SingleEmailMessage> Mails = new List <Messaging.SingleEmailMessage>();
    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.Inboundenvelope envelope)
    {
        
        nameFile = email.toString();         
        filelines = nameFile.split('\n');
        System.debug(' filelines... ' + filelines);
        SCupload = new List<Transfer__c>();
        //Here I'm writing a map since I've 2 lookup fields
        Map<String,String> SUP_map = New Map<String, String>();
        String a1= '';
/*        for(Account A:[Select Id,Name From Account])
        {
            System.debug(' ~Supplier~ ' + A.ID + A.Name);  
            SUP_map.put(A.Name,A.ID);
            System.debug(' SUP_map ' + SUP_map);
            System.debug(' SUP_mapID ' + SUP_map.get(A.ID) + ' SUP_mapName ' + SUP_map.get(A.Name));
        }
*/

        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
        System.debug(' >email< ' + email);
        List<String> fileAttachments = new list<String>();

        System.debug(' email attachments ' + email.TextAttachments);
        Messaging.InboundEmail.textAttachment[] tAttachments = email.TextAttachments;
//        System.debug(' size of tAttachments ' + tAttachments.size() + 'Text Attachement from the email.' + tAttachments);
        Messaging.InboundEmail.BinaryAttachment[] bAttachments = email.BinaryAttachments;
        System.debug(' Binary Attachement from the email. ' + bAttachments);
        //System.debug(' Binary Attachement from the email. ' + bAttachments.size());
        String csvbody = '';
        String filename  = '' ;
         If(bAttachments != Null && bAttachments.size() > 0)
        {
            for(integer i=0; i < bAttachments.size(); i++)
            {
                filename = bAttachments[i].filename;
                if(filename.contains('.csv')){
                    HttpRequest tmp = new HttpRequest();
                    tmp.setBodyAsBlob( bAttachments[i].body);
                    String value = tmp.getBody(); //this seem to be a valid utf-8 string
    
                    System.debug(' attacments... ' + value);
                    fileAttachments.add(value); 
                }else{
                    filename = '';
                }
            }
            
        }
         If(tAttachments != Null && tAttachments.size() > 0)
        {
             
            for(integer i=0; i < tAttachments.size(); i++)
            {
                filename = tAttachments[i].filename;
                if(filename.contains('.csv')){
                    System.debug(' attacments... ' + tAttachments[i].body);
                    fileAttachments.add(tAttachments[i].body);  
                }else{
                 filename = '';
                }
            }
            
        }
        System.debug(' fileAttachments' + fileAttachments);
        List<String> badrows = new List<String>();
        String csvBody1 = '';
        String[] lineByCsvBody = new String[]{};
        List<String> linebycsvdata = new List<String>();
        

        if(filename.contains('.csv')){    
        
        If(fileAttachments != Null && fileAttachments.size() >0)
        {
            For(string ttt: fileAttachments)
            {
                csvBody1 = ttt;
                lineByCsvBody = '.split('\n');
                System.debug('CSV BODY'+ csvBody1 + 'lines' +lineByCsvBody +' size of lineByCsvBody ' + lineByCsvBody.size() + ' This is a Text Attachment from the email parsed. ' + ttt);

                For(Integer j = 0; j < lineByCsvBody.size(); j++)
                {
                    System.debug(' lineByCsvBody data...... ' + lineByCsvBody[j]);
                    If(j==0)
                    { 
                        /*Here I'm checking and splitting the header values*/
                        String headerRow = lineByCsvBody[j];
                        System.debug(' headerRow DATA ...  ' + headerRow);
                        String hvalue = csvbody1;
                        String[] headervalue = headerRow.split(',');
                                          if(headervalue.size() == 0 ){
                        continue;
                    }else if(headervalue.size() !=10){
                            System.debug('==> '+headerRow);
                            badrows.add('header All columns : Column length is not 10 - Actual size is ' + headervalue.size());
                            badrows.add('contnet of headervalue ' + headervalue);
                            continue;
                        }
                        System.debug(' contnet of headervalue ' + headervalue);
                        System.debug(' size of headervalue ' + headervalue.size());
                        System.debug(' headervalue1 '+ headervalue[0] + ' headervalue2 ' + headervalue[1]);
                        
                        if(headervalue[0] == Null || headervalue[0] == '' || headervalue[0].trim().length() < 1)
                        {
                            badrows.add('Column 1 : Guest_First_Name__c is null.');
                        }    
                        Else if(headervalue[0] != 'Guest_First_Name__c')
                        {
                            badrows.add('Column 1 : Guest_First_Name__c should be accurate.');
                        }
/*        Guest_First_Name__c   Guest_Last_Name__c  Reservation_Number__c   of_Adults__c    of_Children__c  Transfer_Type__c    Check_In_Date__c    Check_Out_Date__c   Booking_Source__c   Airport__c*/
                        IF(headervalue[1] == Null || headervalue[1] == '' || headervalue[1].trim().length() < 1)
                        {
                            badrows.add('Column 2 : Guest_Last_Name__c Column name is null.');
                        }
                        Else if(headervalue[1] != 'Guest_Last_Name__c')
                        {
                            badrows.add('Column 2 : Guest_Last_Name__c Column name should be accurate.');
                        }

                        IF(headervalue[2] == Null || headervalue[2] == '' || headervalue[2].trim().length() < 1)
                        {
                            badrows.add('Column 3 : Reservation_Number__c Column name is null.');
                        }
                        Else if(headervalue[2] != 'Reservation_Number__c')
                        {
                            badrows.add('Column 3 : Reservation_Number__c Column name should be accurate.');
                        }
                        
                        IF(headervalue[3] == Null || headervalue[3] == '' || headervalue[3].trim().length() < 1)
                        {
                            badrows.add('Column 4 : of_Adults__c Column name is null.');
                        }
                        Else if(headervalue[3] != 'of_Adults__c')
                        {
                            badrows.add('Column 4 : of_Adults__c Column name should be accurate.');
                        }

                        IF (headervalue[4] == Null || headervalue[4] == '' || headervalue[4].trim().length() < 1)
                        {
                            badrows.add('Column 5 : of_Children__c Column name is null.');
                        }
                        Else if(headervalue[4] != 'of_Children__c')
                        {
                            badrows.add('Column 5 : of_Children__c Column name should be accurate.');
                        }
                        
                        IF (headervalue[5] == Null || headervalue[5] == '' || headervalue[5].trim().length() < 1)
                        {
                            badrows.add('Column 6 : Transfer_Type__c Column name is null.');
                        }
                        Else if(headervalue[5] != 'Transfer_Type__c')
                        {
                            badrows.add('Column 6 : Transfer_Type__c Column name should be accurate.');
                        }
                        
                        IF (headervalue[6] == Null || headervalue[6] == '' || headervalue[6].trim().length() < 1)
                        {
                            badrows.add('Column 7 : Check_In_Date__c Column name is null.');
                        }
                        Else if(headervalue[6] != 'Check_In_Date__c')
                        {
                            badrows.add('Column 7 : Check_In_Date__c Column name should be accurate.');
                        }   

                        IF (headervalue[7] == Null || headervalue[7] == '' || headervalue[7].trim().length() < 1)
                        {
                            badrows.add('Column 8 : Check_Out_Date__c Column name is null.');
                        }
                        Else if(headervalue[7] != 'Check_Out_Date__c')
                        {
                            badrows.add('Column 8 : Check_Out_Date__c Column name should be accurate.');
                        }
                        
                        IF (headervalue[8] == Null || headervalue[8] == '' || headervalue[8].trim().length() < 1)
                        {
                            badrows.add('Column 9 : Booking_Source__c Column name is null.');
                        }
                        Else if(headervalue[8] != 'Booking_Source__c')
                        {
                            badrows.add('Column 9 : Booking_Source__c Column name should be accurate.');
                        }  
                        
                        IF (headervalue[9] == Null || headervalue[9] == '' || headervalue[9].trim().length() < 1)
                        {
                            badrows.add('Column 10 : Airport__c Column name is null.');
                        }
                        Else if(headervalue[9].trim() != 'Airport__c')
                        {
                            badrows.add('Column 10 : Airport__c Column name should be accurate.'+headervalue[9]);
                            
                        }                          
                        

                        System.debug(' badrows ' + badrows.size());
                        System.debug(' badrows data' + badrows);
                       
                    }
                    if(j>0 && processSheet)
                    {
                        linebycsvdata.add(lineByCsvBody[j]);
                        System.debug('inside j>0'+linebycsvdata);
                    }
                }
            }
        }
        System.debug(' size of list ' + lineByCsvBody.size());
        System.debug(' size of list of linebycsvdata ' + linebycsvdata.size());
        System.debug(' processSheet ' + processSheet);
        
        if( processSheet ) 
        {
            System.debug('inside insertion part ' + linebycsvdata.size());
            Try
            {

                integer rowCount=0;
                for(String svalue:linebycsvdata)
                {
                    /*Here I'm checking and splitting the values / data contained in the .csv file*/
                    rowCount++;
                    String[] splitvalue = svalue.split(','); 
                    
                    boolean check = false;
                    System.debug(' content  splitvalue ' + splitvalue);
                    for(string s: splitvalue){
                        if(!(s == '' || s.trim().length() < 1 || s == Null)){
                            check = true;
                        }
                    }
                    System.debug(' size of splitvalue ' + splitvalue.size() + '======boolean '+check);
                    
                    if(splitvalue.size() == 0 || !check ){
                        continue;
                    }
                    else if(splitvalue.size() !=10){
                        System.debug('==> '+splitvalue);
                        System.debug('==> '+svalue);
                        badrows.add('Data All columns : Column length is not 10 - actual size is ' + splitvalue.size());
                        badrows.add('Content ' + splitvalue);
                        continue;
                    }
                    Transfer__c customobject = new transfer__c();
                    System.debug(' splitvalue1 ' + splitvalue[0] + ' splitvalue2 ' + splitvalue[1]);
                    if(splitvalue[0] == '' || splitvalue[0].trim().length() < 1 || splitvalue[0] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[1] == '' || splitvalue[1].trim().length() < 1 || splitvalue[1] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[2] == '' || splitvalue[2].trim().length() < 1 || splitvalue[2] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[3] == '' || splitvalue[3].trim().length() < 1 || splitvalue[3] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[4] == '' || splitvalue[4].trim().length() < 1 || splitvalue[4] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[5] == '' || splitvalue[5].trim().length() < 1 || splitvalue[5] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[6] == '' || splitvalue[6].trim().length() < 1 || splitvalue[6] == Null)  
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[7] == '' || splitvalue[7].trim().length() < 1 || splitvalue[7] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }
                    if(splitvalue[8] == '' || splitvalue[8].trim().length() < 1 || splitvalue[8] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }  
                    if(splitvalue[9] == '' || splitvalue[9].trim().length() < 1 || splitvalue[9] == Null)
                    {
                        badrows.add('row number'+rowCount+' field value is missing');
                        continue;
                    }                      
/*        Guest_First_Name__c   Guest_Last_Name__c  Reservation_Number__c   of_Adults__c    of_Children__c  Transfer_Type__c    Check_In_Date__c    Check_Out_Date__c   Booking_Source__c   Airport__c*/                    
                    String chk = SUP_map.get(splitvalue[0]);
                    system.debug(' check_map ' + chk + splitvalue[0]);
               //     customobject.Account__c='001W000000Qw18B';

                    customobject.Guest_First_Name__c = splitvalue[0];
                    customobject.Guest_Last_Name__c = splitvalue[1];
                    customobject.Reservation_Number__c = splitvalue[2];
                    customobject.of_Adults__c = Integer.valueOf(splitvalue[3]);
                    customobject.of_Children__c = Integer.valueOf(splitvalue[4]);
                    customobject.Transfer_Type__c = splitvalue[5];
                    customobject.Check_In_Date__c = date.parse(splitvalue[6]); 
                    customobject.Check_Out_Date__c = date.parse(splitvalue[7]);
                    customobject.Booking_Source__c = splitvalue[8];
                    customobject.Airport__c = splitvalue[9];
                   
                    licustomobject.add(customobject);   
                    //supc.add(customobject);
                    //System.debug(' passed record size ' + supc.size());
                }
                 insert licustomobject;
            }
            catch (Exception e)
            {
                System.debug(' Exception ' + e);
                errorMessage = 'Short Exception = '+e.getMessage();
                result.success = false;
                System.debug(' Result '  + result.success);
            }
           // send email for the Errors
        }
        }else{
            badrows.add('Fileformat csv is only acceptable '+ filename);
        }
        System.debug(badrows);
        Messaging.SingleEmailMessage SuccessMail = new Messaging.SingleEmailMessage();

        List <String> sendTo1 = new List <String>();
        sendTo1.add(email.fromAddress);
        SuccessMail.setToAddresses(sendTo1);

        SuccessMail.setReplyTo('vamsius123@gmail.com');
        SuccessMail.setSenderDisplayName('Universal Orlando');


        String body1 = '';
        if(! badrows.isempty() || !String.isBlank(errorMessage)){
            SuccessMail.setSubject('ERROR :: Failed to process Upload template (CSV)');
            body1 = '<html><body>Dear User,' + '<br>' + '<br>' +'The  Upload CSV Template failed to process because the below header values are missing in the sheet.' + '<br>' + '<br>';

            if(badrows.size() > 0)
            {
                for(String str:badrows)
                {
                    System.debug('value of str ' + str);
                    body1 += str + '<br>' +'<br>';
                }
            }
            if(!String.isBlank(errorMessage)){
                body1 += '<br>' + errorMessage;
            }
            body1 += '<br>' + '<br>' + 'Correct the header columns and re-send for uploading again.' 
                    + '<br>' + 'Reach out to  Admin for further assistance.' 
                + '<br>' + '<br>' + '<br>' + '-  Team.</body></html>';
                            
        }else{
             SuccessMail.setSubject('Template Upload :: Success :: '+ licustomobject.size() + ' records. ' + 'ERROR :: ' + badrows.size() + ' records.');

             body1 = '<html><body>Dear User,' + '<br>' + '<br>' + 'Number of Records sucessfully processed :: '+ licustomobject.size() + '<br>' + '<br>' + 'Number of Records failed to process :: ' + badrows.size() + '<br>' + '<br>' + '<br>' + '- Team.</body></html>';
     
        }


        SuccessMail.setHtmlBody(body1);

        Mails.add(SuccessMail);
        if(Mails.size() > 0 )
        {
            Messaging.sendEmail(Mails);
        }
        
            
        
        
        return result;
    }
}

Below is the test class for the above class for which test coverage is 42%:
@isTest
private class CSVFileDataImportEmailTest {
    public static Transfer__c transferObj;
    public static list<string> sentToEmailAddresses;
    public static list<string> fAttachments;
    public static list<string> lineCsvBody;
    public static string csvBody1;
    public static string svalue;
    public static list<string> splitvalue;
    public static string headerRow;
    public static list<string> headerValue1;
    
    static testmethod void CSVFileDataImportEmailCreateTestData(){
        
        //account insert
        Account acc = new Account(Name='Test Account1');
        insert acc;
        system.assert(acc != null);
        
        //transfer record insert
        transferObj = new Transfer__c(Guest_First_Name__c = 'amiya', Guest_Last_Name__c = 'das', Account__c = acc.Id,
                                      Reservation_Number__c = '1234', of_Adults__c = 5, of_Children__c = 5, Transfer_Type__c = 'Roundtrip',
                                      Check_In_Date__c = system.today() , Check_Out_Date__c =system.today().addDays(3) , Booking_Source__c = 'UPRV' , Airport__c = 'MCO');                                       
        insert transferObj;
        system.assert(transferObj != null);
        
        //        sentToEmailAddresses = new list<string>{'amiya.das@universalorlando.com', 'amiya.das@cognizant.com'}; 
        
        
    }
    
    
    
    
    
    static testmethod void CSVFileDataImportEmailCreateTestMethod(){
        
        CSVFileDataImportEmailCreateTestData();
        
        Messaging.SingleEmailMessage emailMessage = new Messaging.SingleEmailMessage();
        
        sentToEmailAddresses = new list<string>{'amiya.das@universalorlando.com', 'amiya.das@cognizant.com'};
            fAttachments = new list<string>{'file1', 'file2'};
                lineCsvBody = new list<string>{'csv1', 'csv2', 'csv3'};
                    string allStrings = '';
        for(string val : lineCsvBody){
            allStrings = allStrings + val + '\n';
        }
        
        for(integer a=0; a<fAttachments.size(); a++){
            csvBody1 = fAttachments[a];
          //  lineCsvBody = split('\n');
        }
        lineCsvBody = csvBody1.split('\n');
        
        
        for(integer b=0; b<lineCsvBody.size(); b++){
            if(b==0){
                String headerRow = lineCsvBody[b];
            }
        }
        
        /*       for(integer i=0; i<lineCsvBody.size();i++){
svalue = lineCsvBody[i];
splitvalue = svalue.split(',');
headerRow = lineCsvBody[i];
headervalue = headerRow.split(',');
}   */
        
        
        List<String> badrows = new List<String>();
   		badrows.add('Column 1 : Guest_First_Name__c is null.');
        
 /*       for(integer i=0; i<10; i++){
            headerValue1[i] = '';
            
        }  */
        
        // creation of new email and envelope object
        Messaging.InboundEmail email = new Messaging.InboundEmail();
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
        
        
        
        //  Messaging.InboundEmail.BinaryAttachment[] bAttachments = email.BinaryAttachments;
        //set up data for email object	
        email.subject = 'test';
        email.fromAddress = 'user@acme.com';
        email.plainTextBody = 'email body\n2225256325\nTitle';
        email.toAddresses = sentToEmailAddresses;
        
        //add a binary attachment
        Messaging.InboundEmail.BinaryAttachment bAtt = new Messaging.InboundEmail.BinaryAttachment();
        bAtt.body = blob.valueOf('test');
        bAtt.fileName = 'myattachmentname.csv';
        //        bAtt.fileName = '';
        bAtt.mimeTypeSubType = 'plain/txt';
        email.binaryAttachments = new Messaging.inboundEmail.BinaryAttachment[] {bAtt };
            
            //add a text attachment
            Messaging.InboundEmail.TextAttachment tAtt = new Messaging.InboundEmail.TextAttachment();
        tatt.body = 'my attachment text';
        tAtt.fileName = 'myattachmentname1.csv';
        //        tAtt.fileName = '';
        tAtt.mimeTypeSubType = 'plain/txt1';
        email.TextAttachments = new Messaging.inboundEmail.TextAttachment[] {tAtt};  
            
            emailMessage.setToAddresses(sentToEmailAddresses);
        
        email.binaryAttachments = new Messaging.inboundEmail.BinaryAttachment[] {bAtt };
            email.TextAttachments = new Messaging.inboundEmail.TextAttachment[] {tAtt};
                
                
                
                test.startTest();
        CSVFileDataImportEmail dataImport = new CSVFileDataImportEmail();
        dataImport.handleInboundEmail(email, env);
        
        test.stopTest();
    }
}

Can someone help me to cover at least 75%. Tried a lot, but failed. It will be greatly appreciately.
Thanks in advance
ABLABL
Hello Everyone,
Introducing: Test Class Generator

I have discovered an idea and converted into an app named "Test Class Generator", this use to write test class automatically for your controller, batch and trigger. I won't say it would provide 100% code coverage, but it would definitely help business to save some money.
Right now its not covering all complex scenarios of code, but the upcoming releases would be able to cover it.

Please have a look at it and provide your inputs to make it more sturdy and versed.
https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EFozgUAD
unidhaunidha
Hi, Please check if this behavior On Wed, 7 Jun 2017 at 2:06 AM, happen to other test class.If yes, you want to create ticket to salesforce.
Suzanne TimmerhansSuzanne Timmerhans
I downloaded the Test Class Generator to my Sandbox but I do not the see the 'Parse' button referenced in Step 1.  How do I get that to display?