HR Leave · Australia

08 — ATF Testing (Studio From Scratch)

Suite HRLX Leave Core + 3 tests with concrete steps

Scopex_786686_hr_leave
sys_ide5f5bc9493a303507520703efaba104d
Instance labdev398980
URL token{BASE}
Quick open Visual map Test Suites Tests

Visual map — Ch.08 · ATF — proof

See in 10 seconds

Suite HRLX Leave Core · BR1 · ACL · CS2

You build

Automated evidence

Track

Development

SUITECreate
→
T1BR1 days
→
T2ACL isolation
→
T3Form days
→
RUNGreen
✓ Impersonate in ACL test✓ Break BR1 once to prove✗ Pass as admin only

Full visual path (all chapters): VISUAL_FROM_SCRATCH_00_16.html

Studio-only from scratch: ATF runs in-instance after core app from chapters 01–02 exists.

Also open: Properties + Direct Links · Schema · Studio Create All Objects · Previous: 07 Reports

How ATF objects relate

Part 1 Suite groups Parts 2–4 individual tests (server BR1, client CS2, ACL isolation).


Rule 0 — Before any object (Application + Update Set + Studio)

Repeat these checks before creating or editing any application file. This section is also section 00 Update Set — create the capture set first.

  1. Application picker — top-right globe / application menu → select HR Leave (x_786686_hr_leave). Never leave Global selected when creating scoped artifacts.
  2. Update Set — All → System Update Sets → Local Update Sets → New:
    FieldValue
    NameHR Leave – Build
    ApplicationHR Leave
    StateIn Progress
    DescriptionCaptures all HR Leave lab artifacts
    After submit: open the record → click Make Current. Direct list: {BASE}/sys_update_set_list.do
  3. Open Studio — {BASE}/$studio.do → confirm header shows HR Leave.

If artifacts land in Global scope, delete them and recreate under HR Leave. ACLs and events created globally will not behave correctly for this app.

Verify Update Set: Create a test Script Include in Studio → open HR Leave – Build → Related List Customer Updates shows the new file.


Part 1: Test Suite — HRLX Leave Core

Purpose

Container suite for all HR Leave automated tests.

Navigation path

Direct URL

Prerequisites

Form fields

FieldValue
NameHRLX Leave Core
ApplicationHR Leave
Activetrue

Step-by-step create

  1. Test Suite → New → fill fields.
  2. After Parts 2–4: Related list Tests → Add all three tests.
  3. Run Suite → all green.

Verify checklist

Demo / test

Run HRLX Leave Core suite after E2E seed → 3/3 pass.


Part 2: Test — BR1 Business Days (Server)

Purpose

Validates BR1 sets u_days_count = 5 for Mon–Fri range.

Navigation path

Prerequisites

Form fields

FieldValue
NameHRLX BR1 Days Calculation
ApplicationHR Leave

Step-by-step create

  1. ATF → Tests → New → Name: HRLX BR1 Days Calculation.
  2. Step 1: Create a Record → Table req_v2 → u_start_date=2026-06-01, u_end_date=2026-06-05, u_state=draft.
  3. Step 2: Run Server Side Script → assertion below.

Full script (assertion step)

(function(outputs, steps, stepResult, assertEqual) {
  var gr = new GlideRecord('x_786686_hr_leave_req_v2');
  gr.get(steps('Create a Record').record_id);
  assertEqual({ name: 'days', expected: '5', actual: gr.getValue('u_days_count') });
})(outputs, steps, stepResult, assertEqual);

Verify checklist

Demo / test

Run test alone → green.


Part 3: Test — CS2 Form Days (Client)

Purpose

Client test: changing dates on form fills u_days_count via GlideAjax.

Navigation path

Prerequisites

Form fields

FieldValue
NameHRLX CS2 Form Days

Step-by-step create

  1. New client test: HRLX CS2 Form Days.
  2. Step: Open/New req_v2 form.
  3. Step: Set Field Values u_start_date, u_end_date.
  4. Step: Assert Field Value u_days_count equals 5.

Verify checklist

Demo / test

Run test → u_days_count populated.


Part 4: Test — ACL Employee Isolation (Server)

Purpose

Impersonate employee1 → query returns only own req_v2 records.

Navigation path

Prerequisites

Form fields

FieldValue
NameHRLX ACL Employee Isolation

Step-by-step create

  1. Test: HRLX ACL Employee Isolation.
  2. Step: Impersonate user employee1.
  3. Step: Record Query req_v2 → assert count matches only own records.

Verify checklist

Demo / test

Add to suite Part 1 → run full suite.

ATF verify checklist

  1. Three tests in HRLX Leave Core suite.
  2. Suite runs without failure.