2
2
3
3
.. _incomplete-and-skipped-tests :
4
4
5
- ============================
6
- Incomplete and Skipped Tests
7
- ============================
5
+ =============================
6
+ Omisión y Pruebas Incompletas
7
+ =============================
8
8
9
9
.. _incomplete-and-skipped-tests.incomplete-tests :
10
10
11
- Incomplete Tests
12
- ################
11
+ Pruebas Incompletas
12
+ ###################
13
13
14
- When you are working on a new test case class, you might want to begin
15
- by writing empty test methods such as :
14
+ Cuando estamos trabajando con una nueva clase para un caso de prueba, podríamos
15
+ querer comenzar a escribir una método de prueba vacío de la siguiente manera :
16
16
17
17
.. code-block :: php
18
18
19
19
public function testSomething()
20
20
{
21
21
}
22
22
23
- to keep track of the tests that you have to write. The
24
- problem with empty test methods is that they are interpreted as a
25
- success by the PHPUnit framework. This misinterpretation leads to the
26
- test reports being useless -- you cannot see whether a test is actually
27
- successful or just not yet implemented. Calling
28
- ``$this->fail() `` in the unimplemented test method
29
- does not help either, since then the test will be interpreted as a
30
- failure. This would be just as wrong as interpreting an unimplemented
31
- test as a success.
32
-
33
- If we think of a successful test as a green light and a test failure
34
- as a red light, we need an additional yellow light to mark a test
35
- as being incomplete or not yet implemented.
36
- ``PHPUnit_Framework_IncompleteTest `` is a marker
37
- interface for marking an exception that is raised by a test method as
38
- the result of the test being incomplete or currently not implemented.
39
- ``PHPUnit_Framework_IncompleteTestError `` is the
40
- standard implementation of this interface.
41
-
42
- :numref: `incomplete-and-skipped-tests.incomplete-tests.examples.SampleTest.php `
43
- shows a test case class, ``SampleTest ``, that contains one test
44
- method, ``testSomething() ``. By calling the convenience
45
- method ``markTestIncomplete() `` (which automatically
46
- raises an ``PHPUnit_Framework_IncompleteTestError ``
47
- exception) in the test method, we mark the test as being incomplete.
23
+ para mantener el control de las pruebas que hemos escrito. El problema con
24
+ los métodos de prueba vacíos es que son interpretados como exitosos por
25
+ el framework PHPUnit. Este error en la interpretación lleva a que el reporte
26
+ de la prueba sea inútil, porque no podemos ver si la prueba fue realmente
27
+ exitosa o solo no está implementada. Llamar a ``$this->fail() `` en un
28
+ método de prueba no implementado no es de ayuda, pues, la prueba será
29
+ interpretada como una falla. Lo que sería tan incorrecto como interpretar
30
+ una prueba no implementada como exitosa.
31
+
32
+ Si pensamos en una luz verde para una prueba exitosa y una luz roja para una
33
+ prueba fallida, necesitamos una luz adicional de color amarillo para marcar
34
+ una prueba como incompleta o aún no implementada.
35
+ ``PHPUnit\Framework\IncompleteTest `` es una interfaz de marcado para indicar
36
+ un excepción que lanza el método de prueba cuando la prueba está
37
+ incompleta o actualmente no está implementada.
38
+ La clase ``PHPUnit\Framework\IncompleteTestError `` es la implementación estándar
39
+ de esta interfaz.
40
+
41
+ El :numref: `incomplete-and-skipped-tests.incomplete-tests.examples.SampleTest.php `
42
+ muestra una clase para un caso de prueba, ``SampleTest ``, que contiene un
43
+ método de prueba ``testSomething() ``. Mediante el llamado del método
44
+ ``markTestIncomplete() `` (que lanza automáticamente una excepción
45
+ ``PHPUnit\Framework\IncompleteTestError ``) en el método de prueba, conseguimos
46
+ marcar la prueba como incompleta.
48
47
49
48
.. code-block :: php
50
- :caption: Marking a test as incomplete
49
+ :caption: Marcar una prueba como incompleta
51
50
:name: incomplete-and-skipped-tests.incomplete-tests.examples.SampleTest.php
52
51
53
52
<?php
@@ -66,11 +65,10 @@ exception) in the test method, we mark the test as being incomplete.
66
65
);
67
66
}
68
67
}
69
- ?>
70
68
71
- An incomplete test is denoted by an ``I `` in the output
72
- of the PHPUnit command-line test runner, as shown in the following
73
- example :
69
+ Una prueba incompleta se denota con una ``I `` en la salida del ejecutor de
70
+ pruebas en línea de comandos de PHPUnit, como se muestra en el siguiente
71
+ ejemplo :
74
72
75
73
.. code-block :: bash
76
74
@@ -90,40 +88,42 @@ example:
90
88
OK, but incomplete or skipped tests!
91
89
Tests: 1, Assertions: 1, Incomplete: 1.
92
90
93
- :numref: `incomplete-and-skipped-tests.incomplete-tests.tables.api `
94
- shows the API for marking tests as incomplete .
91
+ En la :numref: `incomplete-and-skipped-tests.incomplete-tests.tables.api `
92
+ se muestra la API para marcar las pruebas como incompletas .
95
93
96
94
.. rst-class :: table
97
- .. list-table :: API for Incomplete Tests
95
+ .. list-table :: API para Pruebas Incompletas
98
96
:name: incomplete-and-skipped-tests.incomplete-tests.tables.api
99
97
:header-rows: 1
100
98
101
- * - Method
102
- - Meaning
99
+ * - Método
100
+ - Propósito
103
101
* - ``void markTestIncomplete() ``
104
- - Marks the current test as incomplete .
102
+ - Marca la prueba actual como incompleta .
105
103
* - ``void markTestIncomplete(string $message) ``
106
- - Marks the current test as incomplete using ``$message `` as an explanatory message.
104
+ - Marca la prueba actual como incompleta usando un mensaje, ``$message ``,
105
+ explicativo.
107
106
108
107
.. _incomplete-and-skipped-tests.skipping-tests :
109
108
110
- Skipping Tests
111
- ##############
109
+ Omitir las pruebas
110
+ ##################
112
111
113
- Not all tests can be run in every environment. Consider, for instance,
114
- a database abstraction layer that has several drivers for the different
115
- database systems it supports. The tests for the MySQL driver can of
116
- course only be run if a MySQL server is available.
112
+ No todas la pruebas se pueden ejecutar en cualquier entorno. Consideremos por
113
+ ejemplo, una capa de abstracción de base de datos que tiene varios controladores
114
+ para los diferentes sistemas de base de datos soportados. Las pruebas para
115
+ un controlador MySQL se pueden ejecutar solamente, por supuesto, si un servidor
116
+ MySQL está disponible.
117
117
118
- :numref: `incomplete-and-skipped-tests.skipping-tests.examples.DatabaseTest.php `
119
- shows a test case class , ``DatabaseTest ``, that contains one test
120
- method , ``testConnection() ``. In the test case class'
121
- `` setUp() `` template method we check whether the MySQLi
122
- extension is available and use the ``markTestSkipped() ``
123
- method to skip the test if it is not .
118
+ El :numref: `incomplete-and-skipped-tests.skipping-tests.examples.DatabaseTest.php `
119
+ muestra una clase para un caso de prueba , ``DatabaseTest ``, que contiene un
120
+ método de prueba , ``testConnection() ``. En el método modelo `` setUp() `` de la
121
+ clase de caso de prueba revisamos si la extensión MySQLi está disponible y
122
+ usamos el método ``markTestSkipped() `` para saltar la prueba si no está
123
+ disponible la extensión .
124
124
125
125
.. code-block :: php
126
- :caption: Skipping a test
126
+ :caption: Omitir la prueba
127
127
:name: incomplete-and-skipped-tests.skipping-tests.examples.DatabaseTest.php
128
128
129
129
<?php
@@ -145,11 +145,10 @@ method to skip the test if it is not.
145
145
// ...
146
146
}
147
147
}
148
- ?>
149
148
150
- A test that has been skipped is denoted by an ``S `` in
151
- the output of the PHPUnit command-line test runner, as shown in the
152
- following example :
149
+ Una prueba que se omite se denota con una ``S `` en la salida del ejecutor de
150
+ pruebas en línea de comandos de PHPUnit, como se muestra en el siguiente
151
+ ejemplo :
153
152
154
153
.. code-block :: bash
155
154
@@ -169,65 +168,66 @@ following example:
169
168
OK, but incomplete or skipped tests!
170
169
Tests: 1, Assertions: 0, Skipped: 1.
171
170
172
- :numref: `incomplete-and-skipped-tests.skipped-tests.tables.api `
173
- shows the API for skipping tests .
171
+ En la :numref: `incomplete-and-skipped-tests.skipped-tests.tables.api `
172
+ se muestra la API para omitir pruebas .
174
173
175
174
.. rst-class :: table
176
- .. list-table :: API for Skipping Tests
175
+ .. list-table :: API para omitir pruebas
177
176
:name: incomplete-and-skipped-tests.skipped-tests.tables.api
178
177
:header-rows: 1
179
178
180
- * - Method
181
- - Meaning
179
+ * - Método
180
+ - Propósito
182
181
* - ``void markTestSkipped() ``
183
- - Marks the current test as skipped .
182
+ - Marca la prueba actual como omitida .
184
183
* - ``void markTestSkipped(string $message) ``
185
- - Marks the current test as skipped using ``$message `` as an explanatory message.
184
+ - Marca la prueba actual como omitida usando un mensaje, ``$message ``, de
185
+ explicación.
186
186
187
187
.. _incomplete-and-skipped-tests.skipping-tests-using-requires :
188
188
189
- Skipping Tests using @requires
190
- ##############################
189
+ Omitir pruebas usando @requires
190
+ ###############################
191
191
192
- In addition to the above methods it is also possible to use the
193
- `` @requires `` annotation to express common preconditions for a test case .
192
+ A parte de los métodos de arriba es posible usar la anotación `` @requires ``
193
+ para expresar precondiciones comunes para un caso de prueba .
194
194
195
195
.. rst-class :: table
196
- .. list-table :: Possible @requires usages
196
+ .. list-table :: Posibles usos para @requires
197
197
:name: incomplete-and-skipped-tests.requires.tables.api
198
198
:header-rows: 1
199
199
200
- * - Type
201
- - Possible Values
202
- - Examples
203
- - Another example
200
+ * - Tipo
201
+ - Posibles Valores
202
+ - Ejemplos
203
+ - Otros Ejemplos
204
204
* - ``PHP ``
205
- - Any PHP version identifier
205
+ - Cualquier identificador de versión de PHP
206
206
- @requires PHP 5.3.3
207
207
- @requires PHP 7.1-dev
208
208
* - ``PHPUnit ``
209
- - Any PHPUnit version identifier
209
+ - Cualquier identificador de versión de PHPUnit
210
210
- @requires PHPUnit 3.6.3
211
211
- @requires PHPUnit 4.6
212
212
* - ``OS ``
213
- - A regexp matching `PHP_OS <http://php.net/manual/en /reserved.constants.php#constant.php-os >`_
213
+ - Una expresión regular que coincida con `PHP_OS <http://php.net/manual/es /reserved.constants.php#constant.php-os >`_
214
214
- @requires OS Linux
215
215
- @requires OS WIN32|WINNT
216
216
* - ``OSFAMILY ``
217
- - Any ` OS family <http://php.net/manual/en /reserved.constants.php#constant.php-os-family >`_
217
+ - Cualquier valor de ` Familia de SO <http://php.net/manual/es /reserved.constants.php#constant.php-os-family >`_
218
218
- @requires OSFAMILY Solaris
219
219
- @requires OSFAMILY Windows
220
220
* - ``function ``
221
- - Any valid parameter to `function_exists <http://php.net/function_exists >`_
221
+ - Cualquier parámetro valido para `function_exists <http://php.net/function_exists >`_
222
222
- @requires function imap_open
223
223
- @requires function ReflectionMethod::setAccessible
224
224
* - ``extension ``
225
- - Any extension name along with an optional version identifier
225
+ - Cualquier nombre de extensión junto con un identificador de versión opcional
226
226
- @requires extension mysqli
227
227
- @requires extension redis 2.2.0
228
228
229
229
.. code-block :: php
230
- :caption: Skipping test cases using @requires
230
+ :caption: Omitir casos de pruebas usando @requires
231
231
:name: incomplete-and-skipped-tests.skipping-tests.examples.DatabaseClassSkippingTest.php
232
232
233
233
<?php
@@ -248,9 +248,7 @@ In addition to the above methods it is also possible to use the
248
248
249
249
// ... All other tests require the mysqli extension
250
250
}
251
- ?>
252
-
253
- If you are using syntax that doesn't compile with a certain PHP Version look into the xml
254
- configuration for version dependent includes in :ref: `appendixes.configuration.testsuites `
255
-
256
251
252
+ Si estamos usando una sintaxis que no copila con una determinada versión de PHP
253
+ es conveniente revisar la dependencia de versiones en la configuración xml
254
+ que se incluye en :ref: `appendixes.configuration.testsuites `.
0 commit comments