Python unit test how do I pass variable from one function to another -
how pass variable 1 function another? like:
def test_url(self): current_url = "xyz" def check_url(self): #call current_url here.
def get_url(self): current_url = 'xyz' return current_url def test_check_url(self): url = get_url() # write more lines
a better way this, overload setup()
function comes unittest. setup()
work of initializing variables , tests you.
class yourtestcase(unittest.testcase): def setup(self): self.current_url = 'xyz' def test_check_url(self): self.assertequal(self.current_url, 'xyz')
Comments
Post a Comment