Unity, testing with AutopilotQuality is the Word!Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
Unity, testing with AutopilotSetting up your system           # Download del codice sorgente di unity           $ bzr bran...
Unity, testing with AutopilotRunning the tests    # Entrare nella directory di unity    $ cd ~/my-source-code/unity    # E...
Unity, testing with AutopilotInspecting Unity  $ autopilot visUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubun...
Unity, testing with AutopilotTest Example           // Inherit from unity::debug::Introspectable           void PanelIndic...
Unity, testing with AutopilotTest Example    def test_menu_opens_on_click(self):        """Tests that clicking on a menu e...
Unity, testing with AutopilotRTFM!      Documentazione e tutorial:       ●           http://unity.ubuntu.com/autopilot/   ...
Unity, testing with AutopilotQuestion time                                     GRAZIE!                                    ...
Upcoming SlideShare
Loading in …5
×

Introduzione ad Autopilot

528
-1

Published on

Introduzione al test di Ubuntu usando Autopilot

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
528
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduzione ad Autopilot

  1. 1. Unity, testing with AutopilotQuality is the Word!Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  2. 2. Unity, testing with AutopilotSetting 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/stagingUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  3. 3. Unity, testing with AutopilotRunning 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. 4. Unity, testing with AutopilotInspecting Unity $ autopilot visUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  5. 5. Unity, testing with AutopilotTest 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. 6. Unity, testing with AutopilotTest 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. 7. Unity, testing with AutopilotRTFM! Documentazione e tutorial: ● http://unity.ubuntu.com/autopilot/ ● https://wiki.ubuntu.com/Unity/QA/AutopilotUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  8. 8. Unity, testing with AutopilotQuestion time GRAZIE! Ping me: Trevinho @ FreenodeUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com

×