You need to sign in to do that
Don't have an account?
占一 逯
Where to check the output and result by using system.assert & system.debug in Test Class?
As title, I used system.assert & system.debug in test class, I only got case run successful in console. Where to check the debug & asssert output ?
- pavan
A simple scenario would be to create a test class +methods in which some work is done (e.g. put something into the DB, update a field or whatever). Once this is done you would use System.Assert functions to check what has been done.
For example:-
integer i = 0;
integer j = 1;
//this would throw an error and cause your test to fail
System.assertEquals(i,j);
//this would pass
System.assertNotEquals(1,i);
etc...
You may put something into the DB via an insert. After running the test class go to the debug logs and check the logs.
Thanks,
Shruti Khodabole
Salesforce Developer
http://www.zen4orce.com
You can check debug logs in developer console or set debug logs through setup
Hope this helps you to solve your problem.
Thanks,
Sukanya Banekar
You can set the system.debug in your main class and system.assert in test class, Then run the test in developer console
then click on Tests it will show you test results of all methods in your test class and also assert result. you can click on method which are
failed /pass then debug will be open that show you debugs which you set in your main class
I hope this helps you .
Thanks,
Atul Patil
Salesforce Developer
http://www.zen4orce.com