Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Easy unit testing with mockk, spek and Kluent

110

Easy unit testing with mockk, spek and Kluent

Las pruebas unitarias son una forma de asegurar que tu código hace lo que esperas que haga. Es algo que todos hablan pero al principio puede que no veas el gran valor, sin embargo luego que las implementas te das cuenta que te librarán de muchos problemas. Pero cómo implementarlas de una forma legible y mantenible??? Mockk y Spek te facilitaran mucho en la construcción y además están escritas en Kotlin con DSL y soporte a multiplataforma preciso para Kotlin Lovers.

2a31aa30e3f9eeb22493a01a52833883?s=128

Juan Guillermo Gómez Torres

September 01, 2020
Tweet

Transcript

  1. Juan Guillermo Gómez GDE Firebase & GCP @jggomezt Easy unit

    testing with mockk and spek
  2. Juan Guillermo Gómez ➢ Co-Leader y Co-Founder of GDG Cali.

    ➢ Tech Lead WordBox & Founder DevHack ➢ Consultant and advisor on software architecture, cloud computing and software development. ➢ Experience in several languages and platforms. (C, C#, Java, NodeJS, android, GCP, Firebase). ➢ Google Developer Expert (GDE) in Firebase & GCP ➢ BS in System Engineering and a MS in Software Engineering. ➢ @jggomezt ➢ youtube.com/devhack
  3. Software Quality ❖ Software engineering process and methods used in

    a project to ensure proper quality. ❖ Verify that quality attributes are achieved ❖ Verify that user requirements are met.
  4. Unit Testing Unit testing is a software testing method by

    which individual units of source code - sets of one or more computer program modules. Wikipedia
  5. Frameworks - Libraries - Kotlin ➢ JUnit ➢ Mockito ➢

    Spek ➢ Mockk ➢ Kotest ➢ Kluent ➢ Jacoco
  6. Spek Framework ➢ Spek 2.x is a complete rewrite of

    Spek with KMM in mind. ➢ The DSL is also reworked in two distinct styles: ◦ Specification ◦ Gherking https://knapsackpro.com/testing_frameworks/difference_between/junit/vs/spekframework
  7. Spek Framework - Running https://www.spekframework.org/core-concepts/

  8. Spek Framework - Core Concepts https://www.spekframework.org/core-concepts/

  9. Spek Framework - Core Concepts https://www.spekframework.org/core-concepts/

  10. Spek Framework - Specification https://www.spekframework.org/core-concepts/

  11. Spek Framework - Gherkin https://www.spekframework.org/gherkin//

  12. Mock and Stub https://blog.kotlin-academy.com/mocking-is-not-rocket-science-basics-ae55d0aadf2b

  13. Mockk https://mockk.io/

  14. Kluent - Fluent Assertions https://markusamshove.github.io/Kluent/

  15. Mockk - Speck - Kluent https://mockk.io/

  16. https://github.com/jggomez/app-testing_demo DEMO

  17. Thank You! Gracias ! Juan Guillermo Gómez GDE Firebase &

    GCP @jggomezt