Skip to main content
1 of 3
Priya
  • 115
  • 1
  • 3
  • 6

Test Coverage for Batch Apex

Im getting a test coverage of 79%. I need 100% coverage.

It use 2 queries as lists and take data from it by cmparing. Most of them was covered.

I pass values to the 2 objects from test class.

Per developer console, Im not able to cover for the following statements.

 if (SalesAccreditationName==SalesCertName)
               {
            
                 if (TechAccreditationName==TechCertName)
                 {
             
                    if (SalesAccredCertCount==SalesCertCount)
                    {
             
                       if (TechAccredCertCount==TechCertCount)
                       { 

etc.

These variable are set inside the for loop of list of a query.The check happens after the for loop brackets are closed.

Is that the problem ? If the variable checks are inside the for loop whose values are set ,it would have been covered automatically is it ?

Please advice.

Thanks, Priya

Priya
  • 115
  • 1
  • 3
  • 6