Study guide
9.2 Automated Testing: Pega Unit Test Cases & Scenario Testing
Pegasystems Certified Pega System Architect CSA
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Exam Overview & Architecture Foundations
1.1 Certified Pega System Architect Exam Format, Blueprint & Strategy 1.2 Pega Architecture & Enterprise Class Structure (ECS) 1.3 Studio Environments: App Studio, Dev Studio, Admin Studio & Prediction Studio
2 Chapter 2: Case Lifecycle Design & Core Workflows
2.1 Case Types, Stages, Processes, and Steps 2.2 Routing Strategies: Worklists, Work Queues, and Teams 2.3 Service Level Agreements (SLAs) & Urgency Calculations
3 Chapter 3: Advanced Case Management Patterns
3.1 Multi-Step Processes, Parallel Processing & Sub-processes 3.2 Child Cases, Data Propagation & Wait Steps 3.3 Optional Actions, Approvals & Case Resolution 3.4 Duplicate Case Detection, Automation Shapes & Automated Correspondence
4 Chapter 4: Data Modeling & Data Page Architecture
4.1 Data Objects, Property Modes & Page Types 4.2 Data Pages: Scope, Types & Refresh Policies 4.3 Data Transforms & Object Mapping
5 Chapter 5: Business Logic, Calculations & Decisioning
5.1 Declare Expressions & Declarative Network Chaining 5.2 Decision Tables & Decision Trees 5.3 Integration Connectors, Systems of Record & Error Handling
6 Chapter 6: User Interface & User Experience Design
6.1 Traditional UI vs Constellation Architecture 6.2 Views, Dynamic Layouts, Design Templates & Action Sets 6.3 Form Validation, Edit Validate & WCAG Accessibility 6.4 Form Views: Default vs Hierarchical Forms, Field Groups & Primary Fields
7 Chapter 7: Rule Architecture & Rule Resolution
7.1 Rulesets, Versioning & Ruleset Stack Hierarchy 7.2 The Rule Resolution Algorithm 7.3 Circumstancing & Rule Specialization
8 Chapter 8: Security & Access Control
8.1 Authentication, Operator Records & Access Groups 8.2 Role-Based Access Control: Access Roles, ARO & Privileges 8.3 Attribute-Based Access Control (ABAC), Encryption & Audit Trails 8.4 The Security Checklist & Secure Deployment
9 Chapter 9: DevOps, Testing & Application Quality
9.1 Guardrail Compliance, Best Practices & Performance Profiling 9.2 Automated Testing: Pega Unit Test Cases & Scenario Testing 9.3 Packaging, Branching & Deployment Manager CI/CD
10 Chapter 10: Reporting & Operational Analytics
10.1 Report Definitions: Querying, Columns, Summaries & Joins 10.2 Filtering, Parameters & Column Exposure Optimization 10.3 Insights, Visual Dashboards & Business Metrics
11 Chapter 11: Mobility, Digital Channels & Portals
11.1 Mobile Channel Configuration & Offline Processing 11.2 Web Mashup, Digital Channels & Constellation Embed 11.3 Channels, Personas, Portals & Landing Pages
12 Chapter 12: Center-out Architecture, Enterprise Reuse & Agile Delivery
12.1 Center-out Business Architecture & the Case for Pega 12.2 The Situational Layer Cake, Modules & Enterprise Reuse 12.3 Agile Workbench, Workspaces, Branches, Delivery Roles & the Estimator
13 Chapter 13: Pega GenAI for System Architects
13.1 Pega Blueprint: Creating, Importing & Modifying an Application Design 13.2 Pega GenAI Autopilot & Pega GenAI Coach 13.3 Pega GenAI Connect Rules, Knowledge Buddy, Agents & Tool Rules
9.2 Automated Testing: Pega Unit Test Cases & Scenario Testing
Key Takeaways Explain This Topic AI
Pega's automated testing strategy adheres to the industry testing pyramid: a broad base of fast, isolated Pega Unit tests, a middle tier of UI-driven Scenario Tests, and a focused peak of end-to-end integration tests.
Pega Unit test cases (formerly AUT / Rule-Test-Case) validate discrete rule types including Decision Tables, Decision Trees, Data Transforms, Declare Expressions, and Case Types.
Unit test configurations consist of Setup data transforms to establish mock input data, comprehensive Assertions (Property value, Run time, Rule status), and Cleanup actions to prevent environment pollution.
Scenario Testing provides codeless, UI-driven end-to-end testing recorded directly in App Studio, capturing user interactions across multiple personas (e.g., Customer to Manager) and stored in dedicated test rulesets.
Pega Unit testing focuses on deterministic rule logic at the clipboard engine layer, whereas Scenario Testing verifies DOM UI presentation, user journeys, and cross-stage case lifecycles.
Last updated: September 2026
9.2 Automated Testing: Pega Unit Test Cases & Scenario Testing
CSA Exam Focus: Enterprise applications require continuous, automated quality verification to prevent regression defects as business requirements evolve. The Certified Pega System Architect exam tests candidates on the Pega Automated Testing Framework, specifically the architectural distinctions between Pega Unit testing (rule-level unit tests) and Scenario Testing (UI-level end-to-end workflow tests), the creation of setup/tear-down routines, assertion configuration, and code coverage measurement.
The Pega Automated Testing Pyramid
Pega implements an enterprise testing strategy modeled after the standard industry Testing Pyramid . A balanced automated testing portfolio optimizes defect detection efficiency, minimizes test maintenance overhead, and accelerates CI/CD release cycles. /\
- / \
- / E2E\ End-to-End & External Integration Testing
- /System\ - Validates complete multi-system integration
- /--------\ - Top of pyramid: Slower, highest maintenance
- / Scenario \ Scenario Testing (App Studio)
- / Testing \ - UI-driven end-to-end case journeys
- /--------------\ - Middle tier: Multi-persona approval paths
- / Pega Unit \ Pega Unit Testing (Dev Studio)
- / Test Cases \- Rule-level logic validation (AUT)
- /--------------------\- Broad base: Fastest, deterministic, lowest cost
- 1. Unit Testing (The Foundation)
Volume: Represents the vast majority of all automated tests in the application.
Focus: Validates individual, isolated business rules (such as a single Decision Table, Data Transform, or Declare Expression).
Characteristics: Executes in milliseconds directly within the Pega engine clipboard memory without rendering UI components or relying on network browser drivers. Highly deterministic and resilient to interface redesigns.
2. Scenario Testing (The Middle Layer)
Volume: A moderate collection of targeted business journeys.
Focus: Validates end-to-end case workflows, step navigation, and user interface interactions from the perspective of real end-user personas.
Characteristics: Authored codelessly in App Studio; executes through the browser DOM or headless browser drivers. Validates UI controls, action sets, stage transitions, and assignment routing.
3. Integration & System Testing (The Peak)
Volume: A focused set of critical regression flows.
Focus: Validates live integrations with external Systems of Record (live ERPs, mainframe connectors, external databases) and end-to-end enterprise network connectivity.
Characteristics: Slower execution speed, higher maintenance overhead, and sensitive to external test environment downtime.
Pega Unit: Automated Rule Testing ( Rule-Test-Case )
Pega Unit (historically referred to as Automated Unit Testing / AUT, represented internally by the rule type Rule-Test-Case ) enables system architects to create, maintain, and execute automated unit tests for individual rules directly within Dev Studio.
Supported Rule Types for Pega Unit
Pega Unit test cases can be created for all core procedural, declarative, and decisioning rules:
Decision Tables & Decision Trees : Validates complex branching logic, threshold boundaries, and default output values.
Data Transforms : Validates property mapping, conditional logic ( When ), appending page lists, and data sanitization.
Declare Expressions : Tests forward and backward chaining mathematical calculations and declarative networks.
Case Types : Validates end-to-end case instantiation, default property initialization, and initial stage routing.
Activities & Flow Rules : Tests programmatic utility routines and sub-process routing paths.
Anatomy of a Pega Unit Test Case
A complete Pega Unit test case consists of three distinct phases: Setup , Execution , and Assertions & Cleanup . +-----------------------------------------------------------------------------------+
- | PEGA UNIT TEST EXECUTION LIFECYCLE |
- +-----------------------------------------------------------------------------------+
- | 1. SETUP PHASE : Execute Setup Data Transform to populate test clipboard |
- | pages (e.g., mock applicant credit score and income). |
- | |
- | v
- | 2. EXECUTION PHASE : Pega engine runs the target rule using the setup data. |
- | |
- | v
- | 3. ASSERTION PHASE : Evaluate configured assertions against target output: |
- | - Property Value Assertions (.Status == 'Approved') |
- | - Run Time Assertions (Elapsed Time < 200 ms) |
- | - Rule Status Assertions (Status == Good) |
- | |
- | v
- | 4. CLEANUP PHASE : Execute Tear-Down action; remove temporary test pages from |
- | clipboard to prevent test contamination. |
- +-----------------------------------------------------------------------------------+
- Configuring Assertions
Assertions define the expected outcome criteria that determine whether the unit test passes or fails. Pega Unit provides three primary assertion types:
A. Property Value Assertions
Compares the runtime value of a target property on the output clipboard page against an expected constant, calculation, or expression:
Comparator Operators: Equal , Not Equal , Greater Than , Less Than , Contains .
Example: In a loan underwriting decision table, assert that .UnderwritingResult equals "PreApproved" and .InterestRate equals 4.25 .
B. Run Time (Execution Time) Assertions
Enforces non-functional performance service level agreements by asserting that the target rule completes execution within a maximum allowed duration:
Measurement: Milliseconds (ms).
Example: Assert that a high-volume pricing calculation Data Transform executes in less than 150 ms . If the rule takes 320 ms due to an unoptimized loop, the assertion fails, warning architects of performance regressions.
C. Rule Status Assertions
Verifies that the target rule finishes with a specific execution status or error condition:
Expected Status: Good (normal completion) or Fail (expected exception).
Message Verification: Asserts whether specific page-set error messages (e.g., .pxMessage ) were attached to clipboard properties during input validation tests.
Test Suites and Automated Code Coverage
Test Suites ( Rule-Test-Suite ): Architects group individual Pega Unit test cases into logical suites (e.g., AllUnderwritingTests or NightlyRegressionSuite ). Test suites can be executed manually on demand or triggered automatically via REST APIs in CI/CD deployment pipelines.
Code Coverage: Pega includes a built-in Rule Coverage tool. An architect starts a coverage session, executes unit test suites, and stops the session. The platform calculates the exact percentage of executable application rules exercised by the tests. Enterprise standards generally mandate 80%+ code coverage across all business rules before approving production release packages.
Scenario Testing: Codeless End-to-End UI Testing
While Pega Unit verifies individual rules in memory, Scenario Testing provides end-to-end automated functional testing through the user interface. Authored directly in App Studio , scenario tests simulate real user interactions within application portals.
Key Characteristics of Scenario Testing
Codeless Creation: Authored entirely by recording clicks, form entries, and button submissions directly in the running application interface.
Resilient UI Identifiers: Unlike brittle Selenium scripts that rely on volatile CSS selectors or dynamic XPath coordinates, Pega Scenario Testing anchors actions to stable, model-driven platform identifiers ( data-test-id ). If a UI section is restyled or moved into a different layout template, the test continues to run without failure.
Two Target Scopes:
Case Type Tests: Records user journeys through an entire case lifecycle, navigating across stages, processes, and views.
Portal Tests: Records administrative user interactions with portal dashboard widgets, landing pages, and navigation menus.
Recording a Scenario Test Journey
From the App Studio header, open the Scenario Testing panel.
Select Create test case and choose Case type or Portal .
Click Record . App Studio launches the application in test recording mode.
Perform the user journey: fill in form fields, upload test documents, click Next, select dropdown values, and submit assignments.
Insert Assertions : Click the orange crosshair tool on any on-screen UI element to add an assertion (e.g., verify that a case status badge displays "Pending-Approval" or that a calculated loan total displays $25,000 ).
Click Stop & Save to persist the test case.
Multi-Persona Journey Testing
A major capability of Scenario Testing is testing multi-persona case handoffs within a single automated test run:
Step 1: The test begins in the Customer Portal , simulating a customer submitting a new dispute case.
Step 2: The scenario switches operator context to a Customer Service Representative (CSR) in the Worker Portal, opening the newly routed assignment from the team Work Queue and completing initial document verification.
Step 3: The scenario switches operator context to a Branch Manager in the Manager Portal to approve the dispute.
Step 4: The scenario verifies that the case transitions to the Resolved-Completed stage and displays the correct final confirmation view.
Storage & CI/CD Execution of Scenario Tests
Dedicated Test Ruleset: Scenario tests must always be saved into a dedicated Test Ruleset (e.g., LoanAppTest ). Keeping test assets isolated in a test ruleset ensures that automated test scripts and test data are never inadvertently packaged into production deployment archives.
Headless Execution: Scenario tests can be executed in headless browser mode during automated CI/CD pipeline runs orchestrated by Pega Deployment Manager.
Comparison Matrix: Pega Unit vs. Scenario Testing
- Architectural Attribute Pega Unit Testing Scenario Testing
- Primary Authoring Studio Dev Studio App Studio
- Target Testing Layer Rule Layer (Clipboard Engine / RAM) UI Presentation Layer (Browser DOM)
- Target Rule Types Decision Tables, Transforms, Expressions, Cases Case Types (Stages/Views) and Portals
- Execution Engine Direct PRPC Java engine execution Browser session (Live or Headless Chrome)
- Execution Speed Milliseconds per test (Ultra-fast) Seconds to minutes per test (Slower)
- Primary Author Persona System Architect (Developer) Business Architect, Citizen Developer, QA
- Assertion Types Property values, Run time (ms), Rule status UI element visibility, text content, case status
- Maintenance Cost Very low (resilient to UI restructuring) Low-to-medium (model-driven data-test-ids)
- Deployment Storage Stored in dedicated test rulesets Stored in dedicated test rulesets