React project unit test method and device based on Jest and storage medium

A unit test and project technology, applied in software testing/debugging, error detection/correction, instruments, etc., can solve the problems of difficult test case writing, high test cost, low test coverage, etc., to improve test coverage, The effect of reducing the cost of testing and reducing the difficulty of writing

Pending Publication Date: 2020-09-18
HANGZHOU QULIAN TECH CO LTD
View PDF1 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

React's componentization and functional programming are naturally suitable for unit testing; however, traditional testing methods and tools are not suitable for unit testing of React projects. There are problems such as high testing costs, difficult test case writing, and low test coverage.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • React project unit test method and device based on Jest and storage medium
  • React project unit test method and device based on Jest and storage medium
  • React project unit test method and device based on Jest and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0026] This embodiment provides a method for unit testing of React projects based on Jest, such as image 3 As shown, including: S101, select test tools and frameworks according to the characteristics of the React project and the unit test requirements; S102, build a test environment; S103, write test cases, provide corresponding test content according to the file type of the React project, and execute the corresponding Test strategy; S104, generate test report; S105, automate and integrate unit testing into the project.

[0027] The file types of the React project include UI components, logic components, actions, reducers, and tool functions. The S101 further includes: installing Jest, Enzyme, and babel-jest, and adding "test:jest--config.jest.js" to the script in package.json. The test report includes code coverage, and the code coverage is detected by a code coverage tool. The UI component uses a snapshot for testing to determine whether the rendering result of the UI compon...

Embodiment 2

[0051] This embodiment provides a device that includes: one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors At this time, the one or more processors are caused to execute the method as described above.

[0052] In addition, this embodiment provides a storage medium storing a computer program, and when the program is executed by a processor, the method as described in Embodiment 1 is implemented.

[0053] figure 1 This is a schematic structural diagram of a device provided by an embodiment of the present invention.

[0054] Such as figure 1 As shown, as another aspect, the present application also provides a device 500, including one or more central processing units (CPU) 501, which can be based on a program stored in a read-only memory (ROM) 502 or from a storage section 508 is loaded into the program in the random access memory (RAM) 503 to perform various appropriate actions and processing. In...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a React project unit testing method and device based on Jest and a storage medium, and belongs to the technical field of software testing. The method comprises the following steps: S101, selecting a test tool and a framework according to React project characteristics and unit test requirements; S102, building a test environment; S103, compiling a test case, providing corresponding test content according to the file type of the React project, and executing a corresponding test strategy; s104, generating a test report; and S105, automating and integrating the unit test into a project. Aiming at the technical problems of high test cost, low code coverage rate and the like, the test can be performed in a targeted manner, and the test cost is reduced.

Description

Technical field [0001] The invention relates to the technical field of software testing, in particular to a Jest-based React project unit testing method, equipment and storage medium. Background technique [0002] Unit testing refers to the inspection and verification of the smallest testable unit in the software. A complete unit testing method will find many bugs in a certain stage of software development, and the cost of modifying them is also very low. Testing software products as early as possible in the life cycle will ensure the best efficiency and quality. With the provision of tested software units, the system integration process will be greatly simplified. The easier it is for a piece of software to write unit tests, the better its modular structure and the weaker the coupling between modules. jest is a testing framework launched by facebook that integrates Mocha, chai, jsdom, sinon and other functions. React's componentization and functional programming are inherent...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3676G06F11/3684G06F11/3688G06F11/3692
Inventor 李伟蔡亮张帅张延楠张珍
Owner HANGZHOU QULIAN TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products