DalaDev.CITesting (dala_dev v0.2.0)

Copy Markdown View Source

CI/CD integration for mobile cluster testing.

Provides automated testing capabilities for dala Elixir clusters, including test orchestration, result collection, and reporting.

Examples

# Run a test suite on a cluster
{:ok, results} = DalaDev.CITesting.run_suite(my_suite, nodes: nodes)

# Generate a CI report
DalaDev.CITesting.generate_ci_report(results, format: :junit)

# Run tests with automatic device provisioning
{:ok, results} = DalaDev.CITesting.run_with_provisioning(test_config)

Summary

Functions

Generate a CI report from suite results.

Run a test suite on specified nodes.

Run tests with automatic device provisioning.

Create a simple test suite from a list of modules.

Types

suite_result()

@type suite_result() :: %{
  suite: test_suite(),
  results: [test_result()],
  summary: map(),
  start_time: DateTime.t(),
  end_time: DateTime.t()
}

test_case()

@type test_case() :: %{
  name: String.t(),
  module: module(),
  test_fun: (-> any()) | nil,
  timeout: integer(),
  tags: [atom()]
}

test_result()

@type test_result() :: %{
  test: test_case(),
  node: node(),
  status: :passed | :failed | :skipped | :timeout,
  duration_ms: integer(),
  error: term() | nil,
  output: String.t() | nil
}

test_suite()

@type test_suite() :: %{
  name: String.t(),
  tests: [test_case()],
  setup: (-> any()) | nil,
  teardown: (-> any()) | nil
}

Functions

generate_ci_report(suite_result, opts \\ [])

@spec generate_ci_report(
  suite_result(),
  keyword()
) :: {:ok, String.t() | :ok} | {:error, term()}

Generate a CI report from suite results.

Formats:

  • :junit - JUnit XML format for CI systems
  • :html - HTML report
  • :text - Plain text summary
  • :json - JSON format

run_suite(suite, opts \\ [])

@spec run_suite(
  test_suite(),
  keyword()
) :: {:ok, suite_result()} | {:error, term()}

Run a test suite on specified nodes.

Options:

  • :nodes - List of nodes to run tests on (default: Node.list())
  • :parallel - Run tests in parallel (default: true)
  • :timeout - Per-test timeout in ms (default: 60_000)

Returns a suite_result.

run_with_provisioning(suite, opts \\ [])

@spec run_with_provisioning(
  test_suite(),
  keyword()
) :: {:ok, suite_result()} | {:error, term()}

Run tests with automatic device provisioning.

This will:

  1. Provision devices/emulators as needed
  2. Deploy the test build
  3. Run the test suite
  4. Collect results
  5. Clean up (optional)

Options:

  • :cleanup - Clean up after tests (default: true)
  • :provision_opts - Options passed to provisioning

suite_from_modules(name, modules)

@spec suite_from_modules(String.t(), [module()]) :: test_suite()

Create a simple test suite from a list of modules.

Each module should have a run_tests/0 function that returns test results.