Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Unit Testing for Custom workflow process and Participant step??


Level 2

Hi Team,

Can we write unit test cases for Custom workflow process and Participant step?? using Junit or Jmockito

If Yes could you please help me out.

I tried using Jmockito and junit

  public void testExecute() throws WorkflowException, RepositoryException {

    try {
      new NonStrictExpectations() {
          args.get("PROCESS_ARGS", String.class);




      previewUnpublish.execute(wfItem, wfSession, args);

    } catch (Exception e) {;

But in previewUnpublish Workflow process i have a replicator variable referenced, how can mock as its part of workflow class object i cant pass it as param arg

  private Replicator replicator;

Thanks in Advance


1 Reply


Level 9

Hi Mallikarjun,

From what I am aware of , you should be able to write test cases for custom workflow process.

If a replicator variable is referenced, we can do it as below [Please note : Using powermock is not recommended]

private Replicator replicator;

replicator = mock(Replicator.class);

Whitebox.setInternalState(ProcessName, "replicator", replicator);

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now