简体   繁体   中英

Google Optimization for e2e test with protractor

Login optimization should be implemented in order to speed up the execution time of all e2e tests. Currently, after each test we have, the Chrome browser closes, and the next session login should be done again in order to proceed with another test. How and what should be changed regarding this matter. Any advice?

Unfortunately without details of how your application works, i can suggest only some generic things:

You might think about running a selenium grid with different selenium nodes. Your browser instances can be configured to run in the selenium grid endlessly if you do not run browser.quit or browser.close at the end of each test. That way using the method Xotabu4 mentioned above, you can set the browser cookie using browser.manage().addCookie(...) . You can also clean the browser cookies if required.

Now your running browser instance will have the auth cookie for the tests you are running and you will no longer have to worry about login. These tests are better if you run it in a selenium grid using docker containers because you can monitor different chrome/firefox nodes and if any of them die or restart. You will have to configure the chrome node containers in such a way that everytime a node is restarted, you add auth cookies to your browser.

Another suggestion I have for you is to disable authentication check in your automated test environment and test authentication in a different environment. I know the quality of this advice would vary depending on your application.

Every test scenario requiring login runs the login function before running any other tests everytime. One thing common in this is the login functionality. If you abstract that functionality out and ensure that functionality is working well and then disable that functionality and test everything else. You will save a lot of time. Only thing you need to be sure about here is that the login functionality integrates with the rest of the moving parts of your application in exactly the same way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM