Merge lp:~marjo-mercado/mago/gobby_test into lp:~mago-contributors/mago/mago-1.0

Proposed by Marjo F. Mercado
Status: Merged
Merged at revision: 156
Proposed branch: lp:~marjo-mercado/mago/gobby_test
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: 200 lines (+147/-23)
6 files modified
gedit/gedit_chains.xml (+0/-23)
gobby/README (+17/-0)
gobby/gobby_basics.py (+13/-0)
gobby/gobby_basics.xml (+14/-0)
mago/application/gobby.py (+83/-0)
mago/test_suite/gobby.py (+20/-0)
To merge this branch: bzr merge lp:~marjo-mercado/mago/gobby_test
Reviewer Review Type Date Requested Status
Nagappan Alagappan Approve
Review via email: mp+43259@code.launchpad.net

Description of the change

Initial version of gobby test suite.

To post a comment you must log in.
Revision history for this message
Nagappan Alagappan (nagappan) wrote :

Looks okay to me

review: Approve
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

With the exception that it removes the gedit_chains.xml. I'll fix that in trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'gedit/gedit_chains.xml'
2--- gedit/gedit_chains.xml 2009-06-03 09:41:56 +0000
3+++ gedit/gedit_chains.xml 1970-01-01 00:00:00 +0000
4@@ -1,23 +0,0 @@
5-<?xml version="1.0"?>
6-<suite name="gedit chains">
7- <class>gedit_chains.GEditChain</class>
8- <description>
9- Tests which verify gedit's save file functionality.
10- </description>
11- <case name="Unicode Tests">
12- <method>testChain</method>
13- <description>Test Unicode text saving.</description>
14- <args>
15- <oracle>data/utf8.txt</oracle>
16- <chain>This is a japanese string: 広告掲載 - ビジネス</chain>
17- </args>
18- </case>
19- <case name="ASCII Test">
20- <method>testChain</method>
21- <description>Test ASCII text saving.</description>
22- <args>
23- <oracle>data/ascii.txt</oracle>
24- <chain>This is a very basic string!</chain>
25- </args>
26- </case>
27-</suite>
28
29=== added directory 'gobby'
30=== added file 'gobby/README'
31--- gobby/README 1970-01-01 00:00:00 +0000
32+++ gobby/README 2010-12-09 18:06:49 +0000
33@@ -0,0 +1,17 @@
34+gobby Tests
35+---------------------
36+Tests that verify gobby functionality.
37+
38+Safety
39+------
40+None of these tests touches any configuration or system files.
41+
42+Configuration
43+-------------
44+Nothing
45+
46+Available Tests
47+---------------
48+
49+* about_dialog: runs the about dialog
50+
51
52=== added file 'gobby/gobby_basics.py'
53--- gobby/gobby_basics.py 1970-01-01 00:00:00 +0000
54+++ gobby/gobby_basics.py 2010-12-09 18:06:49 +0000
55@@ -0,0 +1,13 @@
56+# -*- coding: utf-8 -*-
57+import os
58+from time import time, gmtime, strftime
59+
60+from mago.test_suite.gobby import GobbyTestSuite
61+
62+class GobbyBasics(GobbyTestSuite):
63+ def testAboutdialog(self, arg1=None):
64+ self.application.runAboutdialog()
65+
66+if __name__ == "__main__":
67+ gobby_test = GobbyBasics()
68+ gobby_test.run()
69
70=== added file 'gobby/gobby_basics.xml'
71--- gobby/gobby_basics.xml 1970-01-01 00:00:00 +0000
72+++ gobby/gobby_basics.xml 2010-12-09 18:06:49 +0000
73@@ -0,0 +1,14 @@
74+<?xml version="1.0"?>
75+<suite name="Gobby">
76+ <class>gobby_basics.GobbyBasics</class>
77+ <description>
78+ Tests which verify Gobby basics functionality.
79+ </description>
80+ <case name="about_dialog">
81+ <method>testAboutdialog</method>
82+ <description>Verify that the about dialog launches</description>
83+ <args>
84+ <arg1>Arg example</arg1>
85+ </args>
86+ </case>
87+</suite>
88
89=== added file 'mago/application/gobby.py'
90--- mago/application/gobby.py 1970-01-01 00:00:00 +0000
91+++ mago/application/gobby.py 2010-12-09 18:06:49 +0000
92@@ -0,0 +1,83 @@
93+PACKAGE = "mago"
94+
95+#-*- coding:utf-8 -*-
96+"""
97+This is the "gobby" module.
98+
99+This module provides a wrapper for LDTP to make writing Gobby tests easier.
100+"""
101+import ooldtp
102+import ldtp
103+import os
104+from .main import Application
105+from ..gconfwrapper import GConf
106+from ..cmd import globals
107+import time
108+import gettext
109+
110+gettext.install (True)
111+gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
112+gettext.textdomain (PACKAGE)
113+t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
114+_ = t.gettext
115+
116+
117+class Gobby(Application):
118+ """
119+ gobby manages the Gobby application.
120+ """
121+
122+ LAUNCHER = 'gobby'
123+ LAUNCHER_ARGS = []
124+ WINDOW = 'frmGobby'
125+
126+ MNU_ABOUT = _('mnuAbout')
127+ MNU_CLOSE = _('mnuClose')
128+ MNU_NEW = _('mnuNew')
129+
130+
131+ def runAboutdialog(self):
132+ """
133+ This basic test simply verifies that the application launches
134+ and that the UI reacts
135+ The About dialog is the only menu that is always present in the UI
136+ """
137+ if self.MNU_ABOUT:
138+ self.main_window.click(self.MNU_ABOUT)
139+
140+ # Wait for the dialog to open
141+ # Name of about dialogs change with the app
142+ timeout=60
143+ dlgAbout=None
144+ while not ( timeout>0 and dlgAbout):
145+ dlgs=[ w for w in ldtp.getwindowlist() if w.startswith('dlgAbout')]
146+ if dlgs:
147+ dlgAbout = dlgs[0]
148+ timeout -= 1
149+ time.sleep(1)
150+
151+ if not dlgAbout:
152+ raise AssertionError('About Dialog not found')
153+
154+
155+ # Looking for a button to close the window
156+ found = None
157+ for btnClose in ('btnClose', 'btnOK', 'btnCancel'):
158+ try:
159+ found = ldtp.getchild(dlgAbout, btnClose, 'push button')
160+ break
161+ except:
162+ pass
163+
164+ if not found:
165+ return
166+
167+ ldtp.click(dlgAbout, btnClose)
168+
169+
170+ def close(self):
171+ self.main_window.click('mnuQuit')
172+
173+ def __init__(self):
174+ Application.__init__(self)
175+ self.main_window = ooldtp.context(self.WINDOW)
176
177=== added file 'mago/test_suite/gobby.py'
178--- mago/test_suite/gobby.py 1970-01-01 00:00:00 +0000
179+++ mago/test_suite/gobby.py 2010-12-09 18:06:49 +0000
180@@ -0,0 +1,20 @@
181+"""
182+This module contains the definition of the test suite for Gobby testing.
183+"""
184+import ldtp, ooldtp
185+from .main import SingleApplicationTestSuite
186+from ..application.gobby import Application, Gobby
187+
188+class GobbyTestSuite(SingleApplicationTestSuite):
189+ """
190+ Default test suite for Gobby
191+ """
192+ APPLICATION_FACTORY = Gobby
193+ def setup(self):
194+ self.application.open()
195+
196+ def teardown(self):
197+ self.application.close()
198+
199+ def cleanup(self):
200+ self.application.close()

Subscribers

People subscribed via source and target branches

to status/vote changes: