testutil

package
v0.0.0-...-9474aff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package testutil provides utility functions for writing game performance tests.

Package testutil provides utility functions for writing game performance tests. TODO(b/224364446): Move shared logic into common folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Click

func Click(obj *ui.Object) action.Action

Click returns an action function which clicks the UI object if it exists.

func CommitDeviationPerfMetric

func CommitDeviationPerfMetric() perf.Metric

CommitDeviationPerfMetric returns a standard metric that commit deviation can be saved in.

func FpsPerfMetric

func FpsPerfMetric() perf.Metric

FpsPerfMetric returns a standard metric that measured FPS can be saved in.

func GetCoords

func GetCoords(ctx context.Context, tconn *chrome.TestConn, activityBounds coords.Rect, widthHeuristic, heightHeuristic float64) (coords.Point, error)

GetCoords returns an approximate pixel location for the current display and given heuristics.

func LaunchTimePerfMetric

func LaunchTimePerfMetric() perf.Metric

LaunchTimePerfMetric returns a standard metric that launch time can be saved in.

func LoginTimePerfMetric

func LoginTimePerfMetric() perf.Metric

LoginTimePerfMetric returns a standard metric that login time can be saved in.

func ModelsToTest

func ModelsToTest() []string

ModelsToTest stores the models that are initially relevant for game performance tests. TODO(b/206442649): Remove after initial testing is complete.

func PerformTest

func PerformTest(ctx context.Context, s *testing.State, appPkgName, appActivity string, testFunc PerformTestFunc)

PerformTest installs a game from the play store, starts the activity, and defers to the caller to perform a test.

func RenderQualityPerfMetric

func RenderQualityPerfMetric() perf.Metric

RenderQualityPerfMetric returns a standard metric that render quality can be saved in.

func StartBenchmarking

func StartBenchmarking(ctx context.Context, params TestParams) error

StartBenchmarking begins the benchmarking process.

func TestTimePerfMetric

func TestTimePerfMetric() perf.Metric

TestTimePerfMetric returns a standard metric that test time can be saved in.

func WaitForExists

func WaitForExists(obj *ui.Object, timeout time.Duration) action.Action

WaitForExists returns an action function which waits for Android ui object.

Types

type BenchmarkResults

type BenchmarkResults struct {
	// FPS is a metric that shows average FPS during the sampled period.
	FPS float64 `json:"fps"`
	// CommitDeviation is a metric that shows deviation from the ideal time of committing frames
	// during the sampled period.
	CommitDeviation float64 `json:"commitDeviation"`
	// RenderQuality is a metric in range 0%..100% that shows quality of the render during the
	// sampled period. 100% is ideal quality when frames are produced on time according to FPS.
	RenderQuality float64 `json:"renderQuality"`
}

BenchmarkResults stores results for the calls to benchmarking.

func StopBenchmarking

func StopBenchmarking(ctx context.Context, params TestParams) (results BenchmarkResults, err error)

StopBenchmarking stops the benchmarking process and returns the parsed results.

type PerformTestFunc

type PerformTestFunc func(params TestParams) (err error)

PerformTestFunc allows callers to run their desired test after a provided activity has been launched.

type TestParams

type TestParams struct {
	TestConn          *chrome.TestConn
	Arc               *arc.ARC
	Device            *ui.Device
	AppPkgName        string
	AppActivityName   string
	Activity          *arc.Activity
	ActivityStartTime time.Time
}

TestParams stores data common to the tests run in this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL