<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
		<id>https://1984.lsi.us.es/wiki-egc/index.php?action=history&amp;feed=atom&amp;title=Pruebas_unitarias_21-22</id>
		<title>Pruebas unitarias 21-22 - Historial de revisiones</title>
		<link rel="self" type="application/atom+xml" href="https://1984.lsi.us.es/wiki-egc/index.php?action=history&amp;feed=atom&amp;title=Pruebas_unitarias_21-22"/>
		<link rel="alternate" type="text/html" href="https://1984.lsi.us.es/wiki-egc/index.php?title=Pruebas_unitarias_21-22&amp;action=history"/>
		<updated>2026-05-13T07:07:39Z</updated>
		<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
		<generator>MediaWiki 1.29.0</generator>

	<entry>
		<id>https://1984.lsi.us.es/wiki-egc/index.php?title=Pruebas_unitarias_21-22&amp;diff=9091&amp;oldid=prev</id>
		<title>Ajramirez en 16:42 12 oct 2021</title>
		<link rel="alternate" type="text/html" href="https://1984.lsi.us.es/wiki-egc/index.php?title=Pruebas_unitarias_21-22&amp;diff=9091&amp;oldid=prev"/>
				<updated>2021-10-12T16:42:23Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='es'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revisión del 16:42 12 oct 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot; &gt;Línea 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Para lanzar el analisis de cobertura:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Para lanzar el analisis de cobertura:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;coverage run ./manage.py test &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;--source . &lt;/del&gt;-v 2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;coverage run &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;--source . &lt;/ins&gt;./manage.py test -v 2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Añadimos la opción &amp;quot;--source .&amp;quot; para sólo analizar nuestro código de decide pero no las bibliotecas incluidas.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Añadimos la opción &amp;quot;--source .&amp;quot; para sólo analizar nuestro código de decide pero no las bibliotecas incluidas.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ajramirez</name></author>	</entry>

	<entry>
		<id>https://1984.lsi.us.es/wiki-egc/index.php?title=Pruebas_unitarias_21-22&amp;diff=9083&amp;oldid=prev</id>
		<title>Ajramirez: Página creada con « Las pruebas unitarias están destinadas a identificar errores en partes pequeñas de código con la idea de maximizar la cobertura de nuestros tests. Recordar que la funci...»</title>
		<link rel="alternate" type="text/html" href="https://1984.lsi.us.es/wiki-egc/index.php?title=Pruebas_unitarias_21-22&amp;diff=9083&amp;oldid=prev"/>
				<updated>2021-10-08T16:20:44Z</updated>
		
		<summary type="html">&lt;p&gt;Página creada con « Las pruebas unitarias están destinadas a identificar errores en partes pequeñas de código con la idea de maximizar la cobertura de nuestros tests. Recordar que la funci...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
Las pruebas unitarias están destinadas a identificar errores en partes pequeñas de código con la idea de maximizar la cobertura de nuestros tests. Recordar que la función de cobertura de las pruebas es algo que debemos decidir. Los tests de cada módulo se implementan en archivos python que comienzan por test*&lt;br /&gt;
&lt;br /&gt;
'''Ejercicio 1'''&lt;br /&gt;
&lt;br /&gt;
Lo primero que vamos a hacer es crear un nuevo test para el modulo de autenticación de decide donde en vez de probar la aplicación, comprobaremos que la suma de dos enteros es correcta. &lt;br /&gt;
'''Nota''' esta prueba es para familiarizarnos con el framework. Aquí no estamos probando nuestra app Django. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
from django.test import TestCase&lt;br /&gt;
class SimpleTest(TestCase):&lt;br /&gt;
def test_basic_addition(self):&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 Tests that 1 + 1 always equals 2.&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 self.assertEqual(1 + 1, 2)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Para ejecutar los tests deberemos ejecutar ./manage.py test authentication.&lt;br /&gt;
&lt;br /&gt;
'''Ejercicio 2'''&lt;br /&gt;
&lt;br /&gt;
Para probar la cobertura de nuestras pruebas usaremos la aplicación coverage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
$ pip install coverage&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Para lanzar el analisis de cobertura:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
coverage run ./manage.py test --source . -v 2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Añadimos la opción &amp;quot;--source .&amp;quot; para sólo analizar nuestro código de decide pero no las bibliotecas incluidas.&lt;br /&gt;
Añadimos la opción &amp;quot;-v 2&amp;quot; para hacer la salida más verbosa, es decir, ver más información sobre los tests.&lt;br /&gt;
Podemos añadir la opción &amp;quot;--keepdb&amp;quot; para evitar que la base de datos de prueba se borre al finalizar. Entre otras cosas, eso evitará que se tenga que crear la base de datos la próxima vez que vayan a correrse los test.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
coverage html&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Finalmente podemos ver el contenido del html abriendo &amp;quot;decide/htmlcov/index.html&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Ejercicio 3'''&lt;br /&gt;
Pensar los tests que necesitaremos para nuestro proyecto decide.&lt;/div&gt;</summary>
		<author><name>Ajramirez</name></author>	</entry>

	</feed>