Chromium Code Reviews| Index: tools/telemetry/telemetry/user_story/shared_user_story_state.py |
| diff --git a/tools/telemetry/telemetry/user_story/shared_user_story_state.py b/tools/telemetry/telemetry/user_story/shared_user_story_state.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4cc2e494fe43fc52349a14b8ac55bb2f54233840 |
| --- /dev/null |
| +++ b/tools/telemetry/telemetry/user_story/shared_user_story_state.py |
| @@ -0,0 +1,57 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| + |
| +class SharedUserStoryState(object): |
| + """A class styled on unittest.TestCase for handling test setup & teardown. |
|
chrishenry
2014/11/20 19:01:24
The fact that the class (or methods below) are sty
nednguyen
2014/11/20 21:08:27
Done.
|
| + |
| + Args: |
| + platform: an instance of telemetry.platform.Platform. |
| + options: |
|
chrishenry
2014/11/20 19:01:24
Missing doc?
Shouldn't this be under __init__ pyd
nednguyen
2014/11/20 21:08:27
Done.
|
| + """ |
| + |
| + def __init__(self, test, options, user_story_set): |
| + """ This method is styled on unittest.TestCase.setUpClass. |
| + Override to do any action before running user stories that |
| + share this same state. |
| + """ |
| + pass |
| + |
| + @property |
| + def platform(self): |
| + """ Override to return the platform which user stories that share this same |
| + state will be run on. |
| + """ |
| + raise NotImplementedError() |
| + |
| + def WillRunUserStory(self, user_story): |
|
chrishenry
2014/11/20 19:01:24
nit: Let's have WillRun/Run/DidRun next to each ot
nednguyen
2014/11/20 21:08:27
Done.
|
| + """ This method is styled on unittest.TestCase.setUp. |
| + Override to do any action before running each one of all user stories that |
| + share this same state. """ |
| + raise NotImplementedError() |
| + |
| + def GetTestExpectationAndSkipValue(self, expectations): |
| + """ Return test expectation and skip value instance in case expectation |
| + is 'skip'. This is run after WillRunUserStory and before RunUserStory. |
| + """ |
| + raise NotImplementedError() |
| + |
| + def RunUserStory(self, results): |
| + """ This method is styled on unittest.TestCase.run. |
| + Override to do any action before running each one of all user stories that |
| + share this same state. """ |
| + raise NotImplementedError() |
| + |
| + def DidRunUserStory(self, results): |
| + """ This method is styled on unittest.TestCase.tearDown. |
| + Override to do any action after running each of all user stories that |
| + share this same state. |
| + """ |
| + raise NotImplementedError() |
| + |
| + def TearDown(self, results): |
| + """ This method is styled on unittest.TestCase.tearDownClass. |
|
chrishenry
2014/11/20 19:01:24
The naming of TearDown for something that means Te
nednguyen
2014/11/20 21:08:27
Done.
|
| + Override to do any action after running multiple user stories that |
| + share this same state. """ |
| + raise NotImplementedError() |