用例登录成功后,在执行 tearDown 的时候(driver.quit)退出登录了?
导致后面用例执行失败 遇见这样一个问题: 前一个用例是登录操作,登录成功后,由于在tearDown中有driver.quit()操作,导致该用例执行完毕后tearDown时就退出登录了;而后面的一个用例则是要在登录成功的状态下才能执行的: - <p align="justify" style="margin: 0pt; text-align: justify; -ms-text-justify: inter-ideograph; mso-pagination: none;"><span style="font-family: Calibri; font-size: 10.5pt; font-weight: normal; mso-fareast-font-family: 宋体;" "yes";"="" 1.0000pt;="" roman";="" new="" times=""><font color="#000000"> def tearDown(self):</font></span></p><p align="justify" style="margin: 0pt; text-align: justify; -ms-text-justify: inter-ideograph; mso-pagination: none;"><span style="font-family: Calibri; font-size: 10.5pt; font-weight: normal; mso-fareast-font-family: 宋体;" "yes";"="" 1.0000pt;="" roman";="" new="" times=""><font color="#000000"> # <font face="宋体">停止所有的测试桩</font></font></span></p><p align="justify" style="margin: 0pt; text-align: justify; -ms-text-justify: inter-ideograph; mso-pagination: none;"><span style="font-family: Calibri; font-size: 10.5pt; font-weight: normal; mso-fareast-font-family: 宋体;" "yes";"="" 1.0000pt;="" roman";="" new="" times=""><font color="#000000"> Stub().stop()</font></span></p><p align="justify" style="margin: 0pt; text-align: justify; -ms-text-justify: inter-ideograph; mso-pagination: none;"><span style="font-family: Calibri; font-size: 10.5pt; font-weight: normal; mso-fareast-font-family: 宋体;" "yes";"="" 1.0000pt;="" roman";="" new="" times=""><font color="#000000"> Self.driver.quit()</font></span></p>
复制代码 请问这个问题该怎样去解决?注释掉tearDown函数中的self.driver.quit()是不行的,因为session未结束,后面的用例无法创建新的session。
|