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
sai kumar 433sai kumar 433 

write test class for program plz?

global class CaptureLastLoginDate implements Database.Batchable<sObject>{

        //This is the query that is passed to the execute method. .

        String ids = UserInfo.getUserId();
        String query = 'SELECT id,LastLoginDate__c FROM User ';

        global database.queryLocator start(Database.BatchableContext BC) {
             return database.getQueryLocator(query);
        //close start method
        global void execute(Database.BatchableContext BC, List<sObject> scope){
            List<Schema.User> u = new List<Schema.User> ();
            for(sObject s: Scope){
                Schema.User inv = (Schema.User)s;
                inv.LastLoginDate__c= inv.LastLoginDate__c;
            update u;

        global void finish(Database.BatchableContext sc){

Sandy GaliSandy Gali
This should help you -