Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: tools/telemetry/telemetry/test.py

Issue 17438002: [telemetry] test_runner and run_benchmarks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update docs? Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from telemetry.page import page_runner
5 from telemetry.page import page_set
6 from telemetry.page import page_test
7
8
9 class Test(object):
10 """Base class for a Telemetry test or benchmark.
11
12 A test packages a PageTest/PageMeasurement and a PageSet together.
13 """
14 options = {}
15 enabled = True
16
17 def Run(self, options):
18 """Run this test with the given options."""
19 assert hasattr(self, 'test'), 'This test has no "test" attribute.'
20 assert issubclass(self.test, page_test.PageTest), (
21 '"%s" is not a PageTest.' % self.test.__name__)
22
23 for key, value in self.options.iteritems():
24 setattr(options, key, value)
25
26 test = self.test()
27 ps = self.CreatePageSet(options)
28 results = page_runner.Run(test, ps, options)
29 results.PrintSummary()
30 return len(results.failures) + len(results.errors)
31
32 def CreatePageSet(self, options): # pylint: disable=W0613
33 """Get the page set this test will run on.
34
35 By default, it will create a page set from the file at this test's
36 page_set attribute. Override to generate a custom page set.
37 """
38 assert hasattr(self, 'page_set'), 'This test has no "page_set" attribute.'
39 return page_set.PageSet.FromFile(self.page_set)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/page_test_runner.py ('k') | tools/telemetry/telemetry/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698