The practice of JavaScript performance testing based on Dojo DOH framework

Source: Internet
Author: User
Tags execution

Introduction to DOH Framework

As a rich, highly modular JavaScript library, Dojo is destined to require a large number of unit tests to ensure the stability of each functional module. The Dojo self-contained unit Test Framework DOH (Dojo Objective Harness) provides a solid foundation for writing various unit tests. Developers can use the DOH framework to quickly write the following unit tests:

Common Javascript Unit Tests

Asynchronous Javascript Unit tests

Javascript Performance Test

Web UI Interaction Test

By DOH Common JavaScript unit tests, you can ensure that synchronization JavaScript code logic is correct. DOH Asynchronous JavaScript unit tests can guarantee the quality of modules that contain asynchronous JavaScript code such as XHR calls, SetTimeout, setinterval, and so on. DOH provides performance unit testing that allows developers to easily build Benchmark for their own code. DOH Web UI Interactive testing uses a robot (robot) analog page interaction to automate UI interaction testing, making it no longer necessary for developers to test the UI of a page through repetitive manual actions.

The main code for the DOH test framework is in the util package of Dojo. The main features are provided by the following files:

Runner.js:DOH Core code, defines the base API for supporting DOH test framework

Util/doh/_browserrunner.js: Provides the ability to execute in the browser for the DOH test framework.

Util/doh/_noderunner.js: Provides the ability to use Nodejs execution for the DOH test framework

Util/doh/_rhinorunner.js: Provides the ability to use Rhino execution for the DOH test framework.

Util/doh/robot.js: Defines a robot (robot) API designed for Web UI interaction testing.

Util/doh/robot: This folder contains Java code and related resources to implement the robot interaction function.

Util/doh/plugins: This folder contains various plug-ins for the DOH. User-developed DOH Plug-ins can also be placed under this folder.

DOH testing can be done in a browser or a non-browser environment. In a browser environment, the DOH Framework provides a powerful UI interface that enables developers to visually differentiate DOH test case execution, suspend/execute specified test cases, view test reports, and so on.

Figure 1. DOH Test Interface

In a non-browser environment, when using Nodejs,rhino, pure JavaScript logic tests that do not involve UI interfaces and DOM or BOM are often used. DOH robot is not available in a non-browser environment.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.