Speed up Selenium with Application Mocks

Sauce AI for Test Authoring: Move from aim to execution in minutes.|xBack to ResourcesBlogPosted April 8, 2015

Speed up Selenium with Application Mocks

quote

Let ’ s look it, we all know Selenium is slow. Not the Selenium scripts themselves, but the process of interact with the operating system and browser driver, in addition to your application ’ s own responsiveness. Luckily for us, there ’ s a great way to speed up functional testing in Selenium by combine a comprehensive parallel testing grid with application mocks. Solutions like that offer a cloud-based examination grid go a long way toward better the performance of your examination trial by using optimized infrastructure and run parallel examination. This has the welfare of completing testing faster, but more significantly, avoids causing postponement in application releases if your test fails for any reason. Of line, yet with an optimized base and the capability to run parallel tests, the tests will just run so fast against your entire application. The speeding is affected by the reply clip of your coating which is directly attributable to your back end.So Remove the Backend!Removing the back end means creating an application mock which is just your application stripped of any hind end. Without the back end to slow down processes, the responsiveness of your covering is nearly instantaneous. Selenium operations execute lots more quickly when they don ’ t have to wait for the production or test back end to respond. The time savings is relative to your application, but in my experience there was a 20 times (or more) increase in time savings. Some additional benefits to the application mock scenario are:

  1. Faster testing, fewer delays;

  2. Less time toll for failed tests;

  3. Faster iterations on front end glitch; and

  4. The power to implement continuous testing.

But a few of the downsides are:

  1. Inability to identify back-end to front-end related bug;

    SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

  2. Some assumptions are created on frame-up; and

  3. Ongoing upkeep is require.

In a robust and ideal environment, you ’ ll still implement end-to-end testing with the back end, but application mock are a great way to examine in real-time. Since running a trial is so fast, exposing the mocks to developer so they can prove their codification against the entire application on every commit is easy. Application mocks also countenance the QA team to focus on the end-to-end examination so the front-end team is able to speak bug faster. Although application mocks are not intended to replace the standard Continuous Integration (CI) or Continuous Delivery (CD) processes, overall they are a way to miscarry better and faster—a second, even faster CI environment. With a more elaborate apparatus, you can try by hold the back end in a circumscribed capacity using a undress down service virtualization to mimic back end responses, without the large overhead that your production or staging back end has.Implementing Application MocksThe initial setup of the mock environment does require some work, but is worthwhile in exchange for the benefits. There are five step to frame the setup:

  1. Take the current variation of your application in production and deploy it to a limited infrastructure.

  2. Wire up the integration setup using an consolidation tool like CircleCI, Jenkins or GO, with webhooks into GitHub or other source repository.

  3. Modify the application. This is where it can get tricky, and your development squad will need to creatively approach how to deploy the application as mock mode or product. In my experience, the best method is simply a flag in the code for each developer branch.The mock version of the application need that there be no link to the back end unless you use the service virtualization option. In this version, all interactions with the UI will assume a positive response: if you click login, you are logged in as an authenticated user without any database lookup for the user. Unfortunately, for most applications you will either need to do some assumptions or establish different flows look on the test iteration. For example, if you hold two edition of your covering, you can set your login to determine which loads. In addition, you can hard code the “ trial ” exploiter, so that different users are cognize to the app in mock mode to go to different locations. Alternatively, you can set the system so every second tryout run follows the flow to the “ Enterprise ” edition rather.

  4. Configure Sauce Connect on your testing infrastructure to allow Sauce Labs to see your home mock testing surround and run tests against the mock variation of the application. Set up Sauce with two different sets of the same testing scripts—one for mock and one for pre-release.

  5. Start testing!

Taking the process one step farther, configure log analysis and error monitoring on the mock environment to help your developers name non-obvious bugs. Since the sizing is so small relative to product, and the resources required to run the application are so low, it is viable for each developer to get their own mock environs. This is especially true when testing is run on Sauce Labs infrastructure. The above model is think for web coating, but translates easily to mobile applications, presume you have the ability via API to drive emulators and have a robust testing grid of peregrine device copycat. The above is a simplistic presentation of the setup, because all application are different. Regardless of the possible complexness, the practice works to help companies test better and quicker. While you can ’ t make the Firefox or Chrome web drivers for Selenium tests run any faster, you can make a mock version of your web application that responds lightning tight, countenance front-end developers to do functional testing continuously and prevents failed test runs or slack Selenium scripts from delaying releases. By Chris RileyChris Riley is a technologist who has spend 12 years facilitate organizations transition from traditional maturation practices to a modernistic set of culture, processes and tooling. In addition to being a research analyst, he is an O ’ Reilly author, regular speaker, and open subject expert in the areas of DevOps Strategy and culture and Enterprise Content Management. Chris believes the big challenge faced in the tech marketplace is not tools, but rather citizenry and planning. Throughout Chris ’ s career he has track the roles of marketing, product direction, and engineering to gain a singular view of how the deeply technical is used to solve real-world problems. By working with both early adopter and belatedly, he has watched technologies mature from unsmooth solutions to indispensable and transparent. In addition to spending his time understanding the market he helps ISVs selling B2D and practitioner of DevOps Strategy. He is interested in machine-learning, and the intersection of BigData and Information Management.

Published:
Apr 8, 2015
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights earmark. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free