Skip to content

Automation tests — utilities + infrastructure #2797

Description

@stelbailey

What

Create the test package and utility class that all Phase 1 automation tests will build on. Mirrors the pattern established in migration-poc (MigrationTestUtils, AbstractBaseSemossApiTests).

Files to create

test/prerna/testing/automation/
  AutomationTestUtils.java

AutomationTestUtils.java — methods to include

One process variant (uses ApiSemossTestUtils.processPixel) and one expectError variant (uses processRawPixel) for each automation reactor:

Automation definition CRUD

  • createAutomation(String name, String projectId, Map<String,Object> graph)Map<String,Object>
  • getAutomation(String automationId)Map<String,Object>
  • listAutomations(String projectId)List<Map<String,Object>>
  • deleteAutomation(String automationId)Map<String,Object>
  • createAutomationExpectError(...), getAutomationExpectError(...), etc.

Run lifecycle

  • triggerAutomation(String automationId)Map<String,Object> (returns runId + initial status)
  • cancelAutomationRun(String automationId, String runId)Map<String,Object>
  • listAutomationRuns(String automationId)List<Map<String,Object>>
  • getAutomationRun(String automationId, String runId)Map<String,Object>
  • getAutomationNodeOutputs(String runId)List<Map<String,Object>>
  • Error variants for each

Polling helper (for async tests)

public static Map<String,Object> waitForRunCompletion(String automationId, String runId, int timeoutSeconds)

Polls getAutomationRun every 500ms until status is COMPLETED, FAILED, or CANCELLED, or timeout is reached. Throws AssertionError on timeout.

Pattern reference

See test/prerna/testing/migration/MigrationTestUtils.java on the migration-poc branch. Exact same structure: build Pixel call string via ApiSemossTestUtils.buildPixelCall, run via processPixel/processRawPixel, cast and return value.

AC

  • All methods compile and are usable from test classes that extend AbstractBaseSemossApiTests
  • waitForRunCompletion reliably returns once a run reaches a terminal state in the H2 test environment
  • No mocking — all calls go through the full Pixel execution stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions