Add create log file in Network_components.py Netwrok_server.py and Planned_downtime.py

This commit is contained in:
cesar991 2017-01-10 17:59:54 +01:00
parent 19a06f5828
commit 92f139d30d
3 changed files with 30 additions and 4 deletions

View File

@ -14,7 +14,7 @@ from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest2, time, re import unittest2, time, re
import logging
class Network_components(PandoraWebDriverTestCase): class Network_components(PandoraWebDriverTestCase):
@ -28,7 +28,9 @@ class Network_components(PandoraWebDriverTestCase):
u""" u"""
Create and search new network component module Create and search new network component module
""" """
logging.basicConfig(filename="Network_components.log", level=logging.INFO, filemode='w')
driver = self.driver driver = self.driver
self.login() self.login()
detect_and_pass_all_wizards(driver) detect_and_pass_all_wizards(driver)
@ -72,6 +74,7 @@ class Network_components(PandoraWebDriverTestCase):
self.assertEqual(network_component_name in driver.page_source,True) self.assertEqual(network_component_name in driver.page_source,True)
logging.info("test_A_create_network_component is correct")
def test_B_create_plugin_component(self): def test_B_create_plugin_component(self):
@ -120,6 +123,8 @@ class Network_components(PandoraWebDriverTestCase):
self.assertEqual(plugin_component_name in driver.page_source,True) self.assertEqual(plugin_component_name in driver.page_source,True)
logging.info("test_B_create_plugin_component is correct")
def test_C_create_wmi_component(self): def test_C_create_wmi_component(self):
u""" u"""
@ -166,7 +171,8 @@ class Network_components(PandoraWebDriverTestCase):
search_module (driver,agent_name,plugin_component_name,go_to_module=False) search_module (driver,agent_name,plugin_component_name,go_to_module=False)
self.assertEqual(plugin_component_name in driver.page_source,True) self.assertEqual(plugin_component_name in driver.page_source,True)
logging.info("test_C_create_wmi_component is correct")
def test_D_plugin_component_with_parameters(self): def test_D_plugin_component_with_parameters(self):
u""" u"""
@ -216,6 +222,7 @@ class Network_components(PandoraWebDriverTestCase):
self.assertEqual(plugin_component_name in driver.page_source,True) self.assertEqual(plugin_component_name in driver.page_source,True)
logging.info("test_D_plugin_component_with_parameters is correct")
if __name__ == "__main__": if __name__ == "__main__":
unittest2.main() unittest2.main()

View File

@ -10,6 +10,7 @@ from selenium.common.exceptions import StaleElementReferenceException
from include.module_functions import * from include.module_functions import *
import unittest2, time, re import unittest2, time, re
import logging
class Network_server_module(PandoraWebDriverTestCase): class Network_server_module(PandoraWebDriverTestCase):
@ -23,6 +24,8 @@ class Network_server_module(PandoraWebDriverTestCase):
Creates a simple ICMP check against localhost and checks the result is 1 Creates a simple ICMP check against localhost and checks the result is 1
""" """
logging.basicConfig(filename="Network_server_module.log", level=logging.INFO, filemode='w')
driver = self.driver driver = self.driver
self.login() self.login()
detect_and_pass_all_wizards(driver) detect_and_pass_all_wizards(driver)
@ -53,6 +56,8 @@ class Network_server_module(PandoraWebDriverTestCase):
self.verificationErrors.append(str(e)) self.verificationErrors.append(str(e))
break break
logging.info("test_create_ICMP_module is correct")
if __name__ == "__main__": if __name__ == "__main__":
unittest2.main() unittest2.main()

View File

@ -13,8 +13,9 @@ from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.remote.webelement import WebElement
import unittest2, time, re, datetime
import unittest2, time, re, datetime
import logging
class Planned_downtime(PandoraWebDriverTestCase): class Planned_downtime(PandoraWebDriverTestCase):
@ -27,6 +28,9 @@ class Planned_downtime(PandoraWebDriverTestCase):
u""" u"""
Create and search planned downtime quiet Create and search planned downtime quiet
""" """
logging.basicConfig(filename="Planned_downtime.log", level=logging.INFO, filemode='w')
driver = self.driver driver = self.driver
self.login() self.login()
detect_and_pass_all_wizards(driver) detect_and_pass_all_wizards(driver)
@ -41,6 +45,8 @@ class Planned_downtime(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//img[@data-title="Running"]') element = driver.find_element_by_xpath('//img[@data-title="Running"]')
self.assertIsInstance(element,WebElement) self.assertIsInstance(element,WebElement)
logging.info("atest_A_create_planned_downtime_Quiet is correct")
def atest_B_create_planned_downtime_disabled_agents(self): def atest_B_create_planned_downtime_disabled_agents(self):
@ -59,6 +65,8 @@ class Planned_downtime(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//img[@data-title="Running"]') element = driver.find_element_by_xpath('//img[@data-title="Running"]')
self.assertIsInstance(element,WebElement) self.assertIsInstance(element,WebElement)
logging.info("atest_B_create_planned_downtime_disabled_agents is correct")
def atest_C_create_planned_downtime_disabled_only_alerts(self): def atest_C_create_planned_downtime_disabled_only_alerts(self):
@ -78,6 +86,8 @@ class Planned_downtime(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//img[@data-title="Running"]') element = driver.find_element_by_xpath('//img[@data-title="Running"]')
self.assertIsInstance(element,WebElement) self.assertIsInstance(element,WebElement)
logging.info("atest_C_create_planned_downtime_disabled_only_alerts is correct")
def atest_D_delete_planned_downtime(self): def atest_D_delete_planned_downtime(self):
@ -89,6 +99,8 @@ class Planned_downtime(PandoraWebDriverTestCase):
delete_planned_downtime(driver,planned_name) delete_planned_downtime(driver,planned_name)
logging.info("atest_D_delete_planned_downtime is correct")
def atest_E_quiet_functionality(self): def atest_E_quiet_functionality(self):
driver=self.driver driver=self.driver
@ -161,5 +173,7 @@ class Planned_downtime(PandoraWebDriverTestCase):
self.assertNotEqual(event_who_should_be_present_b,[]) self.assertNotEqual(event_who_should_be_present_b,[])
logging.info("atest_E_quiet_functionality is correct")
if __name__ == "__main__": if __name__ == "__main__":
unittest2.main() unittest2.main()