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
smitha vikramsmitha vikram 

Help needed in writing Test class for flow calling apex and updating a record

I have the following Apex class and also the a flow calling the apex class. I have made an attempt to write the test class, but  i know its not even close, can someone help me through this?
bal with sharing class AddCommentbuttononOpp
  Webservice static void  getOppRecord(list<FlowRequest> oppId){
 if( oppId[0].varOpptyRecord.Comments_Next_Steps__c!=null){
           oppId[0]' '+  oppId[0].varOpptyRecord.Comments_Next_Steps__c;
           string temp =  oppId[0].varOpptyRecord.Description;
     if(temp==null && !string.isNotBlank(temp)){
     oppId[0].varOpptyRecord.Description =  oppId[0].varOpptyRecord.Comments_Next_Steps__c;  
     }else if(temp!=null && string.isNotBlank(temp)){
        oppId[0].varOpptyRecord.Description =  oppId[0].varOpptyRecord.Comments_Next_Steps__c +'\n' +temp;
update oppId[0].varOpptyRecord;
//One for getting the values from Flow to Apex a
global class FlowRequest
        @InvocableVariable(label = 'Opportunity Record')
        public Opportunity varOpptyRecord;


test class
public class AddCommentbuttononOppTest {
    Static testMethod void unittest(){
   Opportunity newOpp = new Opportunity( StageName = '1 - Discover Opportunity', CloseDate = + 30, Name = 'Test Opportunity 33', Comments_Next_Steps__c='Go tigers',Description='go tigers Opportunity');
        insert newOpp;
        system.debug('Inserted Test Opportunity: ' +;
      }catch(DMLException d){ 
    AddCommentbuttononOpp.FlowRequest varWrapper = new  AddCommentbuttononOpp.FlowRequest();
           AddCommentbuttononOpp.getOppRecord( new List< AddCommentbuttononOpp.FlowRequest>{  varWrapper   }) ; 


so far