Your SlideShare is downloading. ×
0
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Introduzione ad Autopilot
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduzione ad Autopilot

486

Published on

Introduzione al test di Ubuntu usando Autopilot

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
486
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Unity, testing with AutopilotQuality is the Word!Ubuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 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. 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. Unity, testing with AutopilotInspecting Unity $ autopilot visUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com
  • 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. 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. 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. Unity, testing with AutopilotQuestion time GRAZIE! Ping me: Trevinho @ FreenodeUbuntu-it meeting 2012 Marco Trevisan (Treviño) – marco@ubuntu.com

×