Skip to content

Acceptance Test Module

This section documents the acceptance test components of the Nextmv Cloud API.

acceptance_test

Definitions for acceptance tests in the Nextmv Cloud platform.

This module provides classes and enumerations for working with acceptance tests in the Nextmv Cloud platform. Acceptance tests are used to compare the performance of different versions of an app against a set of metrics.

CLASS DESCRIPTION
MetricType : Enum

Type of metric when doing a comparison.

StatisticType : Enum

Type of statistical process for collapsing multiple values of a metric.

Comparison : Enum

Comparison operators to use for comparing two metrics.

ToleranceType : Enum

Type of tolerance used for a metric.

ExperimentStatus : Enum

Status of an acceptance test experiment.

MetricTolerance : BaseModel

Tolerance used for a metric in an acceptance test.

MetricParams : BaseModel

Parameters of a metric comparison in an acceptance test.

Metric : BaseModel

A metric used to evaluate the performance of a test.

ComparisonInstance : BaseModel

An app instance used for a comparison in an acceptance test.

DistributionSummaryStatistics : BaseModel

Statistics of a distribution summary for metric results.

DistributionPercentiles : BaseModel

Percentiles of a metric value distribution.

ResultStatistics : BaseModel

Statistics of a single instance's metric results.

MetricStatistics : BaseModel

Statistics of a metric comparing control and candidate instances.

MetricResult : BaseModel

Result of a metric evaluation in an acceptance test.

AcceptanceTestResults : BaseModel

Results of an acceptance test.

AcceptanceTest : BaseModel

An acceptance test for evaluating app instances.

AcceptanceTest

Bases: BaseModel

An acceptance test for evaluating app instances.

You can import the AcceptanceTest class directly from cloud:

from nextmv.cloud import AcceptanceTest

An acceptance test gives a go/no-go decision criteria for a set of metrics. It relies on a batch experiment to compare a candidate app instance against a control app instance.

ATTRIBUTE DESCRIPTION
id

ID of the acceptance test.

TYPE: str

name

Name of the acceptance test.

TYPE: str

description

Description of the acceptance test.

TYPE: str

app_id

ID of the app that owns the acceptance test.

TYPE: str

experiment_id

ID of the batch experiment underlying the acceptance test.

TYPE: str

control

Control instance of the acceptance test.

TYPE: ComparisonInstance

candidate

Candidate instance of the acceptance test.

TYPE: ComparisonInstance

metrics

Metrics to evaluate in the acceptance test.

TYPE: list[Metric]

created_at

Creation date of the acceptance test.

TYPE: datetime

updated_at

Last update date of the acceptance test.

TYPE: datetime

status

Status of the acceptance test.

TYPE: (ExperimentStatus, optional)

results

Results of the acceptance test.

TYPE: (AcceptanceTestResults, optional)

Examples:

>>> from nextmv.cloud import (
...     AcceptanceTest, ComparisonInstance, Metric, ExperimentStatus
... )
>>> from datetime import datetime
>>> test = AcceptanceTest(
...     id="test-123",
...     name="Performance acceptance test",
...     description="Testing performance improvements",
...     app_id="app-456",
...     experiment_id="exp-789",
...     control=ComparisonInstance(
...         instance_id="control-instance",
...         version_id="control-version"
...     ),
...     candidate=ComparisonInstance(
...         instance_id="candidate-instance",
...         version_id="candidate-version"
...     ),
...     metrics=[metric1, metric2],  # previously created metrics
...     created_at=datetime.now(),
...     updated_at=datetime.now(),
...     status=ExperimentStatus.started
... )
>>> test.status
<ExperimentStatus.started: 'started'>

app_id instance-attribute

app_id: str

ID of the app that owns the acceptance test.

candidate instance-attribute

candidate: ComparisonInstance

Candidate instance of the acceptance test.

control instance-attribute

Control instance of the acceptance test.

created_at instance-attribute

created_at: datetime

Creation date of the acceptance test.

description instance-attribute

description: str

Description of the acceptance test.

experiment_id instance-attribute

experiment_id: str

ID of the batch experiment underlying in the acceptance test.

id instance-attribute

id: str

ID of the acceptance test.

metrics instance-attribute

metrics: list[Metric]

Metrics of the acceptance test.

name instance-attribute

name: str

Name of the acceptance test.

results class-attribute instance-attribute

results: Optional[AcceptanceTestResults] = None

Results of the acceptance test.

status class-attribute instance-attribute

status: Optional[ExperimentStatus] = unknown

Status of the acceptance test.

updated_at instance-attribute

updated_at: datetime

Last update date of the acceptance test.

AcceptanceTestResults

Bases: BaseModel

Results of an acceptance test.

You can import the AcceptanceTestResults class directly from cloud:

from nextmv.cloud import AcceptanceTestResults

This class contains the overall results of an acceptance test, including whether the test passed and detailed results for each metric.

ATTRIBUTE DESCRIPTION
passed

Whether the acceptance test passed overall.

TYPE: bool

metric_results

Results for each metric in the test.

TYPE: (list[MetricResult], optional)

error

Error message if the acceptance test failed.

TYPE: (str, optional)

Examples:

>>> from nextmv.cloud import AcceptanceTestResults
>>> # Assume metric_results is a list of MetricResult objects
>>> results = AcceptanceTestResults(
...     passed=True,
...     metric_results=metric_results  # previously created list of results
... )
>>> results.passed
True
>>>
>>> # Example with error
>>> error_results = AcceptanceTestResults(
...     passed=False,
...     error="Experiment failed to complete"
... )
>>> error_results.passed
False
>>> error_results.error
'Experiment failed to complete'

error class-attribute instance-attribute

error: Optional[str] = None

Error message if the acceptance test failed.

metric_results class-attribute instance-attribute

metric_results: Optional[list[MetricResult]] = None

Results of the metrics.

passed instance-attribute

passed: bool

Whether the acceptance test passed (or not).

Comparison

Bases: str, Enum

Comparison operators to use for comparing two metrics.

You can import the Comparison class directly from cloud:

from nextmv.cloud import Comparison

This enumeration defines the different comparison operators that can be used to compare two metric values in an acceptance test.

ATTRIBUTE DESCRIPTION
equal_to

Equal to operator (==).

TYPE: str

greater_than

Greater than operator (>).

TYPE: str

greater_than_or_equal_to

Greater than or equal to operator (>=).

TYPE: str

less_than

Less than operator (<).

TYPE: str

less_than_or_equal_to

Less than or equal to operator (<=).

TYPE: str

not_equal_to

Not equal to operator (!=).

TYPE: str

Examples:

>>> from nextmv.cloud import Comparison
>>> op = Comparison.greater_than
>>> op
<Comparison.greater_than: 'gt'>

equal_to class-attribute instance-attribute

equal_to = 'eq'

Equal to metric type.

greater_than class-attribute instance-attribute

greater_than = 'gt'

Greater than metric type.

greater_than_or_equal_to class-attribute instance-attribute

greater_than_or_equal_to = 'ge'

Greater than or equal to metric type.

less_than class-attribute instance-attribute

less_than = 'lt'

Less than metric type.

less_than_or_equal_to class-attribute instance-attribute

less_than_or_equal_to = 'le'

Less than or equal to metric type.

not_equal_to class-attribute instance-attribute

not_equal_to = 'ne'

Not equal to metric type.

ComparisonInstance

Bases: BaseModel

An app instance used for a comparison in an acceptance test.

You can import the ComparisonInstance class directly from cloud:

from nextmv.cloud import ComparisonInstance

This class represents an app instance used in a comparison, identifying both the instance and its version.

ATTRIBUTE DESCRIPTION
instance_id

ID of the instance.

TYPE: str

version_id

ID of the version.

TYPE: str

Examples:

>>> from nextmv.cloud import ComparisonInstance
>>> instance = ComparisonInstance(
...     instance_id="instance-123",
...     version_id="version-456"
... )
>>> instance.instance_id
'instance-123'
>>> instance.version_id
'version-456'

instance_id instance-attribute

instance_id: str

ID of the instance.

version_id instance-attribute

version_id: str

ID of the version.

DistributionPercentiles

Bases: BaseModel

Percentiles of a metric value distribution.

You can import the DistributionPercentiles class directly from cloud:

from nextmv.cloud import DistributionPercentiles

This class contains the different percentiles of a distribution of metric values across multiple runs.

ATTRIBUTE DESCRIPTION
p01

1st percentile of the distribution.

TYPE: float

p05

5th percentile of the distribution.

TYPE: float

p10

10th percentile of the distribution.

TYPE: float

p25

25th percentile of the distribution.

TYPE: float

p50

50th percentile of the distribution (median).

TYPE: float

p75

75th percentile of the distribution.

TYPE: float

p90

90th percentile of the distribution.

TYPE: float

p95

95th percentile of the distribution.

TYPE: float

p99

99th percentile of the distribution.

TYPE: float

Examples:

>>> from nextmv.cloud import DistributionPercentiles
>>> percentiles = DistributionPercentiles(
...     p01=10.0,
...     p05=12.0,
...     p10=13.0,
...     p25=14.0,
...     p50=15.0,
...     p75=16.0,
...     p90=17.0,
...     p95=18.0,
...     p99=19.0
... )
>>> percentiles.p50  # median
15.0

p01 instance-attribute

p01: float

1st percentile.

p05 instance-attribute

p05: float

5th percentile.

p10 instance-attribute

p10: float

10th percentile.

p25 instance-attribute

p25: float

25th percentile.

p50 instance-attribute

p50: float

50th percentile.

p75 instance-attribute

p75: float

75th percentile.

p90 instance-attribute

p90: float

90th percentile.

p95 instance-attribute

p95: float

95th percentile.

p99 instance-attribute

p99: float

99th percentile.

DistributionSummaryStatistics

Bases: BaseModel

Statistics of a distribution summary for metric results.

You can import the DistributionSummaryStatistics class directly from cloud:

from nextmv.cloud import DistributionSummaryStatistics

This class contains statistical measures summarizing the distribution of metric values across multiple runs.

ATTRIBUTE DESCRIPTION
min

Minimum value in the distribution.

TYPE: float

max

Maximum value in the distribution.

TYPE: float

count

Count of runs in the distribution.

TYPE: int

mean

Mean value of the distribution.

TYPE: float

std

Standard deviation of the distribution.

TYPE: float

shifted_geometric_mean

Shifted geometric mean of the distribution.

TYPE: float

shift_parameter

Shift parameter used for the geometric mean calculation.

TYPE: float

Examples:

>>> from nextmv.cloud import DistributionSummaryStatistics
>>> stats = DistributionSummaryStatistics(
...     min=10.0,
...     max=20.0,
...     count=5,
...     mean=15.0,
...     std=4.0,
...     shifted_geometric_mean=14.5,
...     shift_parameter=1.0
... )
>>> stats.mean
15.0
>>> stats.count
5

count instance-attribute

count: int

Count of runs.

max instance-attribute

max: float

Maximum value.

mean instance-attribute

mean: float

Mean value.

min instance-attribute

min: float

Minimum value.

shift_parameter instance-attribute

shift_parameter: float

Shift parameter of the geometric mean.

shifted_geometric_mean instance-attribute

shifted_geometric_mean: float

Shifted geometric mean.

std instance-attribute

std: float

Standard deviation.

ExperimentStatus

Bases: str, Enum

Status of an acceptance test experiment.

You can import the ExperimentStatus class directly from cloud:

from nextmv.cloud import ExperimentStatus

This enumeration defines the different possible statuses of an experiment underlying an acceptance test.

ATTRIBUTE DESCRIPTION
started

The experiment has started.

TYPE: str

completed

The experiment was completed successfully.

TYPE: str

failed

The experiment failed.

TYPE: str

draft

The experiment is a draft.

TYPE: str

canceled

The experiment was canceled.

TYPE: str

unknown

The experiment status is unknown.

TYPE: str

Examples:

>>> from nextmv.cloud import ExperimentStatus
>>> status = ExperimentStatus.completed
>>> status
<ExperimentStatus.completed: 'completed'>

canceled class-attribute instance-attribute

canceled = 'canceled'

The experiment was canceled.

completed class-attribute instance-attribute

completed = 'completed'

The experiment was completed.

draft class-attribute instance-attribute

draft = 'draft'

The experiment is a draft.

failed class-attribute instance-attribute

failed = 'failed'

The experiment failed.

started class-attribute instance-attribute

started = 'started'

The experiment has started.

unknown class-attribute instance-attribute

unknown = 'unknown'

The experiment status is unknown.

Metric

Bases: BaseModel

A metric used to evaluate the performance of a test.

You can import the Metric class directly from cloud:

from nextmv.cloud import Metric

A metric is a key performance indicator that is used to evaluate the performance of a test. It defines the field to measure, the type of comparison, and the statistical method to use.

ATTRIBUTE DESCRIPTION
field

Field of the metric to measure (e.g., "solution.objective").

TYPE: str

metric_type

Type of the metric comparison.

TYPE: MetricType

params

Parameters of the metric comparison.

TYPE: MetricParams

statistic

Type of statistical process for collapsing multiple values into a single value.

TYPE: StatisticType

Examples:

>>> from nextmv.cloud import (
...     Metric, MetricType, MetricParams, Comparison,
...     MetricTolerance, ToleranceType, StatisticType
... )
>>> metric = Metric(
...     field="solution.objective",
...     metric_type=MetricType.direct_comparison,
...     params=MetricParams(
...         operator=Comparison.less_than,
...         tolerance=MetricTolerance(
...             type=ToleranceType.relative,
...             value=0.05
...         )
...     ),
...     statistic=StatisticType.mean
... )
>>> metric.field
'solution.objective'

field instance-attribute

field: str

Field of the metric.

metric_type instance-attribute

metric_type: MetricType

Type of the metric.

params instance-attribute

params: MetricParams

Parameters of the metric.

statistic instance-attribute

statistic: StatisticType

Type of statistical process for collapsing multiple values of a metric (from multiple runs) into a single value.

MetricParams

Bases: BaseModel

Parameters of a metric comparison in an acceptance test.

You can import the MetricParams class directly from cloud:

from nextmv.cloud import MetricParams

This class defines the parameters used for comparing metric values, including the comparison operator and tolerance.

ATTRIBUTE DESCRIPTION
operator

Operator used to compare two metrics (e.g., greater than, less than).

TYPE: Comparison

tolerance

Tolerance used for the comparison.

TYPE: MetricTolerance

Examples:

>>> from nextmv.cloud import MetricParams, Comparison, MetricTolerance, ToleranceType
>>> params = MetricParams(
...     operator=Comparison.less_than,
...     tolerance=MetricTolerance(type=ToleranceType.absolute, value=0.5)
... )
>>> params.operator
<Comparison.less_than: 'lt'>

operator instance-attribute

operator: Comparison

Operator used to compare two metrics.

tolerance instance-attribute

tolerance: MetricTolerance

Tolerance used for the comparison.

MetricResult

Bases: BaseModel

Result of a metric evaluation in an acceptance test.

You can import the MetricResult class directly from cloud:

from nextmv.cloud import MetricResult

This class represents the result of evaluating a specific metric in an acceptance test, including whether the candidate passed according to this metric.

ATTRIBUTE DESCRIPTION
metric

The metric that was evaluated.

TYPE: Metric

statistics

Statistics comparing control and candidate instances for this metric.

TYPE: MetricStatistics

passed

Whether the candidate passed for this metric.

TYPE: bool

Examples:

>>> from nextmv.cloud import (
...     MetricResult, Metric, MetricType, MetricParams, Comparison,
...     MetricTolerance, ToleranceType, StatisticType, MetricStatistics
... )
>>> # Assume we have statistics object already created
>>> result = MetricResult(
...     metric=Metric(
...         field="solution.objective",
...         metric_type=MetricType.direct_comparison,
...         params=MetricParams(
...             operator=Comparison.less_than,
...             tolerance=MetricTolerance(
...                 type=ToleranceType.relative,
...                 value=0.05
...             )
...         ),
...         statistic=StatisticType.mean
...     ),
...     statistics=statistics,  # previously created statistics object
...     passed=True
... )
>>> result.passed
True

metric instance-attribute

metric: Metric

Metric of the result.

passed instance-attribute

passed: bool

Whether the candidate passed for the metric (or not).

statistics instance-attribute

statistics: MetricStatistics

Statistics of the metric.

MetricStatistics

Bases: BaseModel

Statistics of a metric comparing control and candidate instances.

You can import the MetricStatistics class directly from cloud:

from nextmv.cloud import MetricStatistics

This class holds the statistical information for both the control and candidate instances being compared in the acceptance test.

ATTRIBUTE DESCRIPTION
control

Statistics for the control instance.

TYPE: ResultStatistics

candidate

Statistics for the candidate instance.

TYPE: ResultStatistics

Examples:

>>> from nextmv.cloud import (
...     MetricStatistics, ResultStatistics,
...     DistributionSummaryStatistics, DistributionPercentiles
... )
>>> stats = MetricStatistics(
...     control=ResultStatistics(
...         instance_id="control-instance",
...         version_id="control-version",
...         number_of_runs_total=10,
...         distribution_summary_statistics=DistributionSummaryStatistics(
...             min=10.0, max=20.0, count=10, mean=15.0, std=3.0,
...             shifted_geometric_mean=14.5, shift_parameter=1.0
...         ),
...         distribution_percentiles=DistributionPercentiles(
...             p01=10.5, p05=11.0, p10=12.0, p25=13.5, p50=15.0,
...             p75=16.5, p90=18.0, p95=19.0, p99=19.5
...         )
...     ),
...     candidate=ResultStatistics(
...         instance_id="candidate-instance",
...         version_id="candidate-version",
...         number_of_runs_total=10,
...         distribution_summary_statistics=DistributionSummaryStatistics(
...             min=9.0, max=18.0, count=10, mean=13.0, std=2.5,
...             shifted_geometric_mean=12.8, shift_parameter=1.0
...         ),
...         distribution_percentiles=DistributionPercentiles(
...             p01=9.5, p05=10.0, p10=11.0, p25=12.0, p50=13.0,
...             p75=14.0, p90=15.5, p95=16.5, p99=17.5
...         )
...     )
... )
>>> stats.control.mean > stats.candidate.mean
True

candidate instance-attribute

candidate: ResultStatistics

Candidate statistics.

control instance-attribute

Control statistics.

MetricTolerance

Bases: BaseModel

Tolerance used for a metric in an acceptance test.

You can import the MetricTolerance class directly from cloud:

from nextmv.cloud import MetricTolerance

This class defines the tolerance to be applied when comparing metric values, which can be either absolute or relative.

ATTRIBUTE DESCRIPTION
type

Type of tolerance (absolute or relative).

TYPE: ToleranceType

value

Value of the tolerance.

TYPE: float

Examples:

>>> from nextmv.cloud import MetricTolerance, ToleranceType
>>> tolerance = MetricTolerance(type=ToleranceType.absolute, value=0.1)
>>> tolerance.type
<ToleranceType.absolute: 'absolute'>
>>> tolerance.value
0.1

type instance-attribute

Type of tolerance.

value instance-attribute

value: float

Value of the tolerance.

MetricType

Bases: str, Enum

Type of metric when doing a comparison.

You can import the MetricType class directly from cloud:

from nextmv.cloud import MetricType

This enumeration defines the different types of metrics that can be used when comparing two runs in an acceptance test.

ATTRIBUTE DESCRIPTION
direct_comparison

Direct comparison between metric values.

TYPE: str

Examples:

>>> from nextmv.cloud import MetricType
>>> metric_type = MetricType.direct_comparison
>>> metric_type
<MetricType.direct_comparison: 'direct-comparison'>

direct_comparison class-attribute instance-attribute

direct_comparison = 'direct-comparison'

Direct comparison metric type.

ResultStatistics

Bases: BaseModel

Statistics of a single instance's metric results.

You can import the ResultStatistics class directly from cloud:

from nextmv.cloud import ResultStatistics

This class aggregates the statistical information about the metric results for a specific instance in a comparison.

ATTRIBUTE DESCRIPTION
instance_id

ID of the instance.

TYPE: str

version_id

ID of the version.

TYPE: str

number_of_runs_total

Total number of runs included in the statistics.

TYPE: int

distribution_summary_statistics

Summary statistics of the metric value distribution.

TYPE: DistributionSummaryStatistics

distribution_percentiles

Percentiles of the metric value distribution.

TYPE: DistributionPercentiles

Examples:

>>> from nextmv.cloud import (
...     ResultStatistics, DistributionSummaryStatistics, DistributionPercentiles
... )
>>> result_stats = ResultStatistics(
...     instance_id="instance-123",
...     version_id="version-456",
...     number_of_runs_total=10,
...     distribution_summary_statistics=DistributionSummaryStatistics(
...         min=10.0,
...         max=20.0,
...         count=10,
...         mean=15.0,
...         std=3.0,
...         shifted_geometric_mean=14.5,
...         shift_parameter=1.0
...     ),
...     distribution_percentiles=DistributionPercentiles(
...         p01=10.5,
...         p05=11.0,
...         p10=12.0,
...         p25=13.5,
...         p50=15.0,
...         p75=16.5,
...         p90=18.0,
...         p95=19.0,
...         p99=19.5
...     )
... )
>>> result_stats.number_of_runs_total
10

distribution_percentiles instance-attribute

distribution_percentiles: DistributionPercentiles

Distribution percentiles.

distribution_summary_statistics instance-attribute

distribution_summary_statistics: (
    DistributionSummaryStatistics
)

Distribution summary statistics.

instance_id instance-attribute

instance_id: str

ID of the instance.

number_of_runs_total instance-attribute

number_of_runs_total: int

Number of runs.

version_id instance-attribute

version_id: str

ID of the version.

StatisticType

Bases: str, Enum

Type of statistical process for collapsing multiple values of a metric.

You can import the StatisticType class directly from cloud:

from nextmv.cloud import StatisticType

This enumeration defines the different statistical methods that can be used to summarize multiple values of a metric from multiple runs into a single value.

ATTRIBUTE DESCRIPTION
min

Minimum value.

TYPE: str

max

Maximum value.

TYPE: str

mean

Mean value.

TYPE: str

std

Standard deviation.

TYPE: str

shifted_geometric_mean

Shifted geometric mean.

TYPE: str

p01

1st percentile.

TYPE: str

p05

5th percentile.

TYPE: str

p10

10th percentile.

TYPE: str

p25

25th percentile.

TYPE: str

p50

50th percentile (median).

TYPE: str

p75

75th percentile.

TYPE: str

p90

90th percentile.

TYPE: str

p95

95th percentile.

TYPE: str

p99

99th percentile.

TYPE: str

Examples:

>>> from nextmv.cloud import StatisticType
>>> stat_type = StatisticType.mean
>>> stat_type
<StatisticType.mean: 'mean'>

max class-attribute instance-attribute

max = 'max'

Maximum value.

mean class-attribute instance-attribute

mean = 'mean'

Mean value.

min class-attribute instance-attribute

min = 'min'

Minimum value.

p01 class-attribute instance-attribute

p01 = 'p01'

1st percentile.

p05 class-attribute instance-attribute

p05 = 'p05'

5th percentile.

p10 class-attribute instance-attribute

p10 = 'p10'

10th percentile.

p25 class-attribute instance-attribute

p25 = 'p25'

25th percentile.

p50 class-attribute instance-attribute

p50 = 'p50'

50th percentile.

p75 class-attribute instance-attribute

p75 = 'p75'

75th percentile.

p90 class-attribute instance-attribute

p90 = 'p90'

90th percentile.

p95 class-attribute instance-attribute

p95 = 'p95'

95th percentile.

p99 class-attribute instance-attribute

p99 = 'p99'

99th percentile.

shifted_geometric_mean class-attribute instance-attribute

shifted_geometric_mean = 'shifted_geometric_mean'

Shifted geometric mean.

std class-attribute instance-attribute

std = 'std'

Standard deviation.

ToleranceType

Bases: str, Enum

Type of tolerance used for a metric.

You can import the ToleranceType class directly from cloud:

from nextmv.cloud import ToleranceType

This enumeration defines the different types of tolerances that can be used when comparing metrics in acceptance tests.

ATTRIBUTE DESCRIPTION
undefined

Undefined tolerance type (empty string).

TYPE: str

absolute

Absolute tolerance type, using a fixed value.

TYPE: str

relative

Relative tolerance type, using a percentage.

TYPE: str

Examples:

>>> from nextmv.cloud import ToleranceType
>>> tol_type = ToleranceType.absolute
>>> tol_type
<ToleranceType.absolute: 'absolute'>

absolute class-attribute instance-attribute

absolute = 'absolute'

Absolute tolerance type.

relative class-attribute instance-attribute

relative = 'relative'

Relative tolerance type.

undefined class-attribute instance-attribute

undefined = ''

Undefined tolerance type.