Branch Coverage

blib/lib/WebService/GrowthBook.pm
Criterion Covered Total %
branch 89 180 49.4


line true false branch
99 0 39 if (builtin::blessed($feature) and $feature->isa('WebService::GrowthBook::Feature')) { }
110 0 3 unless defined $result
116 0 3 unless defined $result
123 5 39 unless (exists $features->{$feature_name})
128 0 39 if ($stack->{$feature_name})
138 0 37 if ($rule->parent_conditions)
140 0 0 if ($prereq_res eq 'gate') { }
0 0 elsif ($prereq_res eq 'cyclic') { }
0 0 elsif ($prereq_res eq 'fail') { }
153 11 26 if ($rule->condition)
154 7 4 unless (eval_condition($attributes, $rule->condition))
160 2 28 if ($rule->filters)
161 1 1 if ($self->_is_filtered_out($rule->filters))
169 16 13 if (defined $rule->force)
170 4 12 unless ($self->_is_included_in_rollout($rule->seed || $feature_name, $rule->hash_attribute, $rule->fallback_attribute, $rule->range, $rule->coverage, $rule->hash_version))
192 1 12 unless (defined $rule->variations)
220 3 9 unless ($result->in_experiment)
226 1 8 if ($result->passthrough)
253 82 0 if (not $prev or $prev->{'result'}->in_experiment != $result->in_experiment or $prev->{'result'}->variation_id != $result->variation_id)
265 0 0 unless (eval { do { &$cb($experiment, $result) } })
274 1 81 if (scalar @{$experiment->variations;} < 2)
282 1 80 unless ($enabled)
289 0 80 if (exists $$overrides{$experiment->key})
297 2 78 if (defined $qs)
307 3 75 if (exists $$forced_variations{$experiment->key})
319 1 74 if ($experiment->status eq "draft" or not $experiment->active)
326 5 69 unless ($hash_value)
338 0 69 if ($sticky_bucket_service and not $experiment->disableStickyBucketing)
353 0 69 if ($found_sticky_bucket) { }
362 4 65 if ($experiment->filters) { }
2 125 elsif ($experiment->namespace and not in_namespace($hash_value, $experiment->namespace)) { }
365 1 3 if ($self->_is_filtered_out($experiment->filters))
378 0 66 if ($experiment->include)
380 0 0 unless ($experiment->include->())
387 0 0 unless (eval { do { unless ($experiment->include->()) { $WebService::GrowthBook::log->debugf("Skip experiment %s because include() returned false", $experiment->key); return $self->_get_experiment_result($experiment, "feature_id", $feature_id); } } })
397 1 65 if ($experiment->condition and not eval_condition($self->attributes, $experiment->condition))
405 0 65 if ($experiment->parent_conditions)
407 0 0 if ($prereq_res eq "gate" or $prereq_res eq "fail")
413 0 0 if ($prereq_res eq "cyclic")
422 0 65 if ($experiment->groups and @{$experiment->groups;})
426 0 0 if ($exp_groups->{$group})
431 0 0 unless ($matched)
445 0 65 if ($experiment->url)
446 0 0 unless ($self->_url_is_valid($experiment->url))
459 0 65 unless (defined $n)
466 65 0 unless ($found_sticky_bucket)
476 0 65 if ($sticky_bucket_version_is_blocked)
487 8 57 if ($assigned < 0)
496 3 54 if (defined $experiment->force)
506 1 53 if ($qa_mode)
512 0 53 if ($experiment->status eq "stopped")
528 0 53 if ($sticky_bucket_service and not $experiment->disable_sticky_bucketing)
540 0 0 if ($doc and $data->{'changed'})
556 53 0 unless $tracking_callback
563 0 0 unless ($tracked->{$key})
567 0 0 unless (eval { do { &$tracking_callback($experiment, $result); $tracked->{$key} = 1 } })
594 0 0 unless $url
598 0 0 if ($self->{'_url'} =~ /$r/)
606 0 0 if ($path_only =~ /$r/)
610 0 0 unless (eval { do { my $r = qr/$pattern/; if ($self->{'_url'} =~ /$r/) { return 1; } ; my $path_only = $url; $path_only =~ s[^[^/]*/][/]; $path_only =~ s[^https?://][]; if ($path_only =~ /$r/) { return 1; } ; return 0 } })
619 0 8 if ($hash_value eq "")
624 0 8 unless (defined $n)
630 6 5 if (in_range($n, $range))
635 2 6 unless ($filtered)
647 0 0 if (exists $sticky_bucket_assignment_docs->{$key})
651 0 0 if ($fallback)
654 0 0 if (exists $self->{'_sticky_bucket_assignment_docs'}{$key})
670 0 0 if ($self->_is_blocked($assignments, $experiment_key, $min_bucket_version))
678 0 0 unless ($variation_key)
687 0 0 if ($meta->[$i]{'key'} eq $variation_key)
693 0 0 if ($variation < 0)
703 0 0 if ($min_bucket_version > 0)
706 0 0 if (exists $assignments->{$blocked_key})
725 23 59 if ($variation_id < 0 or $variation_id > @{$experiment->variations;} - 1)
731 3 79 if ($experiment->meta)
751 8 3 unless (defined $coverage or defined $range)
756 1 7 if ($hash_value eq "")
762 1 6 unless (defined $n)
767 4 2 if ($range) { }
2 0 elsif ($coverage) { }
788 165 7 if (exists $attributes->{$attr}) { }
0 7 elsif (exists $user->{$attr}) { }
795 0 0 if (!$val || $val eq '' and $fallback_attr and $self->{'sticky_bucket_service'})
796 0 0 if (exists $attributes->{$fallback_attr}) { }
0 0 elsif (exists $user->{$fallback_attr}) { }
802 0 0 if (not $val or $val ne "")
814 0 0 if ($parent_res->{'source'} eq "cyclicPrerequisite")
818 0 0 unless (eval_condition({"value", $parent_res->{'value'}}, $parent_condition->{'condition'}))
819 0 0 if ($parent_condition->{'gate'})
833 2 4 unless defined $result->value