import unittest
from ddt import data, unpack
from selenium import webdriver
import ddt
@ddt
class searchddt(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.driver.implicitly_wait(30)
self.driver.maximize_window()
self.driver.get('https://magento.com/products/magento-commerce')
@data(("phones",2))
@unpack
def test_search(self,search_val,expected_count):
self.searchfield=self.driver.find_element_by_xpath("//I[@aria-hidden='true']/self::I")
self.searchfield.clear()
self.searchfield.send_keys(search_val)
self.searchfield.submit()
def tearDown(self):
self.driver.quit()
if __name__=='__main__':
unittest.main(verbosity=2)
FAILED (errors=1)
getting error in importing ddt and code is not executing
Error Traceback (most recent call last): File
"C:\Python27\lib\unittest\case.py"
, line329
, in run testMethod() File"C:\Python27\lib\unittest\loader.py"
, line 32, in testFailure raise exception ImportError: Failed to import test module: ddt class searchddt(unittest.TestCase): TypeError: 'module' object is not callableProcess finished with exit code 1