1 / 26

Contenido

Pruebas con Junit , pruebas asincronas , JSNI GWT Google Web Toolkit Prof. Ing. Esteban Ramírez. Contenido. JUnit - testing framework. JavaScript Native Interface (JSNI). Prácticas. Software Testing.

joanne
Download Presentation

Contenido

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pruebas con Junit, pruebas asincronas, JSNI GWTGoogle Web ToolkitProf. Ing. Esteban Ramírez

  2. Contenido JUnit - testingframework JavaScript Native Interface (JSNI) Prácticas

  3. Software Testing Las pruebas de software, en inglés testing son los procesos que permiten verificar y revelar la calidad de un producto software. Son utilizadas para identificar posibles fallos de implementación, calidad, o usabilidad de un programa de ordenador. Básicamente es una fase en el desarrollo de software consistente en probar las aplicaciones construidas.

  4. JUnit - testingframework JUnites un conjunto de clases (framework) que permite realizar la ejecución de clases Java de manera controlada, para poder evaluar si el funcionamiento de cada uno de los métodos de la clase se comporta como se espera. JUnit es también un medio de controlar las pruebas de regresión, necesarias cuando una parte del código ha sido modificado y se desea ver que el nuevo código cumple con los requerimientos anteriores y que no se ha alterado su funcionalidad después de la nueva modificación. Open Source, disponible en http://www.junit.org

  5. GWT JUnittestingframework GWT permite utilizar JUnit test cases incluso en developmentmode o productionmode

  6. GWT JUnittestingframework • Pasos para crear un caso de prueba en GWT • Crear una clase que extienda de GWTTestCase . • Implementar el metodo: • publicStringgetModuleName() • Implementar los casos de pruebas: • Configurar en el .xml del modulo la siguientelinea:

  7. GWT JUnittestingframework

  8. GWT JUnittestingframework New GWT Java Project: SumaDosNumeros New GWT Module: Suma Package Name: com.cursojava.suma

  9. GWT JUnittestingframework New GWT Java Project: SumaDosNumeros New GWT Module: Suma Package Name: com.cursojava.suma

  10. GWT JUnittestingframework New GWT Java Project: SumaDosNumeros New GWT Module: Suma Package Name: com.cursojava.suma

  11. GWT JUnittestingframework New GWT Java Project: SumaDosNumeros New GWT Module: Suma Package Name: com.cursojava.suma

  12. GWT JUnittestingframework

  13. GWT JUnittestingframework

  14. GWT JUnit Test Suite

  15. JavaScript Native Interface (JSNI) • A pesar de que se programe en Java en vez de JavaScript, en ocasiones se necesitará programar directamente en JavaScript, por ejemplo, para hacer referencia a partes del API del navegador que no esté soportado por GWT o para utilizar alguna librería JavaScript no muy común. • JSNI permite ejecutar JavaScript desde Java, como también Java desde JavaScript. Esto hace posible al compilador GWT que pueda mezclar código JavaScript nativo con el código que genera.

  16. JavaScript Native Interface (JSNI) • Código Javascript en comentarios java • Permite utilizar Js dentro de GWT y al revés. • Usa la declaración 'native' que indica a java que ese método se resolverá en tiempo de 'runtime' • Los métodos nativos se puede utilizar en los IDEs sin que marquen el código con error. • El compilador GWT lo detecta y lo copia en el fichero javascript resultante • Finalmente se comprime y obfuscajunto con el resto de código

  17. JavaScript Native Interface (JSNI)

  18. JavaScript Native Interface (JSNI) A JSNI comment block begins with the exact token  /*-{and ends with the exact token }-*/ JSNI methods are called just like any normal Java method. They can be static or instance methods.

  19. JavaScript Native Interface (JSNI) You will not be able to use Java debugging tools inside your JSNI methods when running in development mode. The Java compiler and GWT compiler do not perform any syntax or semantic checks on JSNI code, so any errors in the JavaScript body of the method will not be seen until run time.

  20. JavaScript Native Interface (JSNI) The JavaScript Window Object is the highest level JavaScript object which corresponds to the web browser window. Ej. window.status = “Message in the status bar." The JavaScript Document object is the container for all HTML HEAD and BODY objects associated within the HTML tags of an HTML document. Ej, document.bgColor = "#FFFFFF" $wnd $doc

  21. JavaScript Native Interface (JSNI)

  22. JavaScript Native Interface (JSNI) Acceso a un atributo JAVA

  23. JavaScript Native Interface (JSNI) Acceso a un método JAVA

  24. JavaScript Native Interface (JSNI) Paramssignature

  25. JavaScript Native Interface (JSNI) Metodinvocation

  26. JavaScript Native Interface (JSNI) • Probar el funcionamiento del proyecto TestJSNI

More Related