includedInTestPlan function

bool includedInTestPlan(
  1. TestPlanV1 plan, {
  2. String? id,
  3. String? fullName,
  4. String? nativeSelector,
  5. Iterable<String>? tags,
})

Whether a test identified by id, selector, or tags is included in plan.

Implementation

bool includedInTestPlan(
  TestPlanV1 plan, {
  String? id,
  String? fullName,
  String? nativeSelector,
  Iterable<String>? tags,
}) {
  final effectiveId = id ?? _extractAllureIdFromTags(tags);

  for (final entry in plan.tests) {
    final idMatched = effectiveId != null &&
        entry.id != null &&
        entry.id.toString() == effectiveId;
    final selectorMatched = fullName != null &&
        entry.selector != null &&
        entry.selector == fullName;
    final nativeSelectorMatched = nativeSelector != null &&
        entry.selector != null &&
        entry.selector == nativeSelector;
    if (idMatched || selectorMatched || nativeSelectorMatched) {
      return true;
    }
  }
  return false;
}