ApexSensei

All drills

Debugging: Apex practice drills

Fix real production bugs: queries and DML in loops, null checks, recursion, mixed DML, empty tests and batch state.

Intermediate · Check and Run with Apex Path ($19 a month).

  1. Fix a missing null check Beginner · 10 min

    Calling a method on a blank field throws Attempt to de-reference a null object.

  2. Fix a query that finds no rows Beginner · 10 min

    Assigning a query to one record throws when nothing matches.

  3. Fix a query inside a loop Intermediate · 15 min

    Too many SOQL queries: 101 is the classic production failure.

  4. Fix DML inside a loop Intermediate · 15 min

    Every insert, update or delete statement counts against the limit of 150 per transaction.

  5. Fix a test that checks nothing Intermediate · 15 min

    A test passes when nothing throws.

  6. Stop a trigger calling itself Advanced · 15 min

    maximum trigger depth exceeded means a trigger caused DML that ran the same trigger, sixteen times.

  7. Fix a mixed DML error Advanced · 20 min

    A User with a role cannot share a transaction with Account.

  8. Fix a Batch job that forgets its count Advanced · 20 min

    Each execute and finish runs in its own transaction on a fresh copy of the class.

Start practicing free