SlideShare a Scribd company logo
1 of 23
Pruebas en Conceptos básicos y ejemplos
¿qué son y para qué sirven?
 
Unit testing will make you more attractive to the opposite sex.  Martin Aspeli
pruebas unitarias pruebas de integración pruebas funcionales pruebas de sistema
unittest doctest
pruebas unitarias y de integración
base.py from Testing import ZopeTestCase ZopeTestCase.installProduct('My Product') from Products.PloneTestCase.PloneTestCase import PloneTestCase from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Products.PloneTestCase.PloneTestCase import setupPloneSite setupPloneSite(products=['My Product']) class MyProductTestCase(PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class MyProductFunctionalTestCase(FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """
my_test.py import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from base import MyProductTestCase class TestClass(MyProductTestCase): """Tests for this and that...""" ... def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() ... suite.addTest(makeSuite(TestClass)) ... return suite if __name__ == '__main__': framework()
Instalación de skins y recursos class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.skins  = self.portal.portal_skins self.csstool = self.portal.portal_css self.jstool  = self.portal.portal_javascripts ... def testSkinLayersInstalled(self): """Verifies the skin layer was registered""" self.failUnless('my_product_skin' in self.skins.objectIds()) def testCssInstalled(self): """Verifies the associated CSS file was registered""" stylesheetids = self.csstool.getResourceIds() self.failUnless('my_css_id' in stylesheetids) def testJavascriptsInstalled(self): """Verifies the associated JavaScript file was registered""" javascriptids = self.jstool.getResourceIds() self.failUnless('my_js_id' in javascriptids)
Instalación de tipos de contenido class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.types  = self.portal.portal_types self.factory  = self.portal.portal_factory ... def testTypesInstalled(self): """Verifies the content type was installed""" self.failUnless('My Type' in self.types.objectIds()) def testPortalFactorySetup(self): """Verifies the content type was registered in the portal factory. The portal factory ensures that new objects are created in a well-behaved fashion. """ self.failUnless('My Type' in self.factory.getFactoryTypes())
Instalación de tools y configlets class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.config = self.portal.portal_controlpanel ... def testToolInstalled(self): """Verifies a tool was installed""" self.failUnless(getattr(self.portal, 'my_tool', None) is not None) def testConfigletInstalled(self): """Verifies a configlet was installed""" configlets = list(self.config.listActions()) self.failUnless('my_configlet_id' in configlets)
Verificando recursos de Kupu class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.kupu = self.portal.kupu_library_tool ... def testKupuResourcesSetup(self): """Verifies the content type can be linked inside Kupu""" linkable = self.kupu.getPortalTypesForResourceType('linkable') self.failUnless('My Type' in linkable)
Verificando otras propiedades class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.props = self.portal.portal_properties ... def testDefaultPageTypes(self): """Verifies the content type can be used as the default page in a container object like a folder. """ self.failUnless('My Type' in self.props.site_properties.getProperty('default_page_types'))
Desinstalación del producto class TestUninstall(MyProductTestCase): """Ensure product is properly uninstalled""" def afterSetUp(self): ... self.qitool = self.portal.portal_quickinstaller self.qitool.uninstallProducts(products=['My Product']) ... def testProductUninstalled(self): """Verifies the product was uninstalled""" self.failIf(self.qitool.isProductInstalled('My Product'))
Implementación from Interface.Verify import verifyObject from Products.ATContentTypes.interface import IATContentType from Products.MyProduct.interfaces import IMyProduct class TestContentType(MyProductTestCase): """Ensure content type implementation""" def afterSetUp(self): self.folder.invokeFactory('My Type', 'mytype1') self.mytype1 = getattr(self.folder, 'mytype1') def testImplementsATContentType(self): """Verifies the object implements the base Archetypes interface""" iface = IATContentType self.failUnless(iface.providedBy(self.mytype1)) self.failUnless(verifyObject(iface, self.mytype1)) def testImplementsMyType(self): """Verifies the object implements the content type interface""" iface = IMyType self.failUnless(iface.providedBy(self.mytype1)) self.failUnless(verifyObject(iface, self.mytype1))
Creación y edición de contenido class TestContentCreation(MyProductTestCase): """Ensure content type can be created and edited""" def afterSetUp(self): self.folder.invokeFactory('My Type', 'mytype1') self.mytype1 = getattr(self.folder, 'mytype1') def testCreateMyType(self): """Verifies the object has been created""" self.failUnless('mytype1' in self.folder.objectIds()) def testEditMyType(self): """Verifies the object can be properly edited""" self.mytype1.setTitle('A title') self.mytype1.setDescription('A description') ... self.assertEqual(self.mytype1.Title(), 'A title') self.assertEqual(self.mytype1.Description(), 'A description') ...
 
pruebas funcionales y de sistema
zope.testbrowser zope.testrecorder Es elegante y fácil de usar, pero no soporta JavaScript Permite grabar las pruebas en formato zope.testbrowser o Selenium
Selenium IDE Selenium Remote Control Selenium Grid
Más información ,[object Object],[object Object],[object Object],[object Object],[object Object]
gracias

More Related Content

What's hot

Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript TestingKissy Team
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSJim Lynch
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JSMichael Haberman
 
Testing for Pragmatic People
Testing for Pragmatic PeopleTesting for Pragmatic People
Testing for Pragmatic Peopledavismr
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineAnup Singh
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Samyak Bhalerao
 
Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your DatabaseDavid Wheeler
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasminefoxp2code
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit TestChiew Carol
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with JestMichał Pierzchała
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkArulalan T
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmineTimothy Oxley
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with MockitoRichard Paul
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testingsgleadow
 
Isomorphic React Apps Testing
Isomorphic React Apps TestingIsomorphic React Apps Testing
Isomorphic React Apps TestingMikhail Larchanka
 

What's hot (20)

Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
Unit Testing in iOS
Unit Testing in iOSUnit Testing in iOS
Unit Testing in iOS
 
Qunit Java script Un
Qunit Java script UnQunit Java script Un
Qunit Java script Un
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
Testing for Pragmatic People
Testing for Pragmatic PeopleTesting for Pragmatic People
Testing for Pragmatic People
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & Jasmine
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
 
Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your Database
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 
Test
TestTest
Test
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
Isomorphic React Apps Testing
Isomorphic React Apps TestingIsomorphic React Apps Testing
Isomorphic React Apps Testing
 

Similar to Pruebas en Plone: conceptos básicos y ejemplos

Тестирование и Django
Тестирование и DjangoТестирование и Django
Тестирование и DjangoMoscowDjango
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPressHarshad Mane
 
Security Testing
Security TestingSecurity Testing
Security TestingKiran Kumar
 
Automated Unit Testing
Automated Unit TestingAutomated Unit Testing
Automated Unit TestingMike Lively
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passageErik Rose
 
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...solit
 
UI Testing with Spec
 UI Testing with Spec UI Testing with Spec
UI Testing with SpecPharo
 
Selenium my sql and junit user guide
Selenium my sql and junit user guideSelenium my sql and junit user guide
Selenium my sql and junit user guideFahad Shiekh
 
Seven Peaks Speaks - Compose Screenshot Testing Made Easy
Seven Peaks Speaks - Compose Screenshot Testing Made EasySeven Peaks Speaks - Compose Screenshot Testing Made Easy
Seven Peaks Speaks - Compose Screenshot Testing Made EasySeven Peaks Speaks
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.Mark Rees
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMockYing Zhang
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cliCory Forsyth
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingMark Rickerby
 

Similar to Pruebas en Plone: conceptos básicos y ejemplos (20)

Тестирование и Django
Тестирование и DjangoТестирование и Django
Тестирование и Django
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPress
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
 
Security Testing
Security TestingSecurity Testing
Security Testing
 
Automated Unit Testing
Automated Unit TestingAutomated Unit Testing
Automated Unit Testing
 
UPC Testing talk 2
UPC Testing talk 2UPC Testing talk 2
UPC Testing talk 2
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passage
 
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
 
UI Testing with Spec
 UI Testing with Spec UI Testing with Spec
UI Testing with Spec
 
Browser_Stack_Intro
Browser_Stack_IntroBrowser_Stack_Intro
Browser_Stack_Intro
 
Selenium my sql and junit user guide
Selenium my sql and junit user guideSelenium my sql and junit user guide
Selenium my sql and junit user guide
 
Seven Peaks Speaks - Compose Screenshot Testing Made Easy
Seven Peaks Speaks - Compose Screenshot Testing Made EasySeven Peaks Speaks - Compose Screenshot Testing Made Easy
Seven Peaks Speaks - Compose Screenshot Testing Made Easy
 
Mxunit
MxunitMxunit
Mxunit
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cli
 
Clean tests good tests
Clean tests   good testsClean tests   good tests
Clean tests good tests
 
J Unit
J UnitJ Unit
J Unit
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe Testing
 

More from Héctor Velarde

Plone: pasado, presente y futuro
Plone: pasado, presente y futuroPlone: pasado, presente y futuro
Plone: pasado, presente y futuroHéctor Velarde
 
Plone: software libre y comunidad
Plone: software libre y comunidadPlone: software libre y comunidad
Plone: software libre y comunidadHéctor Velarde
 
Diseño e ingeniería (segunda parte)
Diseño e ingeniería (segunda parte)Diseño e ingeniería (segunda parte)
Diseño e ingeniería (segunda parte)Héctor Velarde
 
Características de los enlaces con cables de fibra
Características de los enlaces con cables de fibraCaracterísticas de los enlaces con cables de fibra
Características de los enlaces con cables de fibraHéctor Velarde
 
Características de los enlaces con cables de cobre
Características de los enlaces con cables de cobreCaracterísticas de los enlaces con cables de cobre
Características de los enlaces con cables de cobreHéctor Velarde
 
Especificaciones del canal
Especificaciones del canalEspecificaciones del canal
Especificaciones del canalHéctor Velarde
 
Norma mexicana de cableado
Norma mexicana de cableadoNorma mexicana de cableado
Norma mexicana de cableadoHéctor Velarde
 
Introducción al cableado estructurado
Introducción al cableado estructuradoIntroducción al cableado estructurado
Introducción al cableado estructuradoHéctor Velarde
 
Arquitectura de componentes de Zope 3
Arquitectura de componentes de Zope 3Arquitectura de componentes de Zope 3
Arquitectura de componentes de Zope 3Héctor Velarde
 

More from Héctor Velarde (14)

Plone in news media
Plone in news mediaPlone in news media
Plone in news media
 
Plone: pasado, presente y futuro
Plone: pasado, presente y futuroPlone: pasado, presente y futuro
Plone: pasado, presente y futuro
 
Plone: software libre y comunidad
Plone: software libre y comunidadPlone: software libre y comunidad
Plone: software libre y comunidad
 
Diseño e ingeniería (segunda parte)
Diseño e ingeniería (segunda parte)Diseño e ingeniería (segunda parte)
Diseño e ingeniería (segunda parte)
 
Diseño e ingeniería
Diseño e ingenieríaDiseño e ingeniería
Diseño e ingeniería
 
Métodos de prueba
Métodos de pruebaMétodos de prueba
Métodos de prueba
 
Características de los enlaces con cables de fibra
Características de los enlaces con cables de fibraCaracterísticas de los enlaces con cables de fibra
Características de los enlaces con cables de fibra
 
Características de los enlaces con cables de cobre
Características de los enlaces con cables de cobreCaracterísticas de los enlaces con cables de cobre
Características de los enlaces con cables de cobre
 
Especificaciones del canal
Especificaciones del canalEspecificaciones del canal
Especificaciones del canal
 
Componentes
ComponentesComponentes
Componentes
 
Norma mexicana de cableado
Norma mexicana de cableadoNorma mexicana de cableado
Norma mexicana de cableado
 
Introducción al cableado estructurado
Introducción al cableado estructuradoIntroducción al cableado estructurado
Introducción al cableado estructurado
 
Arquitectura de componentes de Zope 3
Arquitectura de componentes de Zope 3Arquitectura de componentes de Zope 3
Arquitectura de componentes de Zope 3
 
Plone en La Jornada
Plone en La JornadaPlone en La Jornada
Plone en La Jornada
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

Pruebas en Plone: conceptos básicos y ejemplos

  • 1. Pruebas en Conceptos básicos y ejemplos
  • 2. ¿qué son y para qué sirven?
  • 3.  
  • 4. Unit testing will make you more attractive to the opposite sex. Martin Aspeli
  • 5. pruebas unitarias pruebas de integración pruebas funcionales pruebas de sistema
  • 7. pruebas unitarias y de integración
  • 8. base.py from Testing import ZopeTestCase ZopeTestCase.installProduct('My Product') from Products.PloneTestCase.PloneTestCase import PloneTestCase from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Products.PloneTestCase.PloneTestCase import setupPloneSite setupPloneSite(products=['My Product']) class MyProductTestCase(PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class MyProductFunctionalTestCase(FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """
  • 9. my_test.py import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from base import MyProductTestCase class TestClass(MyProductTestCase): """Tests for this and that...""" ... def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() ... suite.addTest(makeSuite(TestClass)) ... return suite if __name__ == '__main__': framework()
  • 10. Instalación de skins y recursos class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.skins = self.portal.portal_skins self.csstool = self.portal.portal_css self.jstool = self.portal.portal_javascripts ... def testSkinLayersInstalled(self): """Verifies the skin layer was registered""" self.failUnless('my_product_skin' in self.skins.objectIds()) def testCssInstalled(self): """Verifies the associated CSS file was registered""" stylesheetids = self.csstool.getResourceIds() self.failUnless('my_css_id' in stylesheetids) def testJavascriptsInstalled(self): """Verifies the associated JavaScript file was registered""" javascriptids = self.jstool.getResourceIds() self.failUnless('my_js_id' in javascriptids)
  • 11. Instalación de tipos de contenido class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.types = self.portal.portal_types self.factory = self.portal.portal_factory ... def testTypesInstalled(self): """Verifies the content type was installed""" self.failUnless('My Type' in self.types.objectIds()) def testPortalFactorySetup(self): """Verifies the content type was registered in the portal factory. The portal factory ensures that new objects are created in a well-behaved fashion. """ self.failUnless('My Type' in self.factory.getFactoryTypes())
  • 12. Instalación de tools y configlets class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.config = self.portal.portal_controlpanel ... def testToolInstalled(self): """Verifies a tool was installed""" self.failUnless(getattr(self.portal, 'my_tool', None) is not None) def testConfigletInstalled(self): """Verifies a configlet was installed""" configlets = list(self.config.listActions()) self.failUnless('my_configlet_id' in configlets)
  • 13. Verificando recursos de Kupu class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.kupu = self.portal.kupu_library_tool ... def testKupuResourcesSetup(self): """Verifies the content type can be linked inside Kupu""" linkable = self.kupu.getPortalTypesForResourceType('linkable') self.failUnless('My Type' in linkable)
  • 14. Verificando otras propiedades class TestInstallation(MyProductTestCase): """Ensure product is properly installed""" def afterSetUp(self): ... self.props = self.portal.portal_properties ... def testDefaultPageTypes(self): """Verifies the content type can be used as the default page in a container object like a folder. """ self.failUnless('My Type' in self.props.site_properties.getProperty('default_page_types'))
  • 15. Desinstalación del producto class TestUninstall(MyProductTestCase): """Ensure product is properly uninstalled""" def afterSetUp(self): ... self.qitool = self.portal.portal_quickinstaller self.qitool.uninstallProducts(products=['My Product']) ... def testProductUninstalled(self): """Verifies the product was uninstalled""" self.failIf(self.qitool.isProductInstalled('My Product'))
  • 16. Implementación from Interface.Verify import verifyObject from Products.ATContentTypes.interface import IATContentType from Products.MyProduct.interfaces import IMyProduct class TestContentType(MyProductTestCase): """Ensure content type implementation""" def afterSetUp(self): self.folder.invokeFactory('My Type', 'mytype1') self.mytype1 = getattr(self.folder, 'mytype1') def testImplementsATContentType(self): """Verifies the object implements the base Archetypes interface""" iface = IATContentType self.failUnless(iface.providedBy(self.mytype1)) self.failUnless(verifyObject(iface, self.mytype1)) def testImplementsMyType(self): """Verifies the object implements the content type interface""" iface = IMyType self.failUnless(iface.providedBy(self.mytype1)) self.failUnless(verifyObject(iface, self.mytype1))
  • 17. Creación y edición de contenido class TestContentCreation(MyProductTestCase): """Ensure content type can be created and edited""" def afterSetUp(self): self.folder.invokeFactory('My Type', 'mytype1') self.mytype1 = getattr(self.folder, 'mytype1') def testCreateMyType(self): """Verifies the object has been created""" self.failUnless('mytype1' in self.folder.objectIds()) def testEditMyType(self): """Verifies the object can be properly edited""" self.mytype1.setTitle('A title') self.mytype1.setDescription('A description') ... self.assertEqual(self.mytype1.Title(), 'A title') self.assertEqual(self.mytype1.Description(), 'A description') ...
  • 18.  
  • 19. pruebas funcionales y de sistema
  • 20. zope.testbrowser zope.testrecorder Es elegante y fácil de usar, pero no soporta JavaScript Permite grabar las pruebas en formato zope.testbrowser o Selenium
  • 21. Selenium IDE Selenium Remote Control Selenium Grid
  • 22.