* [Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...
@ 2006-12-01 19:57 ldimaggi
0 siblings, 0 replies; 4+ messages in thread
From: ldimaggi @ 2006-12-01 19:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2006-12-01 19:57:52
Added files:
luci/test : congaDemoTests.py conga_Helpers.py
conga_suite.py
Log message:
Checking in the first revision of the first parts of a test suite for Conga.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
/cvs/cluster/conga/luci/test/congaDemoTests.py,v --> standard output
revision 1.1
--- conga/luci/test/congaDemoTests.py
+++ - 2006-12-01 19:57:53.065630000 +0000
@@ -0,0 +1,217 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+# MA 02139, USA.
+
+'''
+Script name: congaDemoTests.py
+Creation date: Dec 2006
+Purpose: Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+ with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary: Simple, demo/prototype test for Conga
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from conga_Helpers import *
+from selenium import selenium
+import unittest, time, re
+
+class congaDemoTests(unittest.TestCase):
+
+ def createUsers(self, sel, theUsers):
+ """Common code to create all users in user dictionary"""
+ for userName in theUsers.keys():
+ print 'Create user: ' + userName
+ sel.click("link=Add a User")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.type("newUserName", userName)
+ sel.type("newPassword", theUsers[userName])
+ sel.type("newPasswordConfirm", theUsers[userName])
+ sel.click("Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+ # Validation - verify that the success message was displayed for each user
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully'))
+
+ def deleteUsers(self, sel, theUsers):
+ """"Common code to delete all users in user dictionary"""
+ for userName in theUsers.keys():
+ print 'Delete user: ' + userName
+ sel.click("link=Delete a User")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.select("deluserId", "label=" + userName)
+ sel.click("Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+ # Validation - verify that the success message was displayed for each user
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))
+
+ def createStorageSystems(self, sel, theSystems):
+ """Common code to create storage systems in the input dictionary"""
+ for systemName in theSystems.keys():
+ print 'Create storage system: ' + systemName
+ sel.click("link=Add a System")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.type("__SYSTEM0:Addr", systemName)
+ sel.type("__SYSTEM0:Passwd", theSystems[systemName])
+ sel.click("Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ # Validation - verify that the success message was displayed for each storage system
+ self.assertEqual("Do you really want to add the following Storage Systems:\n" + systemName, sel.get_confirmation())
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))
+
+ def deleteStorageSystems(self, sel, theSystems):
+ """Common code to delete storage systems in the input dictionary"""
+ for systemName in theSystems.keys():
+ print 'Delete storage system: ' + systemName
+ # Need to handle artifacts names - underscores in strings, not periods
+ systemNameMod = systemName.replace('.', '_')
+ sel.click("name=__SYSTEM:" + systemNameMod)
+ sel.click("document.adminform.Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ # Validation - verify that the success message was displayed for each storage system
+ self.assertEqual("Do you really want to remove the following managed systems:\nStorage Systems:\n-" + systemName, sel.get_confirmation())
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+
+ def setUp(self):
+ """Establish connection to selenium server, login to luci """
+ self.verificationErrors = []
+ self.selenium = selenium("localhost", 4444, "*firefox", CONGA_SERVER)
+ self.selenium.start()
+
+ # Login to the luci web app
+ self.selenium.open(CONGA_SERVER)
+
+ # Wait for "Redirecting, please wait to complete" - it seems like this should not be needed,
+ # but as of 20061130, it still is
+ time.sleep(10)
+ self.selenium.type("__ac_name", CONGA_ADMIN_USERNAME)
+ self.selenium.type("__ac_password", CONGA_ADMIN_PASSWORD)
+ self.selenium.click("submit")
+ self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ def test_congaStorage(self):
+ """Test to create and delete storage systems"""
+ sel = self.selenium
+
+ # Create the storage systems
+ self.createStorageSystems(sel, CONGA_STORAGE_SYSTEMS)
+
+ # View the defined storage systems
+ sel.select_window("null")
+ sel.click("link=Manage Systems")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ # Delete the storage systems
+ self.deleteStorageSystems(sel, CONGA_STORAGE_SYSTEMS)
+
+ def test_congaUsers(self):
+ """Test to create and delete conga users"""
+ sel = self.selenium
+
+ # Create the users
+ self.createUsers (sel, CONGA_USERS)
+
+ # Return to homebase page
+ sel.click("link=homebase")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ # Delete the users
+ self.deleteUsers (sel, CONGA_USERS)
+
+ def test_congaCluster(self):
+ """Test to create and delete a cluster"""
+
+ # TODO - Need to generalize this function - but as of 20061129, note tng3-1
+ # is not responding to the creation of a cluster
+ sel = self.selenium
+ sel.open("/luci/homebase")
+ sel.click("link=cluster")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.click("link=Create a New Cluster")
+
+ # Create the new "testCluster" cluster
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.type("clusterName", "testCluster")
+ print 'Create cluster: testCluster'
+
+ # Add the nodes to the cluster
+ # Needed to generalize statements like this:
+ # sel.type("__SYSTEM1:Addr", "tng3-2.lab.msp.redhat.com")
+ # sel.type("__SYSTEM1:Passwd", "password")
+ # sel.click("//input[@value='Add Another Row']")
+ systemCounter = 0
+ for systemName in CONGA_CLUSTER_SYSTEMS.keys():
+ sel.type("__SYSTEM" + str(systemCounter) + ":Addr", systemName)
+ sel.type("__SYSTEM" + str(systemCounter) + ":Passwd", CONGA_CLUSTER_SYSTEMS[systemName])
+ systemCounter = systemCounter + 1
+ if (systemCounter > 2):
+ sel.click("//input[@value='Add Another Row']")
+ sel.click("document.adminform.rhn_dl[1]")
+ sel.click("Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ self.assertEqual('Add the cluster "testCluster" to the Luci management interface?' , sel.get_confirmation())
+ #sel.click("link=testCluster")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ # Validation - verify that the newly created cluster shows up in the cluster list
+ sel.click("link=homebase")
+ sel.wait_for_page_to_load("30000")
+ sel.click("link=Manage Systems")
+ sel.wait_for_page_to_load("30000")
+ self.assertTrue (sel.is_text_present('testCluster'))
+ self.assertTrue (sel.is_element_present("name=__CLUSTER:testCluster"))
+
+ # Delete the cluster - note that this only deletes the reference to the cluster
+ # in the luci web app - need to build a way to delete /etc/cluster/cluster.conf
+ # and stop cman service on cluster nodes - TODO - see bug #
+ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=213076
+ print 'Delete cluster: testCluster'
+ sel.click("name=__CLUSTER:testCluster")
+ sel.click("document.adminform.Submit")
+ sel.wait_for_page_to_load("30000")
+ self.assertEqual("Do you really want to remove the following managed systems:\nClusters:\n-testCluster", sel.get_confirmation())
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.assertTrue (sel.is_text_present('Removed cluster "testCluster" successfully'))
+
+ # Delete the storage systems created when the cluster was created
+ self.deleteStorageSystems(sel, CONGA_CLUSTER_SYSTEMS)
+
+ def tearDown(self):
+ """Logout and stop Selenium session"""
+ sel = self.selenium
+ self.selenium.click("link=Log out")
+ self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ self.selenium.stop()
+ self.assertEqual([], self.verificationErrors)
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(congaDemoTests('test_congaStorage'))
+ suite.addTest(congaDemoTests('test_congaUsers'))
+ suite.addTest(congaDemoTests('test_congaCluster'))
+ return suite
+
+if __name__ == "__main__":
+ #unittest.main()
+ unittest.TextTestRunner(verbosity=2).run(suite())
/cvs/cluster/conga/luci/test/conga_Helpers.py,v --> standard output
revision 1.1
--- conga/luci/test/conga_Helpers.py
+++ - 2006-12-01 19:57:53.183317000 +0000
@@ -0,0 +1,83 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+# MA 02139, USA.
+
+'''
+Script name: conga_Helpers.py
+Creation date: Dec 2006
+Purpose: Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+ with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary: Common routines, global variables
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from selenium import selenium
+import unittest, time, re
+
+#class congaHelpers(unittest.TestCase):
+
+ # Define data to support tests - global for now
+
+CONGA_ADMIN_USERNAME = 'admin'
+CONGA_ADMIN_PASSWORD = 'password'
+CONGA_SERVER = "http://tng3-5.lab.msp.redhat.com:8080"
+PAGE_DISPLAY_DELAY = "30000"
+
+# 20061130 - Node tng3-1 isn't booting, node tng3-4 is having some problems too
+
+#CONGA_STORAGE_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password',
+# 'tng3-2.lab.msp.redhat.com':'password',
+# 'tng3-3.lab.msp.redhat.com':'password',
+# 'tng3-4.lab.msp.redhat.com':'password',
+# 'tng3-5.lab.msp.redhat.com':'password'}
+
+CONGA_STORAGE_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password',
+ 'tng3-3.lab.msp.redhat.com':'password',
+ 'tng3-5.lab.msp.redhat.com':'password'}
+
+#CONGA_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password',
+# 'tng3-2.lab.msp.redhat.com':'password',
+# 'tng3-3.lab.msp.redhat.com':'password',
+# 'tng3-4.lab.msp.redhat.com':'password'}
+
+CONGA_CLUSTER_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password',
+ 'tng3-3.lab.msp.redhat.com':'password',
+ 'tng3-4.lab.msp.redhat.com':'password'}
+
+CONGA_USERS = {'user1':'user1_password',
+ 'user2':'user2_password',
+ 'user3':'user3_password',
+ 'user4':'user4_password',
+ 'user5':'user5_password',
+ 'user6':'user6_password',
+ 'user7':'user7_password',
+ 'user8':'user8_password',
+ 'user9':'user9_password',
+ 'user10':'user10_password'}
+
+CONGA_USERS_SYSTEMS = {'user1':'tng3-1.lab.msp.redhat.com',
+ 'user2':'tng3-1.lab.msp.redhat.com',
+ 'user3':'tng3-1.lab.msp.redhat.com',
+ 'user4':'tng3-1.lab.msp.redhat.com',
+ 'user5':'tng3-1.lab.msp.redhat.com',
+ 'user6':'tng3-1.lab.msp.redhat.com',
+ 'user7':'tng3-1.lab.msp.redhat.com',
+ 'user8':'tng3-1.lab.msp.redhat.com',
+ 'user9':'tng3-1.lab.msp.redhat.com',
+ 'user10':'tng3-1.lab.msp.redhat.com'}
/cvs/cluster/conga/luci/test/conga_suite.py,v --> standard output
revision 1.1
--- conga/luci/test/conga_suite.py
+++ - 2006-12-01 19:57:53.296094000 +0000
@@ -0,0 +1,66 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+# MA 02139, USA.
+
+'''
+Script name: conga_suite.py
+Creation date: Dec 2006
+Purpose: Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+ with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary: Simple, demo/prototype test for Conga
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+# Import the test suites
+import unittest
+import congaDemoTests
+
+# Tests planned - not yet complete:
+# CGA-0160_Add_User.py
+# CGA-0170_Online_Documenation_Portlet.py
+# CGA-0180_Event_Portlet.py
+# CGA-0200_Create_cluster.py
+# CGA-0210_Add_cluster_to_Administer.py
+# CGA-0220_Add_node_to_cluster.py
+# CGA-0300_Initialize_Disk_or_Partition.py
+# CGA-0310_Create_Volume_Group.py
+# CGA-0311_Activate_Volume_Group.py
+# CGA-0312_Deactivate_Volume_Group.py
+# CGA-0313_Remove_Volume_Group.py
+# CGA-0314_Add_Physical_Volume.py
+# CGA-0315_Remove_Physical_Volume.py
+# CGA-0320_Create_Logical_Volume.py
+# CGA-0321_Remove_Logical_Volume.py
+# CGA-0322_Extend_Logical_Volume.py
+# CGA-0323_Reduce_Logical_Volume.py
+# CGA-0330_Migrate_Data_off_Physical_Volume.py
+# CGA-0331_Take_Snapshot_Volume.py
+# CGA-0340_Set_logging_Params.py
+# CGA-0341_Block_Device_Params.py
+# CGA-0342_Backup_Archive_Params.py
+
+# Define the suite elements
+congaDemoSuite = congaDemoTests.suite()
+
+# Assemble the suite
+suite = unittest.TestSuite()
+suite.addTest(congaDemoSuite)
+
+# Run the test suite
+unittest.TextTestRunner(verbosity=2).run(suite)
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...
@ 2006-12-13 20:13 ldimaggi
0 siblings, 0 replies; 4+ messages in thread
From: ldimaggi @ 2006-12-13 20:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2006-12-13 20:13:33
Modified files:
luci/test : congaDemoTests.py conga_Helpers.py
conga_suite.py
Log message:
Added cluster test to suite file.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
--- conga/luci/test/congaDemoTests.py 2006/12/06 18:58:09 1.5
+++ conga/luci/test/congaDemoTests.py 2006/12/13 20:13:33 1.6
@@ -160,7 +160,7 @@
suite = unittest.TestSuite()
suite.addTest(congaDemoTests('test_congaStorage'))
suite.addTest(congaDemoTests('test_congaUsers'))
- #suite.addTest(congaDemoTests('test_congaCluster'))
+ suite.addTest(congaDemoTests('test_congaCluster'))
return suite
if __name__ == "__main__":
--- conga/luci/test/conga_Helpers.py 2006/12/11 21:37:22 1.7
+++ conga/luci/test/conga_Helpers.py 2006/12/13 20:13:33 1.8
@@ -44,7 +44,7 @@
CONGA_STORAGE_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password',
# 'tng3-2.lab.msp.redhat.com':'password',
'tng3-3.lab.msp.redhat.com':'password',
- 'tng3-4.lab.msp.redhat.com':'password',
+# 'tng3-4.lab.msp.redhat.com':'password',
'tng3-5.lab.msp.redhat.com':'password'}
#CONGA_STORAGE_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password',
@@ -71,14 +71,14 @@
'user10':'user10_password'}
CONGA_USERS_SYSTEMS = {'user1':'tng3-1.lab.msp.redhat.com',
- 'user2':'tng3-2.lab.msp.redhat.com',
+# 'user2':'tng3-2.lab.msp.redhat.com',
'user3':'tng3-3.lab.msp.redhat.com',
- 'user4':'tng3-4.lab.msp.redhat.com',
+# 'user4':'tng3-4.lab.msp.redhat.com',
'user5':'tng3-5.lab.msp.redhat.com',
'user6':'tng3-1.lab.msp.redhat.com',
- 'user7':'tng3-2.lab.msp.redhat.com',
+# 'user7':'tng3-2.lab.msp.redhat.com',
'user8':'tng3-3.lab.msp.redhat.com',
- 'user9':'tng3-4.lab.msp.redhat.com',
+# 'user9':'tng3-4.lab.msp.redhat.com',
'user10':'tng3-5.lab.msp.redhat.com'}
# Data used to verify the on-line help contents. The Dictionary contains
--- conga/luci/test/conga_suite.py 2006/12/11 21:37:22 1.5
+++ conga/luci/test/conga_suite.py 2006/12/13 20:13:33 1.6
@@ -31,7 +31,8 @@
import unittest
import congaDemoTests
import CGA_0160_Add_User
-import GA_0170_Online_Documentation_Portlet
+import CGA_0170_Online_Documentation_Portlet
+import CGA_0200_Create_cluster
# Tests planned - all not yet complete:
# CGA-0160_Add_User.py
@@ -61,12 +62,14 @@
congaDemoSuite = congaDemoTests.suite()
CGA_0160_Add_UserSuite = CGA_0160_Add_User.suite()
CGA_0170_Online_Documentation_Portlet_Suite = GA_0170_Online_Documentation_Portlet.suite()
+CGA_0200_Create_cluster_Suite = CGA_0200_Create_cluster.suite()
# Assemble the suite
suite = unittest.TestSuite()
-#suite.addTest(congaDemoSuite)
+suite.addTest(congaDemoSuite)
suite.addTest(CGA_0160_Add_UserSuite)
-#suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
+suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
+suite.addTest(CGA_0200_Create_cluster_Suite)
# Run the test suite
unittest.TextTestRunner(verbosity=2).run(suite)
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...
@ 2006-12-14 2:12 ldimaggi
0 siblings, 0 replies; 4+ messages in thread
From: ldimaggi @ 2006-12-14 2:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2006-12-14 02:12:42
Modified files:
luci/test : congaDemoTests.py conga_Helpers.py
Added files:
luci/test : loggerObject.py
Log message:
Started to add some basic logging.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/loggerObject.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.8&r2=1.9
/cvs/cluster/conga/luci/test/loggerObject.py,v --> standard output
revision 1.1
--- conga/luci/test/loggerObject.py
+++ - 2006-12-14 02:12:42.345517000 +0000
@@ -0,0 +1,22 @@
+class loggerObject:
+ theLogger = 'null'
+ theHandler = 'null'
+
+ # constructor - not sure if we want this
+ # def __init__(self, value):
+ # self.name = value
+
+ # getters and setters methods
+ def setLogger( self, value ):
+ self.theLogger = value
+
+ def setHandler( self, value ):
+ self.theHandler = value
+
+ def getLogger( self ):
+ return self.theLogger
+
+ def getHandler( self ):
+ return self.theHandler
+
+
--- conga/luci/test/congaDemoTests.py 2006/12/13 20:13:33 1.6
+++ conga/luci/test/congaDemoTests.py 2006/12/14 02:12:41 1.7
@@ -30,16 +30,28 @@
from conga_Helpers import *
from selenium import selenium
import unittest, time, re
+import logging
+from loggerObject import loggerObject
class congaDemoTests(unittest.TestCase):
def setUp(self):
+
+ self.testName = "congaDemoTests"
+
"""Establish connection to selenium server, login to luci """
self.verificationErrors = []
self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
def test_congaStorage(self):
"""Test to create and delete storage systems"""
+
+ # Set up logging
+ self.testName = "congaDemoTests.test_congaStorage"
+ self.theloggerObject = setupLogger (self.testName)
+ self.logger = self.theloggerObject.getLogger()
+ self.logger.info('Starting test case ' + self.testName)
+
sel = self.selenium
# Create the storage systems
@@ -63,8 +75,23 @@
sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+ self.logger.info('Ending test case test_congaStorage')
+ closeLogger (self.theloggerObject)
+
def test_congaUsers(self):
"""Test to create and delete conga users"""
+
+ self.testName = "congaDemoTests.test_congaUsers"
+ self.theloggerObject = setupLogger (self.testName)
+ self.logger = self.theloggerObject.getLogger()
+ self.logger.info('Starting test case ' + self.testName)
+
+ # Set up logging
+ self.testName = "congaDemoTests.test_congaUsers"
+ self.theloggerObject = setupLogger (self.testName)
+ self.logger = self.theloggerObject.getLogger()
+ self.logger.info('Starting test case ' + self.testName)
+
sel = self.selenium
# Create the users
@@ -87,12 +114,25 @@
sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
self.assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))
+ self.logger.info('Ending test case test_congaUsers')
+ closeLogger (self.theloggerObject)
+
def test_congaCluster(self):
"""Test to create and delete a cluster"""
- # TODO - Need to generalize this function - but as of 20061129, note tng3-1
- # is not responding to the creation of a cluster
+ self.testName = "congaDemoTests.test_congaCluster"
+ self.theloggerObject = setupLogger (self.testName)
+ self.logger = self.theloggerObject.getLogger()
+ self.logger.info('Starting test case ' + self.testName)
+
+ # Set up logging
+ self.testName = "congaDemoTests.test_congaCluster"
+ self.theloggerObject = setupLogger (self.testName)
+ self.logger = self.theloggerObject.getLogger()
+ self.logger.info('Starting test case ' + self.testName)
+
sel = self.selenium
+
sel.open("/luci/homebase")
sel.click("link=cluster")
sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
@@ -151,6 +191,9 @@
sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+ self.logger.info('Ending test case test_congaCluster')
+ closeLogger (self.theloggerObject)
+
def tearDown(self):
"""Logout and stop Selenium session"""
logout(self.selenium)
@@ -160,7 +203,7 @@
suite = unittest.TestSuite()
suite.addTest(congaDemoTests('test_congaStorage'))
suite.addTest(congaDemoTests('test_congaUsers'))
- suite.addTest(congaDemoTests('test_congaCluster'))
+ #suite.addTest(congaDemoTests('test_congaCluster'))
return suite
if __name__ == "__main__":
--- conga/luci/test/conga_Helpers.py 2006/12/13 20:13:33 1.8
+++ conga/luci/test/conga_Helpers.py 2006/12/14 02:12:41 1.9
@@ -29,10 +29,12 @@
from selenium import selenium
import unittest, time, re
+import logging
+import logging.handlers
+
+from loggerObject import loggerObject
-#class congaHelpers(unittest.TestCase):
-
- # Define data to support tests - global for now
+# Define data to support tests - global for now
CONGA_ADMIN_USERNAME = 'admin'
CONGA_ADMIN_PASSWORD = 'password'
@@ -158,4 +160,33 @@
sel.click("link=Log out")
sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
sel.stop()
-
\ No newline at end of file
+
+def setupLogger (testName):
+ """Create logger - use this message format: 2003-07-08 16:49:45,896 ERROR We have a problem"""
+ logger = logging.getLogger('congaTestLogger')
+
+ # Why use a RotatingFileHandler? To keep track of previous test results
+ hdlr = logging.handlers.RotatingFileHandler('/var/tmp/' + testName + '.log', 'w', 1024000, 10)
+ #hdlr = logging.FileHandler('/var/tmp/' + testName + '.log', 'w')
+
+ formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+ hdlr.setFormatter(formatter)
+ logger.addHandler(hdlr)
+ #logger.setLevel(logging.WARNING)
+ logger.setLevel(logging.DEBUG)
+
+ theloggerObject = loggerObject()
+ theloggerObject.setLogger(logger)
+ theloggerObject.setHandler(hdlr)
+
+ return theloggerObject
+
+def closeLogger (theloggerObject):
+ """Close the logger - roll the logs"""
+ theLogger = theloggerObject.getLogger()
+ theHandler = theloggerObject.getHandler()
+
+ theLogger.removeHandler(theHandler)
+ theHandler.close()
+ theHandler.doRollover()
+
^ permalink raw reply [flat|nested] 4+ messages in thread* [Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...
@ 2007-02-23 21:32 ldimaggi
0 siblings, 0 replies; 4+ messages in thread
From: ldimaggi @ 2007-02-23 21:32 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2007-02-23 21:32:52
Modified files:
luci/test : congaDemoTests.py conga_Helpers.py
Added files:
luci/test : cleaner.py
Log message:
Changes to sych up with GUI - cleaner.py = first cut at tool to ensure that all test-created Conga assets are deleted
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/cleaner.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.13&r2=1.14
/cvs/cluster/conga/luci/test/cleaner.py,v --> standard output
revision 1.1
--- conga/luci/test/cleaner.py
+++ - 2007-02-23 21:32:52.473689000 +0000
@@ -0,0 +1,102 @@
+#! /usr/bin/env python
+
+'''
+Script name: cleaner.py
+Creation date: Feb 2007
+Purpose: Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+ with Selenium RC (remote control) 0.9.0
+Summary: Script to clean up all Conga test suite related artifacts - this script will be
+ before Conga use case tests
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+import time
+import logging
+from loggerObject import loggerObject
+
+class cleaner:
+
+ def cleanup(self):
+
+ selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+ sel = selenium
+ theloggerObject = setupLogger (CONGA_DEBUG_LOG)
+ logger = theloggerObject.getLogger()
+
+ # Step 1 of 3 - Delete all clusters
+ sel.click("link=homebase")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.click("link=cluster")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+ #####################
+
+
+ junk = sel.get_text("cluster_action")
+ print junk
+ print sel.get_body_text()
+ print '============================='
+
+
+ tempBool = sel.is_element_present("cluster_action")
+ if (tempBool == True):
+ sel.select("cluster_action", "label=Delete this cluster")
+ sel.click("//input[@value='Go']")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ time.sleep(300)
+ else:
+ print 'No cluster to delete'
+
+ sel.click("link=homebase")
+
+ # Create the users
+# for userName in CONGA_USERS.keys():
+# createUser (sel, userName, CONGA_USERS[userName], logger)
+# # Validation - verify that the success message was displayed for each user
+# assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+# sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+# assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully'))
+#
+###############################################################################
+ # Delete the users
+ for userName in CONGA_USERS.keys():
+ deleteUser (sel, userName, logger)
+ # Validation - verify that the success message was displayed for each user
+ try:
+ assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))
+ except:
+ print 'Unable to delete user: ' + userName + ' does it exist?'
+
+
+# # Create the storage systems
+# for systemName in CONGA_STORAGE_SYSTEMS:
+# createStorageSystem(sel, systemName, CONGA_STORAGE_SYSTEMS[systemName], logger)
+# # Validation - verify that the success message was displayed for each storage system
+# assertEqual("Do you really want to add the following Storage Systems:\n" + systemName, sel.get_confirmation())
+# sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+# assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))
+#
+
+ tempBool = sel.is_element_present("link=Manage Systems")
+ if (tempBool == True):
+ # Delete the storage systems
+ for systemName in CONGA_STORAGE_SYSTEMS:
+ deleteStorageSystem(sel, systemName, logger)
+ try:
+ # Validation - verify that the success message was displayed for each storage system
+ assertEqual("Do you really want to remove the following managed systems:\nStorage Systems:\n-" + systemName, sel.get_confirmation())
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+ except:
+ print 'Unable to delete system: ' + systemName + ' does it exist?'
+ else:
+ print 'No systems to delete'
+
+ sel = selenium.stop()
+
\ No newline at end of file
--- conga/luci/test/congaDemoTests.py 2007/02/20 20:18:25 1.10
+++ conga/luci/test/congaDemoTests.py 2007/02/23 21:32:52 1.11
@@ -32,11 +32,15 @@
import unittest, time, re
import logging
from loggerObject import loggerObject
+from cleaner import *
class congaDemoTests(unittest.TestCase):
def setUp(self):
+ temp = cleaner()
+ temp.cleanup()
+
# Set up logging
self.theloggerObject = setupLogger (CONGA_DEBUG_LOG)
self.logger = self.theloggerObject.getLogger()
@@ -109,7 +113,7 @@
def suite():
suite = unittest.TestSuite()
- suite.addTest(congaDemoTests('test_congaStorage'))
+# suite.addTest(congaDemoTests('test_congaStorage'))
suite.addTest(congaDemoTests('test_congaUsers'))
return suite
--- conga/luci/test/conga_Helpers.py 2007/02/20 20:18:25 1.13
+++ conga/luci/test/conga_Helpers.py 2007/02/23 21:32:52 1.14
@@ -31,7 +31,6 @@
import unittest, time, re
import logging
import logging.handlers
-
from loggerObject import loggerObject
# Define data to support tests - global for now
@@ -108,12 +107,15 @@
def deleteStorageSystem(sel, systemName, theLogger):
"""Common code to delete storage systems"""
- theLogger.debug('Delete storage system: ' + systemName)
- # Need to handle artifacts names - underscores in strings, not periods
- systemNameMod = systemName.replace('.', '_')
- sel.click("name=__SYSTEM:" + systemNameMod)
- sel.click("document.adminform.Submit")
- sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ try:
+ theLogger.debug('Delete storage system: ' + systemName)
+ # Need to handle artifacts names - underscores in strings, not periods
+ systemNameMod = systemName.replace('.', '_')
+ sel.click("name=__SYSTEM:" + systemNameMod)
+ sel.click("document.adminform.Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ except:
+ print 'Unable to delete system: ' + systemName
def createUser(sel, userName, userPassword, theLogger):
"""Common code to create users"""
@@ -128,12 +130,15 @@
def deleteUser(sel, userName, theLogger):
"""Common code to delete users"""
- theLogger.debug('Delete user: ' + userName)
- sel.click("link=Delete a User")
- sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
- sel.select("deluserId", "label=" + userName)
- sel.click("Submit")
- sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ try:
+ theLogger.debug('Delete user: ' + userName)
+ sel.click("link=Delete a User")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ sel.select("deluserId", "label=" + userName)
+ sel.click("Submit")
+ sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ except:
+ print 'Unable to delete user: ' + userName
def login(userName, password):
"""Establish connection to selenium server, login to luci """
@@ -185,4 +190,4 @@
theLogger.removeHandler(theHandler)
theHandler.close()
# theHandler.doRollover()
-
\ No newline at end of file
+
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-23 21:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-01 19:57 [Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ldimaggi
-- strict thread matches above, loose matches on Subject: below --
2006-12-13 20:13 ldimaggi
2006-12-14 2:12 ldimaggi
2007-02-23 21:32 ldimaggi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).