From 037478fd534c05562901c3af13344336336bf3aa Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 9 Jan 2017 14:45:32 +0100 Subject: [PATCH] Add log file in Collections.py and Bulk_operations.py --- tests/console/Alerts.py | 2 +- tests/console/Bulk_operations.py | 16 +++++++++++++++- tests/console/Collections.py | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/console/Alerts.py b/tests/console/Alerts.py index 5898f8d234..d1106f6586 100644 --- a/tests/console/Alerts.py +++ b/tests/console/Alerts.py @@ -72,7 +72,7 @@ class Alerts (PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]') self.assertIsInstance(element,WebElement) - logging.info("test_B_create_new_action_command") + logging.info("test_B_create_new_action_command is correct") def test_C_create_new_template(self): diff --git a/tests/console/Bulk_operations.py b/tests/console/Bulk_operations.py index 2d731e69e7..a539430444 100644 --- a/tests/console/Bulk_operations.py +++ b/tests/console/Bulk_operations.py @@ -14,6 +14,7 @@ from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement import unittest2, time, re +import logging class Bulk_operations(PandoraWebDriverTestCase): @@ -28,6 +29,8 @@ class Bulk_operations(PandoraWebDriverTestCase): Ticket Associated = 3831 """ + logging.basicConfig(filename="Bulk_operations.log", level=logging.INFO, filemode='w') + agent_name_1 = gen_random_string(6) agent_name_2 = gen_random_string(6) @@ -54,6 +57,8 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$") self.assertEqual(self.driver.find_element_by_xpath('//div[@id="main"]//td[contains(.,"Successfully deleted (2)")]').text,"Successfully deleted (2)") + logging.info("test_A_delete_agent_bulk_operations is correct") + def test_B_edit_agents_group_bulk_operations(self): u""" @@ -86,6 +91,8 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$") self.assertEqual(self.driver.find_element_by_xpath('//div[@id="main"]//td[contains(.,"Agents updated successfully(2)")]').text,"Agents updated successfully(2)") + logging.info("test_B_edit_agents_group_bulk_operations is correct") + def test_C_edit_agent_description_bulk_operation(self): u""" @@ -122,6 +129,8 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertEqual("test C edit description bulk operation" in driver.page_source,True) + logging.info("test_C_edit_agent_description_bulk_operation is correct") + def test_D_delete_modules_in_bulk(self): u""" @@ -169,6 +178,7 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertEqual(element,[]) + logging.info("test_D_delete_modules_in_bulk is correct") def test_E_edit_module_group_in_bulk(self): @@ -215,6 +225,7 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertEqual("Users" in driver.page_source,True) + logging.info("test_E_edit_module_group_in_bulk is correct") def test_F_edit_module_umbral_in_bulk(self): @@ -267,7 +278,7 @@ class Bulk_operations(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]') self.assertIsInstance(element,WebElement) - + logging.info("test_F_edit_module_umbral_in_bulk is correct") def test_G_edit_module_threshold_in_bulk(self): @@ -324,6 +335,8 @@ class Bulk_operations(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]') self.assertIsInstance(element,WebElement) + logging.info("test_G_edit_module_threshold_in_bulk is correct") + def test_H_copy_modules_in_bulk(self): u""" @@ -374,6 +387,7 @@ class Bulk_operations(PandoraWebDriverTestCase): self.assertEqual(module_name_1 in driver.page_source,True) + logging.info("test_H_copy_modules_in_bulk is correct") if __name__ == "__main__": unittest2.main() diff --git a/tests/console/Collections.py b/tests/console/Collections.py index 2b45e0827a..8a59dfcc0f 100644 --- a/tests/console/Collections.py +++ b/tests/console/Collections.py @@ -12,8 +12,9 @@ from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement -import unittest2, time, re +import unittest2, time, re +import logging class Collections(PandoraWebDriverTestCase): @@ -27,6 +28,8 @@ class Collections(PandoraWebDriverTestCase): @is_enterprise def test_A_create_collection(self): + logging.basicConfig(filename="Collections.log", level=logging.INFO, filemode='w') + driver = self.driver self.login() detect_and_pass_all_wizards(driver) @@ -38,6 +41,8 @@ class Collections(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,self.collection_name)]') self.assertIsInstance(element,WebElement) + logging.info("test_A_create_collection is correct") + @is_enterprise def test_B_edit_collection(self): @@ -50,6 +55,8 @@ class Collections(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,self.new_collection_name)]') self.assertIsInstance(element,WebElement) + logging.info("test_B_edit_collection is correct") + @is_enterprise def test_C_create_text_collection(self): @@ -60,6 +67,8 @@ class Collections(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,"file_collectionPAN11")]') self.assertIsInstance(element,WebElement) + logging.info("test_C_create_text_collection is correct") + @is_enterprise def test_D_directory_collection(self): @@ -70,6 +79,8 @@ class Collections(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,"directory_collectionPAN11")]') self.assertIsInstance(element,WebElement) + logging.info("test_D_directory_collection is correct") + @is_enterprise def test_E_delete_collection(self): @@ -81,5 +92,7 @@ class Collections(PandoraWebDriverTestCase): element = driver.find_elements_by_xpath('//a[contains(.,"'+self.new_collection_name+'")]') self.assertEqual(element,[]) + logging.info("test_E_delete_collection is correct") + if __name__ == "__main__": unittest2.main()