Unit Test con Embarcadero
Primeros pasos con el framework DUnit
Juan Vladimir
@juanvladimir13
Agenda
Conocimientos previos
1. Testing
2. Unit Test
Framework
1. DUnit
2. Instalación
Example
1. Estructura de software
2. New project App
3. New project Test
4. Test Suite
Conocimientos Previos
El contenido fue desarrollado anteriormente, para las personas que no lo
pudieron apreciar, les comparto los enlaces.
Youtube :
https://www.youtube.com/watch?v=oWbbTROrmcQ
SlideShare :
https://www.slideshare.net/juanvladimir13/unit-test-75517343
Google Drive :
https://drive.google.com/drive/folders/0BxFy1LPEvFXaTmtvUzMwZWJn
MDQ?usp=sharing
Framework
1. DUnit
2. Instalación
1. DUnit
DUnit is an Xtreme testing framework for Borland Delphi programs. It was
originally inspired on the JUnit framework written in Java by Kent Beck and
Erich Gamma, but has evolved into a tool that uses much more of the potential
of Delphi to be much more useful to Delphi developers
Web oficial
http://dunit.sourceforge.net/
Docs
http://dunit.sourceforge.net/#Documentation
Download
https://sourceforge.net/projects/dunit/
DUnit
2. Instalación
Las nuevas versiones de Embarcadero RAD Studio ya viene
instalado este frameworks de manera que no es necesario
instalarlo.
Example
1. Estructura del proyecto
2. New project App
3. New project Test
4. Create Project Group
5. Create Test Case
6. Run DUnit
7. Test Suite
1. Estructura del proyecto
PROYECTO
UNIT TEST
PROJECT GROUP
2. New Project App
Crear un nuevo proyecto llamado PExample
File -> New -> VLC Forms Application - Delphi
Guardar el proyecto PExample
File -> Save All
Location
Folder : example/src/main
Delphi Unit
File name : UFPrincipal.pas
Delphi Projects
File name : PExample.dproj
3. New Protect Test
File -> New -> Other.. -> Unit Test -> Test Project
Project Name:
PExampleTest
Location:
examples/src/test
DUnit
4. Create Project Group
File -> New -> Other..-> Other files -> Project Group
View -> Project Manager
Add Project PExample and PExampleTest
Project -> Add Existing (PExample.dproj)
Project -> Add Existing (PExampleTest.dproj)
File -> Save All
Location : example
File name : PGExample.groupproj
5. Create Test Case
Select PExampleTest in Project Manager
File -> New -> Other -> Unit Test -> Test Case
Select to methods to test
➔ Source file
◆ Unit to project
➔ Available classes and methods:
◆ Seleccionar métodos para generarlos
➔ Finish
➔ File -> Save
◆ Folder : example/src/test/package/models
6. Run DUnit
Select PExampleTest in
Project Manager
Run -> Run
Ya eres todo un experto !!!
Test Suite
1. Create Unit TestSuite
2. Add function to Test Suite
3. Add Test Case to Test Suite
4. Assert in Test Case
DUnit
1. Create Unit Test Suite
Select PExampleTest in
Project Manager
File -> New -> Unit
File -> Save
File name :
UTestSuite.pas
Folder :
example/src/test
2. Add function to Test Suite
uses TestFramework;
implementation
function TestSuiteFunction:ITestSuite;
var ATestSuite: TTestSuite;
begin
ATestSuite := TTestSuite.create('Name to Test Suite');
// Add to Test Case
Result := ATestSuite;
end;
initialization
RegisterTest('Simple Test', TestSuiteFunction);
3. Add Test Case to Test Suite
Editamos los TestCase que hemos creado y eliminamos las siguientes líneas
initialization
// Register any test cases with the test runner
RegisterTest(ClassName.Suite);
Add Test Case to Test Suite
uses TestFramework, UnitNameTestCase;
Add to function TestSuite lines
// ATestSuite es una instancia TTestSuite en la function TestSuite
ATestSuite.AddTest(ClasName.Suite);
Add TestSuite to Project Test
initialization
RegisterTest('Simple Test', TestSuite);
Vamos a pensar un poco que nos hace bien
4. Assert in Test Case
CheckTrue(condition);
CheckFalse(condition);
CheckNonNull(condition);
CheckEquals(expected , actual);
CheckNull(objeto)
Contactos y sugerencias
https://www.facebook.com/juanvladimir13
https://twitter.com/juanvladimir13
https://www.linkedin.com/in/juanvladimir13
https://www.instagram.com/juanvladimir13
@juanvladimir13
https://www.youtube.com/channel/UCk9R_
mLgbcENR_BPF9M9asQ
juanvladimir13@gmail.com
@juanvladimir13
http://juanvladimir13.wordpress.com
http://juanvladimir13.blogspot.com/
https://github.com/juanvladimir13/
https://bitbucket.org/juanvladimir13
URL’s
https://www.youtube.com/watch?v=9Wl7aQUsvN0
https://www.slideshare.net/juanvladimir13/unit-test-con-embarc
adero-rad-studio
https://drive.google.com/drive/folders/0BxFy1LPEvFXaTmtvUz
MwZWJnMDQ?usp=sharing
GRACIAS
Espero que hubieras aprendido un poco…
Apoya con un like y comparte para que tenga más
seguidores y pueda seguir realizando vídeos.

More Related Content

PDF
You can now use PVS-Studio with Visual Studio absent; just give it the prepro...
PDF
Installing java, eclipse and maven
PDF
Labri 2021-invited-talk
PDF
Developing Selenium tests with JUnit 5
PPTX
PPTX
Containerize your Blackbox tests
PPTX
PDF
You can now use PVS-Studio with Visual Studio absent; just give it the prepro...
Installing java, eclipse and maven
Labri 2021-invited-talk
Developing Selenium tests with JUnit 5
Containerize your Blackbox tests

What's hot (7)

PDF
Ant, Maven and Jenkins
PDF
Build server
DOC
Exploit Frameworks
PDF
Devenv command line
PDF
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
PDF
Alex Honor - Devops Toolchain
PDF
淺談 Groovy 與 AWS 雲端應用開發整合
Ant, Maven and Jenkins
Build server
Exploit Frameworks
Devenv command line
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Alex Honor - Devops Toolchain
淺談 Groovy 與 AWS 雲端應用開發整合
Ad

Similar to Unit Test con Embarcadero RAD Studio (20)

PPT
Test-Driven Development
PPT
Test-Driven Development
PPT
Test Driven Development
PPT
N Unit Presentation
PPTX
Unit Testing in Java
PPT
Unit testing php-unit - phing - selenium_v2
PPTX
Unit testing by Svetlin Nakov
PPTX
Unit Testing - Nakov's Talk @ VarnaConf 2013
PDF
junit-160729073220 eclipse software testing.pdf
PPSX
PDF
L08 Unit Testing
PPTX
The Test way
PDF
Unit testing with Junit
PPTX
L2624 labriola
ODP
Presentation Unit Testing process
PPTX
8-testing.pptx
PPT
Test Driven Development using QUnit
PPTX
Unit Testing talk
PPTX
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
Test-Driven Development
Test-Driven Development
Test Driven Development
N Unit Presentation
Unit Testing in Java
Unit testing php-unit - phing - selenium_v2
Unit testing by Svetlin Nakov
Unit Testing - Nakov's Talk @ VarnaConf 2013
junit-160729073220 eclipse software testing.pdf
L08 Unit Testing
The Test way
Unit testing with Junit
L2624 labriola
Presentation Unit Testing process
8-testing.pptx
Test Driven Development using QUnit
Unit Testing talk
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Test Driven Development (TDD) Preso 360|Flex 2010
Ad

More from Juan Vladimir (16)

PDF
Software Libre en la Carrera de Ciencias de la Computacion
PDF
Install apps in ubuntu
PDF
Proyectos java-con-maven
PDF
Proyectos JAVA con maven
PDF
Virus informatico
PDF
Sistema operativo GNU/Linux
PDF
Primeros pasos con git
PDF
Install odoo in windows
PDF
Install apps in ubuntu
PDF
Hard Disk particion
PDF
BIOS - UEFI
PDF
Conceptos básicos de Unit Test
PDF
Instalacion y configuracion de Android Studio
PDF
Lenguaje de programación Java
PDF
Lenguaje de programación Pascal
PDF
Creando un repositorio local en Ubuntu
Software Libre en la Carrera de Ciencias de la Computacion
Install apps in ubuntu
Proyectos java-con-maven
Proyectos JAVA con maven
Virus informatico
Sistema operativo GNU/Linux
Primeros pasos con git
Install odoo in windows
Install apps in ubuntu
Hard Disk particion
BIOS - UEFI
Conceptos básicos de Unit Test
Instalacion y configuracion de Android Studio
Lenguaje de programación Java
Lenguaje de programación Pascal
Creando un repositorio local en Ubuntu

Recently uploaded (20)

PDF
Microsoft Office 365 Crack Download Free
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
Introduction to Windows Operating System
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
assetexplorer- product-overview - presentation
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Types of Token_ From Utility to Security.pdf
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
AI Guide for Business Growth - Arna Softech
Microsoft Office 365 Crack Download Free
MCP Security Tutorial - Beginner to Advanced
Introduction to Windows Operating System
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
assetexplorer- product-overview - presentation
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
CNN LeNet5 Architecture: Neural Networks
Visual explanation of Dijkstra's Algorithm using Python
Why Generative AI is the Future of Content, Code & Creativity?
"Secure File Sharing Solutions on AWS".pptx
Weekly report ppt - harsh dattuprasad patel.pptx
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Trending Python Topics for Data Visualization in 2025
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Monitoring Stack: Grafana, Loki & Promtail
Types of Token_ From Utility to Security.pdf
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Advanced SystemCare Ultimate Crack + Portable (2025)
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
AI Guide for Business Growth - Arna Softech

Unit Test con Embarcadero RAD Studio