build static method

Future<EnsembleTestExecutionPlan> build({
  1. EnsembleTestAppTarget? target,
  2. EnsembleTestSelection selection = const EnsembleTestSelection(),
  3. Map<String, dynamic> inputs = const {},
})

Discovers assets, parses every file, validates graph, returns run order.

Implementation

static Future<EnsembleTestExecutionPlan> build({
  EnsembleTestAppTarget? target,
  EnsembleTestSelection selection = const EnsembleTestSelection(),
  Map<String, dynamic> inputs = const {},
}) async {
  final resolvedTarget =
      target ?? await EnsembleTestDiscovery.loadAppTarget();
  final paths = await EnsembleTestDiscovery.findTestYamlAssets(
    resolvedTarget.testsAssetPrefix,
  );
  final config = await EnsembleTestDiscovery.loadTestConfig(
    resolvedTarget.testsAssetPrefix,
  );
  if (paths.isEmpty) {
    throw EnsembleTestFailure(
      'No declarative tests found. Add *.test.yaml files under '
      '${resolvedTarget.testsAssetPrefix}',
    );
  }
  final assetContents = <String, String>{};
  for (final path in paths) {
    assetContents[path] = await rootBundle.loadString(path);
  }
  return _buildFromResolvedAssets(
    assetContents: assetContents,
    config: config,
    selection: selection,
    inputs: inputs,
  );
}