A SF newbie here.

Is it possible to write a test class that can check WF field updates also ?.

I have a WF update created on a Custom object CaseLog__c.

Is it possible for me to write a Apex Test case to check whether the field update is happening as expected ?.

I know no code will be covered, but can I still a write unit test case and check whether it is working as expected ?.

Any input on it will be appreciated ..tx

  • 1
    yes. you can simply write a test for it and assert the results are as expected
    – Eric
    Commented Mar 1, 2015 at 4:57

2 Answers 2


Definitely. Just write a unit test that creates the CaseLog__c record, then sets whatever criteria are needed to fire off the workflow, then requery the record and do a system.assertEquals() to make sure that the record has the expected value.

You can also do this to check that formula fields, roll-up fields, and validation rules are working correctly.


You can definitely write that ,lets say in your case your workflow is updating a field name with 'abc' for CaseLog__c record ,simply write unit test as below

private static class unitTest{
   public static testmethod void unittestworkflow(){
      CaseLog__c c=new CaseLog__c();
      //....other mandatory fields here
      insert c;
      system.assert([Select name from caseLog__c where Id=:c.id].name=='abc');

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .