简体   繁体   中英

Why protractor test cases running slow?

I'm new to Protractor. I'm using Protractor and Jasmine for e2e automation testing for the Angular4 application. When I run a particular suite it runs fastly. But, If I run all the suites it takes a long time to complete. How can I reduce the time? I'm using await and sleep in some places in my test case. And Is there any particular pattern to follow. Currently, I'm using page object for web-element and spec file for test cases.

At first I don't recommend to use sleeps, because they can slow down your tests. You should use Protractor's Expected Conditions .

It's totally normal that your tests take a time to complete. Our tests at work would run about half an hour. We have parallelized our tests so they don't take so long, currently around 10 minutes.

You need to edit your protractor-config.js to parallelize your tests:

...
capabilities: {

    ...

    shardTestFiles: true,
    maxInstances: 3 // max number of browser instances to run parallel
},

maxSessions: 3, // max number of browser sessions to run

For more details see Protractor Config Description .

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