Unit Testing

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

Favorites, Groups & Events

Unit Testing - Presentation Transcript

  1. pruebas unitarias UNIT TESTING pruebas unitarias Créditos: Félix Rivas Jorge Salas
  2. pruebas unitarias Test = prueba, examen ¿Qué prueban en un software? Un bloque de código fuente Una funcionalidad completa ¿Por qué probamos un software? Encontrar y corregir bugs. ¿Cómo probamos un software? Input / Output
  3. pruebas unitarias Pruebas de Unidad Unit = unidades  POO (Métodos) Test = prueba, examen Si tenemos una función que realiza cierto cálculo: función suma( a, b) .... fin Podemos probar esta función de esta manera: Si (suma(1,1) es igual a 2) // :-D caso contrario // :-(
  4. pruebas unitarias Técnica Verificar igualdad de dos valores. Verificar que una sentencia sea verdadera. Verificar que un objeto exista. Verificar que dos objetos sean del mismo tipo.
  5. pruebas unitarias Ventajas Facilita el cambio. Simplifica la integración. Lleva la programación a otro nivel. Aunque suene difícil de creer, acelera el desarrollo de software. Desventajas Estimación Código extenso
  6. pruebas unitarias Existen Unit Testing Frameworks para la mayoría de lenguajes de programación. Sunit: Smalltalk Java: JUnit Ruby: Test::Unit Python: PyUnit Perl: TAP (Test Anything Protocol) PHP: PHPUnit .NET: NUnit
  7. pruebas unitarias package pruebarapida; import org.junit.*; import static org.junit.Assert.*; import java.util.*; public class TestingJava { @Test public void testEmptyCollection() { Collection collection = new ArrayList(); assertTrue(collection.isEmpty()); } public static void main( String args[]) { org.junit.runner.JUnitCore.main("pruebarapida.TestingJava"); } } Ejemplo: JUnit
  8. pruebas unitarias package pruebarapida; import org.junit.*; import static org.junit.Assert.*; import java.util.*; public class TestingJava { private Collection <Object> collection; @Before public void setUp() { collection = new ArrayList<Object>(); } @Test public void testEmptyCollection() { assertTrue(collection.isEmpty()); } @Test public void testOneItemCollection() { collection.add(&quot;itemA&quot;); assertEquals(1, collection.size()); } } Ejemplo: JUnit
  9. pruebas unitarias require ‘test/unit’ class PruebaSuma < Test::Unit::TestCase def test_suma assert_equal 4, 2+2 assert_equal 4, 3+1 assert_equal 5, 5+0 assert_equal 0, -5+5 end end Ejemplo: Test::Unit
  10. pruebas unitarias
    • Más información:
    • JUnit.org
      • http://www.junit.org
    • Cactus
      • http://jakarta.apache.org/cactus
    • Clover
      • http://www.thecortex.net/clover
    • dbUnit
      • http://www.dbunit.org
    • HttpUnit
      • http://www.httpunit.org
    • Canoo WebTest
      • http://webtest.canoo.com
    • Temas relacionados:
    • http://blog.espol.edu.ec/taws

+ Felix RivasFelix Rivas, 11 months ago

custom

1928 views, 0 favs, 0 embeds more stats

Trata sobre el alcance que tienen las Pruebas Unita more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 1928
    • 1928 on SlideShare
    • 0 from embeds
  • Comments 1
  • Favorites 0
  • Downloads 70
Most viewed embeds

more

All embeds

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories