conga/luci/test CGA_0200_Create_cluster.py con ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2006-12-14 20:01:40
Modified files:
luci/test : CGA_0200_Create_cluster.py congaDemoTests.py
conga_Helpers.py conga_suite.py loggerObject.py
Added files:
luci/test : CGA_0170_Online_Documentation_Portlet.py
Removed files:
luci/test : CGA_0170_Online_Documenation_Portlet.py
Log message:
Added a 2-layer logging model. Pyunit generated text is written to a log file, debug/info/etc. messages are written to a debug log file.
Also corrected the name of: CGA_0170_Online_Documentation_Portlet.py
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0170_Online_Documentation_Portlet.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/loggerObject.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0170_Online_Documenation_Portlet.py.diff?cvsroot=cluster&r1=1.2&r2=NONE
/cvs/cluster/conga/luci/test/CGA_0170_Online_Documentation_Portlet.py,v --> standard output revision 1.1
- renamed from luci/test/CGA_0170_Online_Documentation_Portlet.py +91 -0
@@ -0,0 +1,91 @@ +#! /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: GA_0170_Online_Documentation_Portlet.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 +Summary: Test for Conga use case CGA-0170 - verify the online user documentation + Regression test for: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=212991 +''' + +__author__ = 'Len DiMaggio <[email protected]>' + +from selenium import selenium +import unittest, time, re +from conga_Helpers import * +import time +import logging +from loggerObject import loggerObject + +class CGA_0170_Online_Documentation_Portlet (unittest.TestCase): + + def setUp(self): + + # Set up logging + self.theloggerObject = setupLogger (CONGA_DEBUG_LOG) + self.logger = self.theloggerObject.getLogger() + self.logger.info('-----------------------------------------------------------') + + """Establish connection to selenium server, login to luci """ + self.verificationErrors = [] + self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD) + + """Test to create and delete storage systems""" + sel = self.selenium + + def test_docs(self): + """Test to verify on-line Help docs""" + self.logger.info('Starting test case CGA_0170_Online_Documentation_Portlet.test_docs') + + sel = self.selenium + + # Access the on-line help + sel.click("link=help") + sel.wait_for_pop_up("Conga Help", "30000") + sel.select_window('Conga Help') + + # Grab all the text + theText = sel.get_html_source() + + # Validation - check the offsets for the items in the HELP list + for theItem in HELP_LIST: + self.logger.debug('Verify offset of help text "' + theItem + '" = ' + str(theText.index(theItem))) + self.assertEqual (theText.index(theItem), HELP_DICTIONARY[theItem]) + + # Select the main window + sel.select_window('null') + + self.logger.info('Ending test case CGA_0170_Online_Documentation_Portlet.test_docs') + + def tearDown(self): + """Logout and stop Selenium session""" + logout(self.selenium) + self.assertEqual([], self.verificationErrors) + closeLogger (self.theloggerObject) + +def suite(): + suite = unittest.TestSuite() + suite.addTest(CGA_0170_Online_Documentation_Portlet('test_docs')) + return suite + +if __name__ == "__main__": + #unittest.main() + unittest.TextTestRunner( verbosity=2 ).run( suite() )
luci/test/CGA_0200_Create_cluster.py +12 -2
@@ -34,6 +34,11 @@ class CGA_0200_Create_cluster(unittest.TestCase): def setUp(self): + # Set up logging + self.theloggerObject = setupLogger (CONGA_DEBUG_LOG) + self.logger = self.theloggerObject.getLogger() + self.logger.info('-----------------------------------------------------------') + """Establish connection to selenium server, login to luci """ self.verificationErrors = [] self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
@@ -41,6 +46,8 @@ def test_congaCluster(self): """Test to create and delete a cluster""" + self.logger.info('Starting test case CGA_0200_Create_cluster.test_congaCluster') + # 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
@@ -52,7 +59,7 @@ # Create the new "testCluster" cluster sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY) sel.type("clusterName", "testCluster") - print 'Create cluster: testCluster' + self.logger.debug('Create cluster: testCluster') # Add the nodes to the cluster # Needed to generalize statements like this:
@@ -86,7 +93,7 @@ # 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' + self.logger.debug('Delete cluster: testCluster') sel.click("name=__CLUSTER:testCluster") sel.click("document.adminform.Submit") sel.wait_for_page_to_load("30000")
@@ -102,10 +109,13 @@ 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 CGA_0200_Create_cluster.test_congaCluster') + def tearDown(self): """Logout and stop Selenium session""" logout(self.selenium) self.assertEqual([], self.verificationErrors) + closeLogger (self.theloggerObject) def suite(): suite = unittest.TestSuite()
luci/test/congaDemoTests.py +24 -45
143 lines not on this page · raw message
luci/test/conga_Helpers.py +19 -22
101 lines not on this page · raw message
luci/test/conga_suite.py +10 -4
@@ -30,6 +30,7 @@ # Import the test suites import unittest import congaDemoTests +from conga_Helpers import * import CGA_0160_Add_User import CGA_0170_Online_Documentation_Portlet import CGA_0200_Create_cluster
@@ -61,15 +62,20 @@ # Define the suite elements 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_0170_Online_Documentation_Portlet_Suite = CGA_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(CGA_0160_Add_UserSuite) +#suite.addTest(CGA_0160_Add_UserSuite) suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite) -suite.addTest(CGA_0200_Create_cluster_Suite) +#suite.addTest(CGA_0200_Create_cluster_Suite) # Run the test suite -unittest.TextTestRunner(verbosity=2).run(suite) +# unittest.TextTestRunner(verbosity=2).run(suite) + +# Write all pyunit-generated messages to a log file +output = open(CONGA_LOG, "w") +unittest.TextTestRunner(output).run(suite) +output.close()
luci/test/loggerObject.py +30 -2
@@ -1,3 +1,33 @@ +#! /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: loggerObject.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 object to let us get/set the logger and its handler +''' + +__author__ = 'Len DiMaggio <[email protected]>' + + class loggerObject: theLogger = 'null' theHandler = 'null'
@@ -18,5 +48,3 @@ def getHandler( self ): return self.theHandler - -