Merge lp:~pedro/mago/gnome-system-monitor into lp:~mago-contributors/mago/mago-1.0

Proposed by Pedro Villavicencio
Status: Merged
Merged at revision: 151
Proposed branch: lp:~pedro/mago/gnome-system-monitor
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: 308 lines (+283/-0)
5 files modified
gnome_system_monitor/README (+19/-0)
gnome_system_monitor/gnome_system_monitor_tests.py (+31/-0)
gnome_system_monitor/gnome_system_monitor_tests.xml (+30/-0)
mago/application/gnome_system_monitor.py (+183/-0)
mago/test_suite/gnome_system_monitor.py (+20/-0)
To merge this branch: bzr merge lp:~pedro/mago/gnome-system-monitor
Reviewer Review Type Date Requested Status
Nagappan Alagappan Approve
Review via email: mp+42357@code.launchpad.net

Description of the change

Tests cases for the GNOME System Monitor, tests available:

* Change Processes Tab Preferences.
* Change FileSystem Tab Preferences.
* Change Processes Tab Views.
* Change Proceesses Sorting methods.
* Search for Open Files.

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

Looks okay to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'gnome_system_monitor'
2=== added file 'gnome_system_monitor/README'
3--- gnome_system_monitor/README 1970-01-01 00:00:00 +0000
4+++ gnome_system_monitor/README 2010-12-01 13:27:58 +0000
5@@ -0,0 +1,19 @@
6+GNOME SYSTEM MONITOR TESTS
7+==========================
8+
9+Safety
10+------
11+The tests are safe to run since they don't touch any system configuration.
12+
13+Configuration
14+-------------
15+No special configuration is required.
16+
17+Available Tests
18+---------------
19+
20+* Change Processes Tab Preferences.
21+* Change FileSystem Tab Preferences.
22+* Change Processes Tab Views.
23+* Change Proceesses Sorting methods.
24+* Search for Open Files.
25
26=== added file 'gnome_system_monitor/gnome_system_monitor_tests.py'
27--- gnome_system_monitor/gnome_system_monitor_tests.py 1970-01-01 00:00:00 +0000
28+++ gnome_system_monitor/gnome_system_monitor_tests.py 2010-12-01 13:27:58 +0000
29@@ -0,0 +1,31 @@
30+
31+# -*- coding: utf-8 -*-
32+import os
33+from time import time, gmtime, strftime
34+
35+from mago.test_suite.gnome_system_monitor import Gnome_system_monitorTestSuite
36+
37+class Gnome_system_monitorTests(Gnome_system_monitorTestSuite):
38+
39+ def change_views(self):
40+ self.application.gsm_change_processes_view()
41+
42+ def change_process_sorting(self):
43+ self.application.gsm_change_processes_sort()
44+
45+ def change_process_preferences(self):
46+ self.application.gsm_enable_disable_proc_pefs(True)
47+ self.application.gsm_enable_disable_proc_pefs(False)
48+ self.application.gsm_enable_disable_proc_pefs(True)
49+
50+ def change_filesystem_preferences(self):
51+ self.application.gsm_enable_disable_filesystem_prefs(True)
52+ self.application.gsm_enable_disable_filesystem_prefs(False)
53+ self.application.gsm_enable_disable_filesystem_prefs(True)
54+
55+ def search_open_files(self, search_for):
56+ self.application.gsm_search_for_open_files(search_for)
57+
58+if __name__ == "__main__":
59+ gnome_system_monitor_test = Gnome_system_monitorTests()
60+ gnome_system_monitor_test.run()
61
62=== added file 'gnome_system_monitor/gnome_system_monitor_tests.xml'
63--- gnome_system_monitor/gnome_system_monitor_tests.xml 1970-01-01 00:00:00 +0000
64+++ gnome_system_monitor/gnome_system_monitor_tests.xml 2010-12-01 13:27:58 +0000
65@@ -0,0 +1,30 @@
66+<?xml version="1.0"?>
67+<suite name="Gnome_system_monitor">
68+ <class>gnome_system_monitor_tests.Gnome_system_monitorTests</class>
69+ <description>
70+ Tests which verify GNOME System Monitor functionality.
71+ </description>
72+ <case name="process_preferences">
73+ <method>change_process_preferences</method>
74+ <description>Change the Process tab preferences</description>
75+ </case>
76+ <case name="filesystem_preferences">
77+ <method>change_filesystem_preferences</method>
78+ <description>Change the Filesystem tab preferences</description>
79+ </case>
80+ <case name="change_views">
81+ <method>change_views</method>
82+ <description>Change the views of the Processes tab.</description>
83+ </case>
84+ <case name="change_process_sorting">
85+ <method>change_process_sorting</method>
86+ <description>Change the Sorting method of the Processes tab</description>
87+ </case>
88+ <case name="search_open_files">
89+ <method>search_open_files</method>
90+ <description>Search for open files</description>
91+ <args>
92+ <search_for>a</search_for>
93+ </args>
94+ </case>
95+</suite>
96
97=== added file 'mago/application/gnome_system_monitor.py'
98--- mago/application/gnome_system_monitor.py 1970-01-01 00:00:00 +0000
99+++ mago/application/gnome_system_monitor.py 2010-12-01 13:27:58 +0000
100@@ -0,0 +1,183 @@
101+PACKAGE = "mago"
102+
103+#-*- coding:utf-8 -*-
104+"""
105+This is the "gnome_system_monitor" module.
106+
107+This module provides a wrapper for LDTP to make writing Gnome_system_monitor tests easier.
108+"""
109+import ooldtp
110+import ldtp
111+import os
112+from .main import Application
113+from ..gconfwrapper import GConf
114+from ..cmd import globals
115+import time
116+import gettext
117+
118+gettext.install (True)
119+gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
120+gettext.textdomain (PACKAGE)
121+t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
122+_ = t.gettext
123+
124+
125+class Gnome_system_monitor(Application):
126+ """
127+ gnome_system_mo manages the Gnome_system_mo application.
128+ """
129+
130+ LAUNCHER = 'gnome-system-monitor'
131+ LAUNCHER_ARGS = []
132+ WINDOW = 'frmSystemMonitor'
133+
134+ BTN_FIND = _('btnFind')
135+ BTN_CLOSE = _('btnClose')
136+ BTN_ENDPROCESS = _('btnEndProcess')
137+ ICO_0 = _('ico0')
138+ DLG_PREFERENCES = _('dlgSystemMonitorPreferences')
139+ FRM_SEARCHOPENFILES = _('frmSearchforOpenFiles')
140+ MNU_ABOUT = _('mnuAbout')
141+ MNU_ACTIVEPROCESSES = _('mnuActiveProcesses')
142+ MNU_ALLPROCESSES = _('mnuAllProcesses')
143+ MNU_CHANGEPRIORITY = _('mnuChangePriority')
144+ MNU_CONTENTS = _('mnuContents')
145+ MNU_CONTINUEPROCESS = _('mnuContinueProcess')
146+ MNU_DEPENDENCIES = _('mnuDependencies')
147+ MNU_EDIT = _('mnuEdit')
148+ MNU_EMPTY = _('mnuEmpty')
149+ MNU_EMPTY1 = _('mnuEmpty1')
150+ MNU_EMPTY2 = _('mnuEmpty2')
151+ MNU_EMPTY3 = _('mnuEmpty3')
152+ MNU_ENDPROCESS = _('mnuEndProcess')
153+ MNU_HELP = _('mnuHelp')
154+ MNU_KILLPROCESS = _('mnuKillProcess')
155+ MNU_MEMORYMAPS = _('mnuMemoryMaps')
156+ MNU_MONITOR = _('mnuMonitor')
157+ MNU_MYPROCESSES = _('mnuMyProcesses')
158+ MNU_OPENFILES = _('mnuOpenFiles')
159+ MNU_PREFERENCES = _('mnuPreferences')
160+ MNU_QUIT = _('mnuQuit')
161+ MNU_REFRESH = _('mnuRefresh')
162+ MNU_SEARCHFOROPENFILES = _('mnuSearchforOpenFiles')
163+ MNU_STOPPROCESS = _('mnuStopProcess')
164+ MNU_VIEW = _('mnuView')
165+ PTA_BFILESYSTEMS = _('ptabFileSystems')
166+ PTA_BPROCESSES = _('ptabProcesses')
167+ PTA_BRESOURCES = _('ptabResources')
168+ PTA_BSYSTEM = _('ptabSystem')
169+ PTL_0 = _('ptl0')
170+ SCB_R0 = _('scbr0')
171+ TBL_0 = _('tbl0')
172+ TBL_PROCESSINFO = _('tblProcessinformationshowninlist')
173+ TBL_SYSTEMINFO = _('tblFilesysteminformationshowninlist')
174+ TTB_L0 = _('ttbl0')
175+ LBL_RELEASE = _('lblRelease*')
176+ LBL_KERNEL = _('lblKernel*')
177+ TCH_STATUS = _('tchStatus')
178+ TCH_PROCESSNAME = _('tchProcessName')
179+ TCH_CPUPERCENT = _('tch%CPU')
180+ TCH_ID = _('tchID')
181+ TCH_NICE = _('tchNice')
182+ TCH_MEMORY = _('tchMemory')
183+ TCH_WAITINGCHANNEL = _('tchWaitingChannel')
184+ TCH_RESIDENTMEMORY = _('tchResidentMemory')
185+ TCH_XSERVERMEMORY = _('tchXServerMemory')
186+ TCH_VIRTUALMEMORY = _('tchVirtualMemory')
187+ TCH_SHAREDMEMORY = _('tchSharedMemory')
188+ TCH_USER = _('tchUser')
189+ TCH_CPUTIME = _('tchCPUTime')
190+
191+ TXT_0 = _('txt0')
192+
193+ HEADERS = [ TCH_STATUS,
194+ TCH_PROCESSNAME,
195+ TCH_CPUPERCENT,
196+ TCH_ID,
197+ TCH_NICE,
198+ TCH_MEMORY,
199+ TCH_WAITINGCHANNEL,
200+ TCH_RESIDENTMEMORY,
201+ TCH_XSERVERMEMORY,
202+ TCH_VIRTUALMEMORY,
203+ TCH_SHAREDMEMORY,
204+ TCH_USER,
205+ TCH_CPUTIME]
206+
207+ def gsm_change_processes_view(self):
208+ gsm = ooldtp.context(self.WINDOW)
209+ gsm.getchild(self.PTL_0).selecttab(self.PTA_BPROCESSES)
210+ ldtp.wait(2)
211+ gsm.getchild(self.MNU_ACTIVEPROCESSES).selectmenuitem()
212+ ldtp.wait(2)
213+ gsm.getchild(self.MNU_MYPROCESSES).selectmenuitem()
214+ ldtp.wait(2)
215+ gsm.getchild(self.MNU_DEPENDENCIES).selectmenuitem()
216+ ldtp.wait(2)
217+ gsm.getchild(self.MNU_ALLPROCESSES).selectmenuitem()
218+ ldtp.wait(2)
219+
220+ def gsm_change_processes_sort(self):
221+ gsm = ooldtp.context(self.WINDOW)
222+ gsm.getchild(self.PTL_0).selecttab(self.PTA_BPROCESSES)
223+
224+ for head in self.HEADERS:
225+ gsm.getchild(head).click()
226+ ldtp.wait(2)
227+ gsm.getchild(head).click()
228+
229+ def gsm_search_for_open_files(self, search_for):
230+ gsm = ooldtp.context(self.WINDOW)
231+ gsm.getchild(self.MNU_SEARCHFOROPENFILES).selectmenuitem()
232+ openFiles = ooldtp.context(self.FRM_SEARCHOPENFILES)
233+ openFiles.settextvalue(self.TXT_0, search_for)
234+ openFiles.getchild(self.BTN_FIND).click()
235+ ldtp.wait(3)
236+ rowcount = openFiles.getrowcount(self.TBL_0)
237+
238+ if not rowcount > 0:
239+ raise AssertionError, "The search based on %s did not return anything" % search_for
240+
241+ openFiles.getchild(self.BTN_CLOSE).click()
242+
243+ def gsm_enable_disable_proc_pefs(self, enable):
244+ gsm = ooldtp.context(self.WINDOW)
245+ gsm.getchild(self.PTL_0).selecttab(self.PTA_BPROCESSES)
246+ gsm.getchild(self.MNU_PREFERENCES).selectmenuitem()
247+ ldtp.waittillguiexist(self.DLG_PREFERENCES)
248+ preferences = ooldtp.context(self.DLG_PREFERENCES)
249+ preferences.getchild(self.PTL_0).selecttab(self.PTA_BPROCESSES)
250+ rowcount = preferences.getrowcount(self.TBL_PROCESSINFO)
251+ row = 0
252+ while row < rowcount:
253+ if (enable):
254+ preferences.checkrow(self.TBL_PROCESSINFO, row)
255+ else:
256+ preferences.uncheckrow(self.TBL_PROCESSINFO, row)
257+ row+=1
258+ ldtp.wait(2)
259+ preferences.getchild(self.BTN_CLOSE).click()
260+ ldtp.wait(2)
261+
262+ def gsm_enable_disable_filesystem_prefs(self, enable):
263+ gsm = ooldtp.context(self.WINDOW)
264+ gsm.getchild(self.PTL_0).selecttab(self.PTA_BFILESYSTEMS)
265+ gsm.getchild(self.MNU_PREFERENCES).selectmenuitem()
266+ ldtp.waittillguiexist(self.DLG_PREFERENCES)
267+ preferences = ooldtp.context(self.DLG_PREFERENCES)
268+ preferences.getchild(self.PTL_0).selecttab(self.PTA_BFILESYSTEMS)
269+ rowcount = preferences.getrowcount(self.TBL_SYSTEMINFO)
270+ row = 0
271+ while row < rowcount:
272+ if (enable):
273+ preferences.checkrow(self.TBL_SYSTEMINFO, row)
274+ else:
275+ preferences.uncheckrow(self.TBL_SYSTEMINFO, row)
276+ row+=1
277+ ldtp.wait(2)
278+ preferences.getchild(self.BTN_CLOSE).click()
279+ ldtp.wait(2)
280+
281+ def __init__(self):
282+ Application.__init__(self)
283+ self.main_window = ooldtp.context(self.WINDOW)
284
285=== added file 'mago/test_suite/gnome_system_monitor.py'
286--- mago/test_suite/gnome_system_monitor.py 1970-01-01 00:00:00 +0000
287+++ mago/test_suite/gnome_system_monitor.py 2010-12-01 13:27:58 +0000
288@@ -0,0 +1,20 @@
289+"""
290+This module contains the definition of the test suite for Gnome_system_monitor testing.
291+"""
292+import ldtp, ooldtp
293+from .main import SingleApplicationTestSuite
294+from ..application.gnome_system_monitor import Application, Gnome_system_monitor
295+
296+class Gnome_system_monitorTestSuite(SingleApplicationTestSuite):
297+ """
298+ Default test suite for Gnome_system_monitor
299+ """
300+ APPLICATION_FACTORY = Gnome_system_monitor
301+ def setup(self):
302+ self.application.open()
303+
304+ def teardown(self):
305+ self.application.close()
306+
307+ def cleanup(self):
308+ pass

Subscribers

People subscribed via source and target branches

to status/vote changes: