OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2017 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 | |
5 import unittest | |
6 | |
7 from dashboard.pinpoint.handlers import quest_parser | |
8 from dashboard.pinpoint.models import quest | |
9 | |
10 | |
11 _MIN_RUN_TEST_ARGUMENTS = [ | |
12 'speedometer', '--pageset-repeat', '20', '--browser', 'release', | |
13 '-v', '--upload-results', '--output-format', 'chartjson', | |
14 '--isolated-script-test-output', '${ISOLATED_OUTDIR}/output.json', | |
15 '--isolated-script-test-chartjson-output', | |
16 '${ISOLATED_OUTDIR}/chartjson-output.json', | |
17 ] | |
18 | |
19 | |
20 _ALL_RUN_TEST_ARGUMENTS = [ | |
21 'speedometer', '--story-filter', 'http://www.fifa.com/', | |
22 '--pageset-repeat', '50', '--browser', 'release', | |
23 '-v', '--upload-results', '--output-format', 'chartjson', | |
24 '--isolated-script-test-output', '${ISOLATED_OUTDIR}/output.json', | |
25 '--isolated-script-test-chartjson-output', | |
26 '${ISOLATED_OUTDIR}/chartjson-output.json', | |
27 ] | |
28 | |
29 | |
30 class FindIsolateTest(unittest.TestCase): | |
31 | |
32 def testMissingArguments(self): | |
33 arguments = {'target': 'telemetry_perf_tests'} | |
34 # configuration is missing. | |
35 with self.assertRaises(TypeError): | |
36 quest_parser.ParseQuests(arguments) | |
37 | |
38 arguments = {'configuration': 'chromium-rel-mac11-pro'} | |
39 # target is missing. | |
40 with self.assertRaises(TypeError): | |
41 quest_parser.ParseQuests(arguments) | |
42 | |
43 def testAllArguments(self): | |
44 arguments = { | |
45 'configuration': 'chromium-rel-mac11-pro', | |
46 'target': 'telemetry_perf_tests', | |
47 } | |
48 expected = [ | |
perezju
2017/08/23 08:59:59
nit: expected_quests
dtu
2017/08/24 23:17:52
Done.
| |
49 quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'), | |
50 ] | |
51 self.assertEqual(quest_parser.ParseQuests(arguments), (arguments, expected)) | |
52 | |
53 | |
54 class TelemetryRunTestQuest(unittest.TestCase): | |
55 | |
56 def testMissingArguments(self): | |
57 arguments = { | |
58 'configuration': 'chromium-rel-mac11-pro', | |
59 'target': 'telemetry_perf_tests', | |
60 'dimensions': '{}', | |
61 # benchmark is missing. | |
62 'browser': 'release', | |
63 } | |
64 with self.assertRaises(TypeError): | |
65 quest_parser.ParseQuests(arguments) | |
66 | |
67 arguments = { | |
68 'configuration': 'chromium-rel-mac11-pro', | |
69 'target': 'telemetry_perf_tests', | |
70 'dimensions': '{}', | |
71 'benchmark': 'speedometer', | |
72 # browser is missing. | |
73 } | |
74 with self.assertRaises(TypeError): | |
75 quest_parser.ParseQuests(arguments) | |
76 | |
77 def testMinimumArguments(self): | |
78 arguments = { | |
79 'configuration': 'chromium-rel-mac11-pro', | |
80 'target': 'telemetry_perf_tests', | |
81 'dimensions': '{}', | |
82 'benchmark': 'speedometer', | |
83 'browser': 'release', | |
84 } | |
85 | |
86 expected = [ | |
87 quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'), | |
88 quest.RunTest({}, _MIN_RUN_TEST_ARGUMENTS), | |
89 ] | |
90 self.assertEqual(quest_parser.ParseQuests(arguments), (arguments, expected)) | |
91 | |
92 def testAllArguments(self): | |
93 arguments = { | |
94 'configuration': 'chromium-rel-mac11-pro', | |
95 'target': 'telemetry_perf_tests', | |
96 'dimensions': '{"key": "value"}', | |
97 'benchmark': 'speedometer', | |
98 'browser': 'release', | |
99 'story': 'http://www.fifa.com/', | |
100 'repeat_count': '50', | |
101 } | |
102 | |
103 expected = [ | |
104 quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'), | |
105 quest.RunTest({'key': 'value'}, _ALL_RUN_TEST_ARGUMENTS), | |
106 ] | |
107 self.assertEqual(quest_parser.ParseQuests(arguments), (arguments, expected)) | |
108 | |
109 | |
110 class ReadChartJsonValueQuest(unittest.TestCase): | |
111 | |
112 def testMinimumArguments(self): | |
113 arguments = { | |
114 'configuration': 'chromium-rel-mac11-pro', | |
115 'target': 'telemetry_perf_tests', | |
116 'dimensions': '{}', | |
117 'benchmark': 'speedometer', | |
118 'browser': 'release', | |
119 'metric': 'pcv1-cold@@timeToFirst', | |
120 } | |
121 | |
122 expected = [ | |
123 quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'), | |
124 quest.RunTest({}, _MIN_RUN_TEST_ARGUMENTS), | |
125 quest.ReadChartJsonValue('pcv1-cold@@timeToFirst', None), | |
126 ] | |
127 self.assertEqual(quest_parser.ParseQuests(arguments), (arguments, expected)) | |
128 | |
129 def testAllArguments(self): | |
130 arguments = { | |
131 'configuration': 'chromium-rel-mac11-pro', | |
132 'target': 'telemetry_perf_tests', | |
133 'dimensions': '{"key": "value"}', | |
134 'benchmark': 'speedometer', | |
135 'browser': 'release', | |
136 'story': 'http://www.fifa.com/', | |
137 'repeat_count': '50', | |
138 'metric': 'pcv1-cold@@timeTo', | |
139 } | |
140 | |
141 expected = [ | |
142 quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'), | |
143 quest.RunTest({'key': 'value'}, _ALL_RUN_TEST_ARGUMENTS), | |
144 quest.ReadChartJsonValue('pcv1-cold@@timeTo', 'http://www.fifa.com/'), | |
145 ] | |
146 self.assertEqual(quest_parser.ParseQuests(arguments), (arguments, expected)) | |
perezju
2017/08/23 08:59:59
hmm.. so the arguments we send as input are also n
dtu
2017/08/24 23:17:52
We mostly just want them to display the configurat
| |
OLD | NEW |