# `DalaDev.CITesting`
[🔗](https://github.com/manhvu/dala_dev/blob/main/lib/dala_dev/ci_testing.ex#L1)

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)

# `suite_result`

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

# `test_case`

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

# `test_result`

```elixir
@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`

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

# `generate_ci_report`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
