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 ¶
- func Click(obj *ui.Object) action.Action
- func CommitDeviationPerfMetric() perf.Metric
- func FpsPerfMetric() perf.Metric
- func GetCoords(ctx context.Context, tconn *chrome.TestConn, activityBounds coords.Rect, ...) (coords.Point, error)
- func LaunchTimePerfMetric() perf.Metric
- func LoginTimePerfMetric() perf.Metric
- func ModelsToTest() []string
- func PerformTest(ctx context.Context, s *testing.State, appPkgName, appActivity string, ...)
- func RenderQualityPerfMetric() perf.Metric
- func StartBenchmarking(ctx context.Context, params TestParams) error
- func TestTimePerfMetric() perf.Metric
- func WaitForExists(obj *ui.Object, timeout time.Duration) action.Action
- type BenchmarkResults
- type PerformTestFunc
- type TestParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitDeviationPerfMetric ¶
CommitDeviationPerfMetric returns a standard metric that commit deviation can be saved in.
func FpsPerfMetric ¶
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 ¶
LaunchTimePerfMetric returns a standard metric that launch time can be saved in.
func LoginTimePerfMetric ¶
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 ¶
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 ¶
TestTimePerfMetric returns a standard metric that test time can be saved in.
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.