SlideShare a Scribd company logo
1 of 8
Download to read offline
Unity, testing with Autopilot

Quality is the Word!




Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Setting up your system

           # Download del codice sorgente di unity
           $ bzr branch lp:unity

           # Installazione pacchetti necessari
           $ sudo apt-get install python-autopilot

           # Testare codice on-the-edge
           $ sudo add-apt-repository 
                  ppa:unity-team/staging


Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Running the tests
    # Entrare nella directory di unity
    $ cd ~/my-source-code/unity

    # Esportare la variabile PYTHONPATH
    $ export PYTHONPATH=$PWD/tests/autopilot

    # Avviare i test
    $ autopilot run unity

    # Avviare un test specifico
    $ autopilot run 
    unity.tests.test_panel.PanelIndicatorEntry*

Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Inspecting Unity
  $ autopilot vis




Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Test Example
           // Inherit from unity::debug::Introspectable

           void PanelIndicatorEntryView::AddProperties(GVariantBuilder* builder)
           {
             variant::BuilderWrapper(builder)
             .add(GetAbsoluteGeometry())
             .add("entry_id", GetEntryID())
             .add("name_hint", entry_->name_hint())
             .add("type", entry_->type_name())
             .add("priority", entry_->priority())
             .add("label", GetLabel())
             .add("label_sensitive", IsLabelSensitive())
             .add("label_visible", IsLabelVisible())
             .add("icon_sensitive", IsIconSensitive())
             .add("active", proxy_->active())
             .add("menu_x", proxy_->geometry().x)
             .add("menu_y", proxy_->geometry().y));
             // ecc...
           }


Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Test Example
    def test_menu_opens_on_click(self):
        """Tests that clicking on a menu entry, opens a menu."""
        self.open_new_application_window("Calculator")
        refresh_fn = lambda: len(self.panel.menus.get_entries())
        self.assertThat(refresh_fn, Eventually(GreaterThan(0)))
        menu_entry = self.panel.menus.get_entries()[0]

           self.mouse_open_indicator(menu_entry)

           self.assertThat(menu_entry.active, Eventually(Equals(True)))
           self.assertThat(menu_entry.menu_x, Eventually(Equals(menu_entry.x)))
           self.assertThat(menu_entry.menu_y, Eventually(Equals(self.panel.height)))

    def mouse_open_indicator(self, indicator):
        """This is an utility function that safely opens an indicator."""
        if not isinstance(indicator, IndicatorEntry):
            raise TypeError("Window must be a IndicatorEntry")

           indicator.mouse_click()
           self.addCleanup(self.panel.move_mouse_below_the_panel)
           self.addCleanup(self.keyboard.press_and_release, "Escape")
           self.assertThat(indicator.active, Eventually(Equals(True)))

Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

RTFM!



      Documentazione e tutorial:
       ●
           http://unity.ubuntu.com/autopilot/
       ●
           https://wiki.ubuntu.com/Unity/QA/Autopilot




Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with Autopilot

Question time




                                     GRAZIE!
                                       Ping me: Trevinho @ Freenode




Ubuntu-it meeting 2012
 Marco Trevisan (Treviño) – marco@ubuntu.com

More Related Content

Similar to Introduzione ad Autopilot

Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extra
rit2010
 
J unit presentation
J unit presentationJ unit presentation
J unit presentation
Priya Sharma
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
rit2010
 

Similar to Introduzione ad Autopilot (20)

Gui
GuiGui
Gui
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.ppt
 
Unit Testing Using N Unit
Unit Testing Using N UnitUnit Testing Using N Unit
Unit Testing Using N Unit
 
SWTBot Tutorial
SWTBot TutorialSWTBot Tutorial
SWTBot Tutorial
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Security Testing
Security TestingSecurity Testing
Security Testing
 
Automated ui testing
Automated ui testingAutomated ui testing
Automated ui testing
 
Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extra
 
J unit presentation
J unit presentationJ unit presentation
J unit presentation
 
JUnit Presentation
JUnit PresentationJUnit Presentation
JUnit Presentation
 
Day 5
Day 5Day 5
Day 5
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
 
JsUnit
JsUnitJsUnit
JsUnit
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
 
Jsunit
JsunitJsunit
Jsunit
 
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in JavaBasic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 

More from Marco Trevisan (8)

State of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu SummitState of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu Summit
 
Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017
 
Workshop: snap from zero to hero
Workshop: snap from zero to heroWorkshop: snap from zero to hero
Workshop: snap from zero to hero
 
Introduzione ad ubuntu core
Introduzione ad ubuntu coreIntroduzione ad ubuntu core
Introduzione ad ubuntu core
 
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open SourceAlla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
 
Unity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu PhoneUnity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu Phone
 
Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Introduzione ad Autopilot

  • 1. Unity, testing with Autopilot Quality is the Word! Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 2. Unity, testing with Autopilot Setting up your system # Download del codice sorgente di unity $ bzr branch lp:unity # Installazione pacchetti necessari $ sudo apt-get install python-autopilot # Testare codice on-the-edge $ sudo add-apt-repository ppa:unity-team/staging Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 3. Unity, testing with Autopilot Running the tests # Entrare nella directory di unity $ cd ~/my-source-code/unity # Esportare la variabile PYTHONPATH $ export PYTHONPATH=$PWD/tests/autopilot # Avviare i test $ autopilot run unity # Avviare un test specifico $ autopilot run unity.tests.test_panel.PanelIndicatorEntry* Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 4. Unity, testing with Autopilot Inspecting Unity $ autopilot vis Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 5. Unity, testing with Autopilot Test Example // Inherit from unity::debug::Introspectable void PanelIndicatorEntryView::AddProperties(GVariantBuilder* builder) { variant::BuilderWrapper(builder) .add(GetAbsoluteGeometry()) .add("entry_id", GetEntryID()) .add("name_hint", entry_->name_hint()) .add("type", entry_->type_name()) .add("priority", entry_->priority()) .add("label", GetLabel()) .add("label_sensitive", IsLabelSensitive()) .add("label_visible", IsLabelVisible()) .add("icon_sensitive", IsIconSensitive()) .add("active", proxy_->active()) .add("menu_x", proxy_->geometry().x) .add("menu_y", proxy_->geometry().y)); // ecc... } Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 6. Unity, testing with Autopilot Test Example def test_menu_opens_on_click(self): """Tests that clicking on a menu entry, opens a menu.""" self.open_new_application_window("Calculator") refresh_fn = lambda: len(self.panel.menus.get_entries()) self.assertThat(refresh_fn, Eventually(GreaterThan(0))) menu_entry = self.panel.menus.get_entries()[0] self.mouse_open_indicator(menu_entry) self.assertThat(menu_entry.active, Eventually(Equals(True))) self.assertThat(menu_entry.menu_x, Eventually(Equals(menu_entry.x))) self.assertThat(menu_entry.menu_y, Eventually(Equals(self.panel.height))) def mouse_open_indicator(self, indicator): """This is an utility function that safely opens an indicator.""" if not isinstance(indicator, IndicatorEntry): raise TypeError("Window must be a IndicatorEntry") indicator.mouse_click() self.addCleanup(self.panel.move_mouse_below_the_panel) self.addCleanup(self.keyboard.press_and_release, "Escape") self.assertThat(indicator.active, Eventually(Equals(True))) Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 7. Unity, testing with Autopilot RTFM! Documentazione e tutorial: ● http://unity.ubuntu.com/autopilot/ ● https://wiki.ubuntu.com/Unity/QA/Autopilot Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 8. Unity, testing with Autopilot Question time GRAZIE! Ping me: Trevinho @ Freenode Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com