---
title: "Run Workday Studio AUnit Before You Accept AI Edits"
description: "Before you accept an AI edit to a Workday Studio assembly, run AUnit. A failing assertion stops the assembly. An unexpected exception is reported as an error."
url: https://kiweely.com/guides/workday-studio-aunit-before-ai-edits
---

# Run Workday Studio AUnit Before You Accept AI Edits

AUnit is Studio’s Java unit-test framework for assemblies. A test extends AssemblyTestCase, points at the assembly with @AssemblyTest, and checks the message with assertions. Run the tests before and after an AI edit. Developer Agent’s pages do not describe Studio.

-   **Checked** against Workday on November 16
-   Applies to **Workday Extend**
-   7 min read
-   Published November 16
-   By Kiweely

Accept an AI edit to a Workday Studio assembly only after the same AUnit tests pass that passed before the edit. AUnit is Studio’s framework for unit-testing assemblies. You write the tests in Java, in the assembly project, starting from a skeleton Studio creates. An assertion that fails aborts the assembly and reports a failure. An unexpected exception aborts the assembly and reports an error. Those two outcomes are the gate. A diff that “looks like the XSLT you asked for” is not.

This is a Studio practice. Workday’s Developer Agent overview describes Extend apps, pages, business objects, scripts, and queries. It does not describe Studio assemblies or AUnit. If an assistant outside Studio proposes a change to an assembly file, you still paste or merge it in Studio and run AUnit there. Nothing on the AUnit pages says an assistant runs these tests for you.

## What a test contains

Every AUnit test carries `@AssemblyTest`. That annotation marks the class as an AUnit test and ties it to the assembly project. Workday’s sample is `@AssemblyTest(project = "AUnitTrainer", displayLabel = "Citizens of the Cloud")`. The project attribute is the one that binds the test. The display label is optional in the sense that the minimal example Workday also prints is `@AssemblyTest(project = "AUnitTrainer")`.

A method marked `@UnitTest` is one case. `startComponent` is where that case begins in the assembly. The body puts a fixture on the message. Workday’s sample loads `test/simple-input.xml` as `text/xml` onto message part 0 with `setMessagePart`.

Assertions are Boolean conditions. You hang them on the assembly with one of these annotations:

| Annotation | When it runs | What people use it for |
| --- | --- | --- |
| `@AssertBefore` | Before a named component or step | The message is still what you think it is before a step mutates it |
| `@AssertAfter` | After a named component or step | The root part matches the expected XML, or an XPath returns the expected text |
| `@AssertAfterCompletion` | After the assembly finishes | A property such as an error count has the expected value |
| `@AtComponent` | When execution reaches a named component | Replace a call you cannot make from a unit test, or stop the chain |

`@AssertAfter(id = "Simple-Mediation", step = "transform")` is the sample that compares the message part to `test/simple-expected.xml` using `Comparator.dom`. A second sample checks XPath: the worker name is `Ace Developer` and the hire date is `2010-07-27-07:00`. Copy that shape. Point `id` and `step` at components that exist in your assembly. An assertion aimed at a step the AI renamed is a false failure, or it never runs.

`@AtComponent` returns an action. The sample for a component id `Next-Thing` returns `StandardAction` of type `terminate`, which stops the chain there. The sample for `Get-Workers` loads a fixture XML and returns type `mock`, so the test never calls Workday for workers. Mock the outbound call. Do not point a unit test at a tenant and call it AUnit.

If the assertion fails, Studio reports a failure. If something else throws, Studio reports an error. When you read a red run, keep those apart. A failure means the XML or the value was wrong. An error means the assembly or the test threw. An AI edit that drops a namespace often shows up as an error in the comparison, or as a failure against the expected document. Read which one you got before you prompt again.

## Create the skeleton once

Workday’s skeleton task creates the Java class inside an assembly project. The parts that page states in words you can follow:

-   The project is an Assembly project with Java support.
-   The project name must not contain spaces.
-   The class extends `com.workday.aunit.AssemblyTestCase`. You choose that superclass when you create the class.
-   You give the class a package and a name.
-   Studio opens the skeleton in the Java editor. The test then lives under the project in Project Explorer.

The skeleton page’s intermediate field labels did not come through as a complete click-path in a fetch on November 16, 2026. Use the labels Studio shows on that task, and use the superclass name above. Do not invent a menu name this guide does not have.

Put fixtures next to the test in the paths you pass to `setMessagePart` and `getTestResourceInputStream`, such as `test/simple-input.xml` and `test/simple-expected.xml`. Commit the expected file. An assistant that “updates the sample output” has changed the test, not the assembly. Review that diff as a test change and reject it unless the behavior change is intentional.

## Run it before and after the edit

Workday’s sample project is AUnit 101. It contains 8 processing chains. You run it from the assembly in Studio, then open the results. Use that sample once if you have never seen a green AUnit run, so you know what Studio looks like when the framework is healthy.

For your own assembly:

1.  Run the existing AUnit tests and keep the green result. If there are no tests, write the skeleton for the component you are about to let an assistant change. A missing test is not a pass.
2.  Give the assistant the component id and the step id, and the assertion you intend to keep. Ask it not to rename `@AssertAfter` targets and not to edit files under the test fixture path.
3.  Merge the assembly change in Studio. Do not merge a surprise edit to the test class in the same step.
4.  Run AUnit again. Failure means the message does not match. Error means the run threw. Fix the assembly or reject the edit. Do not update the expected XML to match a broken transform just so the bar turns green.
5.  Deploy and run in Studio only after that second run is green, and only through your normal Studio deploy. AUnit does not deploy the integration.

The AUnit 101 sample is also the place to see a test that ends in an error handler, because `@AssertAfterCompletion` can assert on `props['error.count']`. If your assembly is supposed to record a validation failure and continue, assert on that count. If it is supposed to stop, assert that the later step did not run, using `@AtComponent` to terminate or using an assertion that the later output is absent. Decide which behavior you want before the assistant “makes validation stricter.”

## A small test worth writing first

This is the sample’s structure, with the names you would replace. It is the minimum that fails closed.

```
@AssemblyTest(project = "PayrollReconcile")
public class PayrollReconcileTest extends AssemblyTestCase {

  @UnitTest(startComponent = "Reconcile")
  public void testOneWorker() throws Exception {
    setMessagePart(0, "test/one-worker.xml", "text/xml");
  }

  @AssertAfter(id = "Reconcile", step = "transform")
  public void totalsMatch() throws Exception {
    assertTrue(compare(
      getTestResourceInputStream("test/one-worker-expected.xml"),
      "text/xml",
      (InputStream) getMediationContext().getMessage().getMessagePart(0, InputStream.class),
      "text/xml",
      Comparator.dom));
  }
}
```

`PayrollReconcile`, `Reconcile`, and `transform` have to be your project, component, and step. The expected file has to be the output you already trust. Run this until it is green. Then let an assistant edit the transform. Run it again.

`@AssertBefore` is how you lock the input. If the assistant “helpfully” rewrites the start of the assembly, a before-assertion on the original message fails immediately, which is what you want.

## Failure modes

-   **The test is green because the assertion was deleted.** Read the test diff. AUnit does not fail a test that no longer asserts.
-   **The test errors instead of failing.** The step id in `@AssertAfter` no longer exists, or the message is not XML the comparator can read. Restore the id or fix the transform. Do not catch the exception inside the test to force a pass.
-   **The test calls Workday.** You skipped `@AtComponent` mock on the outbound step. A unit test that needs a tenant is not the test you can run before every edit.
-   **You accepted an edit to the expected file and the assembly together.** You no longer have a baseline. Revert the expected file from the commit that was green, and run again.
-   **You treated an Extend Validate as this gate.** App Builder validation does not run AUnit. Studio runs AUnit. They are different tools and different projects.

## Frequently asked questions

### Does Developer Agent run AUnit?

Workday’s Developer Agent overview does not say it edits Studio assemblies or runs AUnit. Run AUnit in Studio yourself before you accept an assembly edit from any assistant.

### What is the difference between a failure and an error?

A failed assertion aborts the run and is reported as a failure. An unexpected exception aborts the run and is reported as an error. Read which one Studio shows before you change the assembly again.

### Do I need a test per processing chain?

You need a test for the chain an assistant is allowed to edit. The AUnit 101 sample has 8 chains and is a demonstration, not a quota. One `@UnitTest` with an `@AssertAfter` on the step you care about is enough to start. Add `@AtComponent` with `mock` on any step that would otherwise call out.

### Where do I see a known-good run?

Open the AUnit 101 sample assembly in Studio and run it. Studio shows the results for those sample tests. Use that once so a red run on your project is familiar, then rely on your own expected files.

## Sources checked

-   [Concept: AUnit Tests](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-monitoring-and-troubleshooting/aunit-assembly-testing/rdo1516803990578.html)
-   [Reference: AUnit Test Annotations](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-monitoring-and-troubleshooting/aunit-assembly-testing/qqd1516813312165.html)
-   [Create an AUnit Test Skeleton for an Assembly Project](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-monitoring-and-troubleshooting/aunit-assembly-testing/avx1516737139825.html)
-   [Example: Run the AUnit Sample Tests](https://doc.workday.com/admin-guide/en-us/workday-studio/sample-assemblies/lev1533827214652.html)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### The Validate and Deploy Proof Ladder for Workday Extend Preview and validate before a tenant sees anything. Save to App Hub writes a build. Deploy reaches a development tenant only. Promote one level at a time. Model components still wait for the weekly update. Orchestrations validate in Orchestration Builder.](https://kiweely.com/guides/workday-extend-validate-deploy-proof-ladder)
-   [### The 25-Second Synchronous Orchestrate Trap Workday allows 5 minutes for a synchronous Extend orchestration, and 25 seconds when a presentation page triggers it. The page limit wins over any timeout you set. Longer work belongs in an asynchronous orchestration, which can run up to 48 hours and returns a job id instead of holding the page.](https://kiweely.com/guides/workday-orchestrate-25-second-sync-trap)

### More guides on Integrations and APIs

[All 89 guides](https://kiweely.com/guides#integrations)

-   [What AI tools can a Workday consultant use to build reports, calculated fields and EIB loads faster?](https://kiweely.com/guides/ai-tools-for-workday-reports-calculated-fields-eib)
-   [Which Workday Integrations May Auto-Remediate](https://kiweely.com/guides/which-workday-integrations-may-auto-remediate)
-   [An Integration Run Book Assistants Can Query](https://kiweely.com/guides/workday-integration-run-book-for-assistants)
-   [When Workday Integrations Should Leave the Tenant](https://kiweely.com/guides/when-workday-integrations-leave-the-tenant)
-   [Workday API Rate Limits When Many Employees Ask Questions in Chat](https://kiweely.com/guides/workday-rate-limits-when-employees-ask-in-chat)
-   [Workday SFTP File Contracts, PGP, and Overnight Failures](https://kiweely.com/guides/workday-sftp-file-contracts-pgp-overnight-failures)
-   [Recover Workday Integration Attributes After a Sandbox Refresh](https://kiweely.com/guides/workday-sandbox-refresh-integration-attributes)
-   [Inventory Every Workday Integration System, Schedule, and Owner](https://kiweely.com/guides/inventory-workday-integration-systems-schedules-owners)

### From the blog on Integrations and APIs

[All posts](https://kiweely.com/blog)

-   [Turning a Messy Client Spreadsheet into a Clean Workday EIB Load in One Conversation](https://kiweely.com/blog/messy-spreadsheet-to-workday-eib-load-with-ai)
-   [Workday REST API vs. SOAP Web Services: Why Setup Work Still Needs the Task Screen](https://kiweely.com/blog/workday-rest-api-vs-soap-coverage-gaps)
-   [Untangling Inherited Workday Studio Integrations: A Practical Modernization Playbook](https://kiweely.com/blog/untangling-inherited-workday-studio-integrations)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
