-
Notifications
You must be signed in to change notification settings - Fork 1
/
Testing.html
220 lines (188 loc) · 8.73 KB
/
Testing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="en">
<head>
<base href=".">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Testing</title>
<link rel="stylesheet" href="assets/css/dark-frontend.css" type="text/css" title="dark">
<link rel="alternate stylesheet" href="assets/css/light-frontend.css" type="text/css" title="light">
<link rel="stylesheet" href="assets/css/bootstrap-toc.min.css" type="text/css">
<link rel="stylesheet" href="assets/css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="assets/js/search/enable_search.css" type="text/css">
<link rel="stylesheet" href="assets/css/prism-tomorrow.css" type="text/css" title="dark">
<link rel="alternate stylesheet" href="assets/css/prism.css" type="text/css" title="light">
<script src="assets/js/mustache.min.js"></script>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/scrollspy.js"></script>
<script src="assets/js/typeahead.jquery.min.js"></script>
<script src="assets/js/search.js"></script>
<script src="assets/js/compare-versions.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="assets/js/bootstrap-toc.min.js"></script>
<script src="assets/js/jquery.touchSwipe.min.js"></script>
<script src="assets/js/anchor.min.js"></script>
<script src="assets/js/tag_filtering.js"></script>
<script src="assets/js/language_switching.js"></script>
<script src="assets/js/styleswitcher.js"></script>
<script src="assets/js/lines_around_headings.js"></script>
<script src="assets/js/prism-core.js"></script>
<script src="assets/js/prism-autoloader.js"></script>
<script src="assets/js/prism_autoloader_path_override.js"></script>
<script src="assets/js/trie.js"></script>
<link rel="shortcut icon" href="assets/images/favicon.png">
</head>
<body class="no-script
">
<script>
$('body').removeClass('no-script');
</script>
<nav class="navbar navbar-fixed-top navbar-default" id="topnav">
<div class="container-fluid">
<div class="navbar-right">
<a id="toc-toggle">
<span class="glyphicon glyphicon-menu-right"></span>
<span class="glyphicon glyphicon-menu-left"></span>
</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-wrapper" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span title="light mode switch" class="glyphicon glyphicon-sunglasses pull-right" id="lightmode-icon"></span>
<form class="navbar-form pull-right" id="navbar-search-form">
<div class="form-group has-feedback">
<input type="text" class="form-control input-sm" name="search" id="sidenav-lookup-field" placeholder="search" disabled>
<span class="glyphicon glyphicon-search form-control-feedback" id="search-mgn-glass"></span>
</div>
</form>
</div>
<div class="navbar-header">
<a id="sidenav-toggle">
<span class="glyphicon glyphicon-menu-right"></span>
<span class="glyphicon glyphicon-menu-left"></span>
</a>
<a id="home-link" href="index.html" class="hotdoc-navbar-brand">
<img src="assets/images/pitivi.svg" alt="Home">
</a>
</div>
<div class="navbar-collapse collapse" id="navbar-wrapper">
<ul class="nav navbar-nav" id="menu">
</ul>
<div class="hidden-xs hidden-sm navbar-text navbar-center">
<p><b>The Pitivi Developer Documentation</b></p>
</div>
</div>
</div>
</nav>
<main>
<div data-extension="core" data-hotdoc-in-toplevel="True" data-hotdoc-project="Pitivi" data-hotdoc-ref="Testing.html" class="page_container" id="page-wrapper">
<script src="assets/js/utils.js"></script>
<div class="panel panel-collapse oc-collapsed" id="sidenav" data-hotdoc-role="navigation">
<script src="assets/js/full-width.js"></script>
<div id="sitenav-wrapper">
<iframe src="hotdoc-sitemap.html" id="sitenav-frame"></iframe>
</div>
</div>
<div id="body">
<div id="main">
<div id="page-description" data-hotdoc-role="main">
<h1 id="testing">Testing</h1>
<p>We have three sets of tests:</p>
<ul>
<li>the normal unit tests</li>
<li>integration tests</li>
<li><a href="QA_Scenarios.html">manual tests</a></li>
</ul>
<p>Since version <a href="releases/0-91.html">0.91</a> the test suite is set up similarly to
the GStreamer tests, using GstValidate. The GES backend also has its own test
suite, preventing things falling apart.</p>
<h2 id="unit-tests">Unit tests</h2>
<p>Run the entire unit tests suite:</p>
<pre><code>$ ptvtests
</code></pre>
<p>Run only a set of tests by specifying <code>-t</code>. For example:</p>
<pre><code>$ ptvtests -t test_project
$ ptvtests -t test_project.TestProjectManager
$ ptvtests -t test_project.TestProjectManager.test_loading_missing_project_file
$ ptvtests -t TestProjectManager
$ ptvtests -t test_loading_missing_project_file
$ ptvtests -t Only_the_tests_affecting_the_clips_widgets_please
</code></pre>
<p>To list the available tests, run:</p>
<pre><code>$ ptvtests -L
</code></pre>
<p>NOTE: <code>ptvtests</code> is an alias created when you enter the <a href="HACKING.html">development
environment</a>. If you are on <a href="crossplatform.html">macOS or Windows</a>,
replace <code>ptvtests</code> with <code>gst-validate-launcher tests/ptv_testsuite.py</code>.</p>
<pre><code>$ alias ptvtests
ptvtests='ptvenv gst-validate-launcher /.../pitivi-dev/pitivi/tests/ptv_testsuite.py --dump-on-failure'
</code></pre>
<h3 id="writing-unit-tests">Writing unit tests</h3>
<p>Start by reading the utility methods in <code>tests/common.py</code>.</p>
<p>The tests for the logic in a specific file have a corresponding tests file. For
example the tests for <code>pitivi/clip_properties/color.py</code> can be found in
<code>tests/test_clipproperties_color.py</code>. Note the undo/redo tests in
<code>tests/test_undo_*</code> cover the same area as others such as the timeline.</p>
<p>When writing a new test, look for similar ones to copy the initial part doing
the setup. Most probably you find a good example and learn something in the
process. We have a large number of tests covering most of the codebase.</p>
<p>We use the <code>unittest.mock</code> standard <a href="https://docs.python.org/3/library/unittest.mock.html">Python
module</a> extensively in the
unit tests, especially for the UI.</p>
<p>Unit tests can be <a href="Debugging.html#debugging-unit-tests">debugged</a> by setting the
<code>PITIVI_VSCODE_DEBUG</code> environment variable.</p>
<p>If you're curious about our unit tests, the best way to get to know them is to
write a few and have us review them. Check out <a href="HACKING.html">how to set up your dev
env</a> and come in our <a href="https://www.pitivi.org/contact/">chat room</a>!</p>
<h2 id="integration-tests">Integration tests</h2>
<p>The integration tests are run with GstValidate. They are located in the
<a href="https://gitlab.gnome.org/GNOME/pitivi/tree/master/tests/validate-tests">tests/validate-tests</a>
directory. Each <code>.scenario</code> file in the
<a href="https://gitlab.gnome.org/GNOME/pitivi/tree/master/tests/validate-tests/scenarios">scenarios</a>
subdirectory contains a sequence of actions which represent a test.</p>
<p>When a test is run, the actions in the scenario are performed by
handlers in
<a href="https://gitlab.gnome.org/GNOME/pitivi/blob/master/pitivi/utils/validate.py">pitivi/utils/validate.py</a>,
or by handlers in GES. The handlers generally act on the widgets and
check the expected effect has been obtained on the GES objects. Besides
the checks integrated in the handlers, for now it is not possible to
have additional checks.</p>
<p>A scenario file is <a href="http://developer.pitivi.org/Bug_reporting.html#sharing-sample-files-projects-and-scenarios">created
automatically</a>
each time Pitivi is used.</p>
<p>You can run the integration tests with:</p>
<pre><code>$ ptvenv tests/validate-tests/runtests
</code></pre>
</div>
<div id="subpages">
<p><b>Subpages:</b></p>
<div class="thumb-subpages">
</div>
<p>
<a href="QA_Scenarios.html">Standard QA Scenarios</a>
</p>
</div>
</div>
<div id="search_results">
<p>The results of the search are</p>
</div>
<div id="footer">
</div>
</div>
<div id="toc-column">
<div class="edit-button">
<a href="https://gitlab.gnome.org/GNOME/pitivi/edit/master/docs/Testing.md" data-hotdoc-role="edit-button">Edit on GitLab</a>
</div>
<div id="toc-wrapper">
<nav id="toc"></nav>
</div>
</div>
</div>
</main>
<script src="assets/js/navbar_offset_scroller.js"></script>
</body>
</html>