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
Raj88Raj88 

Debug logs for test class

How to check my values using debug logs statement in Test class..Here is my test class code

Test class:
static testmethod void test_1(){
           Account acc= new Account();
           acc.Name='Test';
           acc.Type='Customer';
           insert acc;
           
           Contact con = new Contact();
           con.LastName='TestUser';
           con.Email='testUser@test.com';
           con.AccountId=acc.id;
           insert con ; 
           
           opportunity opty = new opportunity();
           opty.Name='test';
           opty.CloseDate=system.today();
           opty.StageName='Advanced';
           opty.AccountId=acc.id;
           opty.Customer_Contact__c=con.id;
           insert opty;
           system.debug('opp' +opty);
        Test.startTest();
        ApexPages.StandardController sc = new ApexPages.StandardController(opty);
        oppexstn testoppexstn = new oppexstn(sc);
        Test.stopTest();
        }

I cant find this debug log text 'opp' in my debug logs statement.

Thanks
Raj
Best Answer chosen by Raj88
JD68JD68
Hey Raj, how are you viewing the debug log?  If you use the developer console you can filter for DEBUG statements only (i.e. the ones created from System.Debug.  When I ran your code, I was able to see the line, see the image:Debug Log
I hope this helps,
Cheers
John