Add create log file in Services.py Policies.py Views.py and User.py tests files

This commit is contained in:
cesar991 2017-01-11 17:29:40 +01:00
parent 59bd635b3a
commit 2ccb1685a4
4 changed files with 43 additions and 6 deletions

View File

@ -11,7 +11,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 logging
class Policies(PandoraWebDriverTestCase):
@ -22,6 +24,7 @@ class Policies(PandoraWebDriverTestCase):
policy_name = gen_random_string(6)
network_server_module_name = gen_random_string(6)
logging.basicConfig(filename="Policies.log", level=logging.INFO, filemode='w')
@is_enterprise
def test_A_create_policy(self):
@ -40,7 +43,8 @@ class Policies(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//a[contains(.,"'+self.policy_name+'")]')
self.assertIsInstance(element,WebElement)
logging.info("test_A_create_policy is correct")
@is_enterprise
def test_B_add_network_server_module_to_policy(self):
@ -54,7 +58,8 @@ class Policies(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td[contains(.,"uccessfully")]')
self.assertIsInstance(element,WebElement)
logging.info("test_B_add_network_server_module_to_policy is correct")
@is_enterprise
def test_C_add_collection_to_policy(self):
@ -77,7 +82,7 @@ class Policies(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td[contains(.,"Correct: add the collection in the policy")]')
self.assertIsInstance(element,WebElement)
logging.info("test_C_add_collection_to_policy is correct")
@is_enterprise
def test_D_Apply_policy_to_agents(self):
@ -128,6 +133,8 @@ class Policies(PandoraWebDriverTestCase):
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]')
self.assertIsInstance(module,WebElement)
logging.info("test_D_Apply_policy_to_agents is correct")
@is_enterprise
def test_E_Apply_policy_to_agents_with_spaces(self):
@ -181,6 +188,7 @@ class Policies(PandoraWebDriverTestCase):
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
self.assertIsInstance(module,WebElement)
logging.info("test_E_Apply_policy_to_agents_with_spaces is correct")
if __name__ == "__main__":
unittest2.main()

View File

@ -15,6 +15,7 @@ from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement
import unittest2, time, re
import logging
class SimpleService(PandoraWebDriverTestCase):
@ -31,6 +32,7 @@ class SimpleService(PandoraWebDriverTestCase):
module_normal_2_name = gen_random_string(6)
module_warning_1_name = gen_random_string(6)
logging.basicConfig(filename="Service.log", level=logging.INFO, filemode='w')
@is_enterprise
def test_A_simple_service(self):
@ -106,6 +108,8 @@ class SimpleService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
self.assertIsInstance(element,WebElement)
logging.info("test_A_simple_service is correct")
@is_enterprise
def test_B_simple_service(self):
@ -136,6 +140,8 @@ class SimpleService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
self.assertIsInstance(element,WebElement)
logging.info("test_B_simple_service is correct")
@is_enterprise
def test_C_simple_service(self):
@ -166,7 +172,8 @@ class SimpleService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
self.assertIsInstance(element,WebElement)
logging.info("test_C_simple_service is correct")
class ManualService(PandoraWebDriverTestCase):
test_name = u'Auto service tests'
@ -224,6 +231,9 @@ class ManualService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
self.assertIsInstance(element,WebElement)
logging.info("test_A_manual_service_ok is correct")
@is_enterprise
def test_B_auto_service_critical(self):
@ -249,6 +259,8 @@ class ManualService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
self.assertIsInstance(element,WebElement)
logging.info("test_B_auto_service_critical is correct")
@is_enterprise
def test_C_auto_service_warning(self):
@ -273,6 +285,8 @@ class ManualService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
self.assertIsInstance(element,WebElement)
logging.info("test_C_auto_service_warning is correct")
class serviceInsideService(PandoraWebDriverTestCase):
test_name = u'Auto service tests'
@ -341,6 +355,8 @@ class serviceInsideService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
self.assertIsInstance(element,WebElement)
logging.info("test_A_service_ok is correct")
@is_enterprise
def test_B_service_critical(self):
@ -372,6 +388,8 @@ class serviceInsideService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
self.assertIsInstance(element,WebElement)
logging.info("test_B_service_critical is correct")
@is_enterprise
def test_C_service_warning(self):
@ -404,6 +422,6 @@ class serviceInsideService(PandoraWebDriverTestCase):
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
self.assertIsInstance(element,WebElement)
logging.info("test_C_service_warning is correct")
if __name__ == "__main__":
unittest2.main()

View File

@ -10,6 +10,7 @@ from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.remote.webelement import WebElement
import unittest2, time, re
import logging
class Users(PandoraWebDriverTestCase):
@ -23,6 +24,8 @@ class Users(PandoraWebDriverTestCase):
Modify home screen, and check that change is correct. Return this change
"""
logging.basicConfig(filename="Users.log", level=logging.INFO, filemode='w')
driver = self.driver
self.login()
detect_and_pass_all_wizards(driver)
@ -39,7 +42,8 @@ class Users(PandoraWebDriverTestCase):
activate_home_screen(driver,"Default")
logging.info("test_A_home_screen is correct")
if __name__ == "__main__":
unittest2.main()

View File

@ -8,7 +8,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 logging
class viewAppear(PandoraWebDriverTestCase):
@ -23,6 +25,9 @@ class viewAppear(PandoraWebDriverTestCase):
"""
"""
logging.basicConfig(filename="Views.log", level=logging.INFO, filemode='w')
driver = self.driver
self.login()
detect_and_pass_all_wizards(driver)
@ -312,6 +317,8 @@ class viewAppear(PandoraWebDriverTestCase):
self.assertEqual("The last version of package installed is:" in driver.page_source,True)
click_menu_element(driver,"Update Manager options")
logging.info("test_views_appear is correct")
"""
if __name__ == "__main__":