• Manoj ojha
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi there, 

I'm quite stuck here. 
I've written a test class for my batch but it doesn't appears to be running. It stays at 0% :( 

I'm missing something but don't know what. 

Can someone help me figure it out? 

Here is my batch class : 
global class BatchUpdateAllLeads implements Database.Batchable <SObject> {
//START METHOD
    global Database.QueryLocator start(Database.BatchableContext bc){
        String Query='Select id,TECH_Update__c from Lead where TECH_Update__c=false AND Converted=false ' ;
        return Database.getQueryLocator(Query);
            }
//EXECUTE METHOD
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        for(Lead l: scope){
            l.TECH_Update__c = true;
        }
        update scope;
    }
//FINISH METHOD
    global void finish(Database.BatchableContext bc){
        Id job= bc.getJobId();
        System.debug(job);
    }
}

And this is my attemp of writting a proper test class :( 
@istest
private class BatchUpdateAllLeads_TEST {
    @istest
    static void testAcc(){
        List<Lead> l = new List<Lead>();
        Lead l1 = new Lead(Company	='BTP',LastName = 'Test',SIRET__c='12659991955626',Numero_d_ordre__c='9999-99-99',Region_GRDF__c='Ile de France',Tech_Update__c=false,IsConverted=false);
        l.add(l1);

        Lead l2= new Lead(Company	='Comp',LastName = 'Test2',SIRET__c='12659991955687',Numero_d_ordre__c='1111-99-99',Region_GRDF__c='Ile de France',Tech_Update__c=false, IsConverted=true);
        l.add(l2);

        Lead l3= new Lead(Company	='Agny', LastName = 'Test3', SIRET__c='19959991988687', Numero_d_ordre__c='1111-99-11', Region_GRDF__c='Ile de France', Tech_Update__c=true,IsConverted=true);
        l.add(l3);
        insert l;
   
    Test.startTest();
    BatchUpdateAllLeads ap= new BatchUpdateAllLeads();
    Id jobid= Database.executeBatch(ap);
    Test.stopTest();
    }
}

Ty very much for your help
Think my Google skills have failed today!

I'm trying to write a C# app to access the Rest API and I have the following SOQL, It gives me all accounts as expected.
 
SELECT id FROM Account

Now I want only live accounts, however, the following isn't working, am I missing something?
 
SELECT id FROM Account WHERE Status = 'Live'

Cheers for any assistance!