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
Parth SrivastavaParth Srivastava 

please help me with test class

public class ProcessStepListController {

  @AuraEnabled
  public static List<Process_Step__c> getSteps(String crntOppId) {
    
    String crntOppStage;
    for(Opportunity opp : [Select StageName 
                          From Opportunity 
                          Where Id =: crntOppId]){
      crntOppStage = opp.StageName;
    }
    
    list<Process_Step__c> stepsList = [SELECT Id, Name, Process_Step_Name__c, Stage__c, Date__c, Complete__c, Note__c 
                                      FROM Process_Step__c 
                                      Where Opportunity__c =: crntOppId
                                      AND Stage__c =: crntOppStage
                                      order by createdDate asc];
    return stepsList;
  }
    
  @AuraEnabled
  public static void updateSteps (list<Process_Step__c> stepsList){
    try{
      for(Process_Step__c step : stepsList){
        if(step.Complete__c){
          step.Date__c = date.today();
        }
        else{
          step.Date__c = null;
          }
      }
             
      Database.update(stepsList);
    }catch(exception ex){
      system.debug('An error occurred---:' + ex);
    }
    
  }
}
Raj VakatiRaj Vakati
Use this code
 
@isTest
public class ProcessStepListControllerTest {
	
    static testmethod void testCase1(){
       	
		   
        
        
		
		Account a = new Account();
        a.Name = 'Test';
        a.Industry = 'Retail';
        insert a;
        
        
        Opportunity o = new Opportunity();
        o.name = 'Test';
        o.AccountId = a.Id;
        o.StageName = 'Closed Won';
        o.CloseDate = date.today();
        o.Type = 'New Customers';
        
        insert o;
		
		Process_Step__c ps = new Process_Step__c() ; 
		ps.Opportunity__c  = o.Id ; 
		ps.Stage__c  = 'Closed Won'; 
		ps.Name='Test' ;
		ps.Date__c = System.today() ; 
		ps.Complete__c = true ; 
		insert ps ; 
		
		ProcessStepListController.getSteps(o.Id) ; 
		
		ProcessStepListController.updateSteps(new List<Process_Step__c>{ps}) ; 
		
		
    }
}