I want to test an internal web application and I want the code (Selenium & Python) to be well-organized and clean. I have a question of what is the convetion of writing test functions, for example:
def test_access
accesing the web portal and checking if the page loads def test_login
acessing the web portal and checking if the page loads and then if login succeeds.
In the above example I have 2 functions and the test_login
function is test_access
function plus checking if login succeeds.
- In that case is it correct in test code to do something like this:
def test_access:
# do sth
def test login:
test_access()
#check if login succeeds
-
Or should be every test function be written without invoking the previous test function? Or is it correct to repeat the code within test functions?
-
What if the test funtion that I want to implement consists of accessing the web portal, logging in, then checking every attribute of the page after the login. In that case should be it one function doing all this actions or should it be chunked into more but smaller functions?
Aucun commentaire:
Enregistrer un commentaire