python - Nosetest and unittest.expectedFailures -
i testing website selenium, python , nosetests. works fine success tests, got problem on failure tests (i have never test python / selenium / nosetest ...). following test :
@unittest.expectedfailure def test_connection_failure(self): # fill username login self.driver.find_element_by_id('form_identifiant').send_keys(test_login) # send form self.driver.find_element_by_id('form_submit').click() # check landing url page_url = self.driver.current_url self.assertequal(page_url, page_home)
i testing simple case : when enter login, can't connect website. except failure when compare current page url , page should if login / password couple correct.
i got following message nosetests prompt :
[root@localhost appgestion]# nosetests connectiontests.py /usr/lib64/python2.7/unittest/case.py:380: runtimewarning: testresult has no addexpectedfailure method, reporting passes runtimewarning)
i don't understand error. found "addexpectedfailure" method on net didn't found how use it, put ... because test skipped nosetest actually.
any clues ?
the decorator nose
handle expected exception @raises(...)
:
http://nose.readthedocs.io/en/latest/testing_tools.html
but in case, use assertnotequal
without decorator:
def test_connection_failure(self): # fill username login self.driver.find_element_by_id('form_identifiant').send_keys(test_login) # send form self.driver.find_element_by_id('form_submit').click() # check landing url page_url = self.driver.current_url self.assertnotequal(page_url, page_home)
Comments
Post a Comment