CN103425569B - A kind of method and apparatus obtaining reuse degree of software module - Google Patents
A kind of method and apparatus obtaining reuse degree of software module Download PDFInfo
- Publication number
- CN103425569B CN103425569B CN201210147181.1A CN201210147181A CN103425569B CN 103425569 B CN103425569 B CN 103425569B CN 201210147181 A CN201210147181 A CN 201210147181A CN 103425569 B CN103425569 B CN 103425569B
- Authority
- CN
- China
- Prior art keywords
- module
- tested module
- tested
- contact pin
- software
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The present invention is open provides a kind of method and apparatus obtaining reuse degree of software module.The method taking reuse degree of software module comprises the following steps: tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;Configuration testing case;Performing test cases, wherein, when performing test cases, the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module.
Description
Technical field
The present invention relates to soft project, and particularly relate to a kind of method and apparatus obtaining reuse degree of software module.
Background technology
In prior art, in order to improve software engineering quality and the efficiency of software execution, the most only the coverage of software module is carried out test statistics, and according to the corresponding software module of results modification of coverage test statistics.But, this mode is concerned only with whether software module is performed, the result of test statistics only in limited scope for software module design optimization provide support.
Summary of the invention
According to one object of the present invention, it is provided that a kind of method obtaining reuse degree of software module, comprise the following steps: tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;Configuration testing case;Performing test cases, wherein, when performing test cases, the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module.
Preferably, tested module is determined according to monitoring module scope, wherein monitoring module scope includes three class contact pin ranks, it is file-level, function rank and custom block rank respectively, wherein, when monitoring module scope is file-level, all functions of specific file are all carried out contact pin as tested module, when monitoring module scope is function rank, specific function is carried out contact pin as tested module, when monitoring module scope custom block rank, custom block is carried out contact pin as tested module.
Preferably, determining tested module according to external command statement further, wherein said external command statement is performed syntactic analysis, so that it is determined that tested module.
Preferably, described syntactic analysis determines the software interface title that external command statement includes, described in the tested module that is determined be the function achieving this software interface.
According to another object of the present invention, it is provided that a kind of device obtaining reuse degree of software module, it is characterised in that include with lower unit: pin unit, this unit is for inserting the test code of the reusing degree for calculating this tested module in tested module;Dispensing unit, this unit is used for test cases;Performance element, this unit is used for test cases, and wherein, performance element is when performing test cases, and the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module.
Preferably, pin unit determines tested module according to monitoring module scope, wherein monitoring module scope includes three class contact pin ranks, it is file-level respectively, function rank and custom block rank, wherein, when monitoring module scope is file-level, all functions of specific file are all carried out contact pin as tested module by described pin unit, when monitoring module scope is function rank, specific function is carried out contact pin as tested module by described pin unit, when monitoring module scope is custom block rank, custom block is carried out contact pin as tested module by described pin unit.
Preferably, pin unit determines tested module according to external command statement, and wherein, pin unit performs syntactic analysis to described external command statement, so that it is determined that tested module.
Preferably, described syntactic analysis determines the software interface title that external command statement includes, described in the tested module that is determined be the function achieving this software interface.
According to another object of the present invention, a kind of method revising software system is provided, described software system includes one or more tested module, the method comprises the following steps: tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;Configuration testing case;Performing test cases, wherein, when performing test cases, the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module;Described software system is revised according to described reusing degree.
Accompanying drawing explanation
After the detailed description of the invention having read the present invention referring to the drawings, those skilled in the art will become apparent various aspects of the invention.It will be apparent to a skilled person that these accompanying drawings are used only for coordinating detailed description of the invention explanation technical scheme, and be not intended to protection scope of the present invention is construed as limiting.
Fig. 1 is the step schematic diagram of the method for acquisition reuse degree of software module according to embodiments of the present invention.
Fig. 2 is the device schematic diagram of the method for acquisition reuse degree of software module according to embodiments of the present invention.
Detailed description of the invention
With reference to the accompanying drawings, the detailed description of the invention of the present invention is described in further detail.
Fig. 1 is the step schematic diagram of the method for acquisition reuse degree of software module according to embodiments of the present invention.As described in Figure 1, in step 1, tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module.In step 2, configuration testing case.In step 3, performing test cases, wherein, when performing test cases, the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module.
In one embodiment, the method obtaining reuse degree of software module determines tested module according to monitoring module scope, and wherein monitoring module scope includes three class contact pin ranks, is file-level, function rank and custom block rank respectively.When monitoring module scope is file-level, all functions of specific file are all carried out contact pin as tested module, when monitoring module scope is function rank, specific function is carried out contact pin as tested module, when monitoring module scope custom block rank, custom block is carried out contact pin as tested module.
In one embodiment, can determine tested module according to external command statement further, wherein said external command statement is performed syntactic analysis, so that it is determined that tested module.In one example, utilize syntactic analysis to determine the software interface title that external command statement includes, described in the tested module that is determined be the function achieving this software interface.If it is determined that multiple tested modules, then form tested module list.
Fig. 2 is the device schematic diagram of the method for acquisition reuse degree of software module according to embodiments of the present invention.As in figure 2 it is shown, the device obtaining reuse degree of software module includes with lower unit: pin unit, this unit is for inserting the test code of the reusing degree for calculating this tested module in tested module;Dispensing unit, this unit is used for test cases;Performance element, this unit is used for test cases, and wherein, performance element is when performing test cases, and the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module.
In one embodiment, pin unit determines tested module according to monitoring module scope, and wherein monitoring module scope includes three class contact pin ranks, is file-level, function rank and custom block rank respectively.When monitoring module scope is file-level, all functions of specific file are all carried out contact pin as tested module by described pin unit, when monitoring module scope is function rank, specific function is carried out contact pin as tested module by described pin unit, when monitoring module scope is custom block rank, custom block is carried out contact pin as tested module by described pin unit.
In one embodiment, pin unit determines tested module according to external command statement, and wherein, pin unit performs syntactic analysis to described external command statement, so that it is determined that tested module.In one example, utilize syntactic analysis to determine the software interface title that external command statement includes, described in the tested module that is determined be the function achieving this software interface.
According to the reusing degree of the software module that the one or more embodiment obtains, can be used to improve software design, improve software quality.Such as, in an example improving software design, by performing test cases, can be low (such as to reusing degree, only being triggered once, reusing degree is 1) multiple software modules carry out the extraction of common logic, this common logic can be carried out the program unit of same operation;The software module of high for reusing degree (such as, being triggered more than twice, reusing degree is more than 2), keeps its independence, and uses the mode combining the high software module of reusing degree to realize service logic.
The present invention will be described hereinafter the example improving software quality according to reusing degree, it will be appreciated by those skilled in the art that protection scope of the present invention is not limited to this particular example.In the system of this example, using three methods add, modify, delete process the typing of data, revise and delete.In a typing, the business scenario measuring executing process revising and delete, tri-methods of add, modify, delete are all performed 1 time, i.e. add, and the reusing degree of tri-software modules of modify, delete is 1.In the software system design later stage, increase the business scenario of msu message, be now further added by method audit to process examination & verification.In a typing, the business scenario measuring executing process revising, delete and audit, tetra-methods of add, modify, delete, audit are all performed 1 time, i.e. add, and the reusing degree of tetra-software modules of modify, delete, audit is all 1.In aforementioned four business scenario, the operation to data base has common part, and for amendment and examination & verification the two operation, they are required for first inquiring a record from lane database, then modify or audit.Therefore, it can carry out modified module and auditing module the extraction of common logic, this common logic can be carried out the program unit of same operation, enquiry module.According to the above-mentioned analysis for reusing degree, design database operation interface can include four methods: db_add, db_update, db_query, db_delete, and service logic interface can include three methods: add, update, delete.Wherein, add method call db_add completes operation, and in like manner, update calls two methods of db_query, db_update, two methods of delete method call db_query, db_delete.In typing, the business scenario measuring executing process revising and delete, db_query can be performed 2 times, and other method respectively performs 1 time.When the later stage adds examination & verification business, only need to add operational approach audit, data base interface then can be with multiplexing, it is not necessary to change, and audit method will be called two methods of db_query, db_update and complete operation.So, in a typing, the business scenario measuring executing process revised, delete and audit, db_query method will be performed 3 times, and db_update method performs 2 times, and other method performs 1 time.Thus, improve the design of software system and the efficiency of execution.
For designing preferable software system, it should keep the independence of the software module that reusing degree is high, by the way of the software module high to reusing degree uses combination rather than merging, complete new demand.Such as, it is provided that have a radio button to the input link of user, multiselect button, tA entry field etc., but, if attempting merging these input links, will be inappropriate, because merging component out and being only suitable for specific application scenarios.On the contrary, it is suitable for being done by these components and having combined the function required, because making the member's component combined to replace or revise and wanting relatively easy, and, synthesize compared to component, the component reusage combined and maintenance are also relatively easy, because the design of the various piece of assembly has higher durability.The reusing degree of the software module that the method and apparatus of acquisition reuse degree of software module according to embodiments of the present invention obtains, the software module that reusing degree is low is carried out the extraction of general character, the software module that reusing degree is high is combined, software can be made to evolve towards more preferable design direction, the maintenance and expansion of software are more prone to, and improve the quality of software.
According to another object of the present invention, a kind of method revising software system is provided, described software system includes one or more tested module, the method comprises the following steps: tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;Configuration testing case;Performing test cases, wherein, when performing test cases, the number of times being triggered by tested module described in the test code record in the tested module of contact pin, this number of times is as the reusing degree of described tested module;Described software system is revised according to described reusing degree.
By the description of embodiment of above, those skilled in the art are it is understood that in the case of without departing from the spirit and scope of the present invention, it is also possible to the detailed description of the invention of the present invention is made various change and replacement.These changes and replacement all fall in claims of the present invention limited range.
Claims (9)
1. the method obtaining reuse degree of software module, it is characterised in that comprise the following steps:
Tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;
Configuration testing case;
Perform test cases, wherein, when performing test cases, by tested mould described in the test code record in the tested module of contact pin
The number of times that block is triggered, this number of times as the reusing degree of described tested module,
Wherein, described reusing degree is used to improve software design.
Method the most according to claim 1, it is characterised in that
Determining tested module according to monitoring module scope, wherein monitoring module scope includes three class contact pin ranks, be respectively file-level,
Function rank and custom block rank, wherein,
When monitoring module scope is file-level, all functions of specific file are all carried out contact pin as tested module,
When monitoring module scope is function rank, specific function is carried out contact pin as tested module,
When monitoring module scope is custom block rank, custom block is carried out contact pin as tested module.
Method the most according to claim 2, it is characterised in that determine tested module according to external command statement further, its
Described in external command statement be performed syntactic analysis, so that it is determined that tested module.
Method the most according to claim 3, it is characterised in that it is soft that described syntactic analysis determines that external command statement includes
Part interface name, the described tested module determined is the function achieving this software interface.
5. the device obtaining reuse degree of software module, it is characterised in that include with lower unit:
Pin unit, this unit is for inserting the test code of the reusing degree for calculating this tested module in tested module;
Dispensing unit, this unit is used for test cases;
Performance element, this unit is used for test cases, and wherein, performance element is when performing test cases, by the tested module of contact pin
Test code record described in the number of times that is triggered of tested module, this number of times as the reusing degree of described tested module,
Wherein, described reusing degree is used to improve software design.
Device the most according to claim 5, it is characterised in that
Pin unit determines tested module according to monitoring module scope, and wherein monitoring module scope includes three class contact pin ranks, is literary composition respectively
Part rank, function rank and custom block rank, wherein,
When monitoring module scope is file-level, all functions of specific file are all inserted by described pin unit as tested module
Pin,
When monitoring module scope is function rank, specific function is carried out contact pin as tested module by described pin unit,
When monitoring module scope is custom block rank, custom block is carried out contact pin as tested module by described pin unit.
Device the most according to claim 6, it is characterised in that pin unit determines tested module according to external command statement,
Wherein, pin unit performs syntactic analysis to described external command statement, so that it is determined that tested module.
Device the most according to claim 7, it is characterised in that it is soft that described syntactic analysis determines that external command statement includes
Part interface name, the described tested module determined is the function achieving this software interface.
9. the method revising software system, described software system includes one or more tested module, it is characterised in that include
Following steps:
Tested module is carried out contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;
Configuration testing case;
Perform test cases, wherein, when performing test cases, by tested mould described in the test code record in the tested module of contact pin
The number of times that block is triggered, this number of times is as the reusing degree of described tested module;
Described software system is revised according to described reusing degree.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210147181.1A CN103425569B (en) | 2012-05-14 | 2012-05-14 | A kind of method and apparatus obtaining reuse degree of software module |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210147181.1A CN103425569B (en) | 2012-05-14 | 2012-05-14 | A kind of method and apparatus obtaining reuse degree of software module |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103425569A CN103425569A (en) | 2013-12-04 |
CN103425569B true CN103425569B (en) | 2016-09-28 |
Family
ID=49650354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210147181.1A Active CN103425569B (en) | 2012-05-14 | 2012-05-14 | A kind of method and apparatus obtaining reuse degree of software module |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103425569B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
CN101510115A (en) * | 2009-03-26 | 2009-08-19 | 浙江大学 | Method for controlling processor frequency when program operation by using dynamic compiler |
CN101551842A (en) * | 2009-05-05 | 2009-10-07 | 天津大学 | Safety test method based on model driving |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020199016A1 (en) * | 2001-06-22 | 2002-12-26 | Freedman Avraham T. | Automated control of outbound transist links in a multi-homed BGP routing environment |
-
2012
- 2012-05-14 CN CN201210147181.1A patent/CN103425569B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
CN101510115A (en) * | 2009-03-26 | 2009-08-19 | 浙江大学 | Method for controlling processor frequency when program operation by using dynamic compiler |
CN101551842A (en) * | 2009-05-05 | 2009-10-07 | 天津大学 | Safety test method based on model driving |
Also Published As
Publication number | Publication date |
---|---|
CN103425569A (en) | 2013-12-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101098200B (en) | Method for implementing customizable test procedure | |
CN101286131B (en) | Service test method and service test system | |
CN109840206A (en) | Data test method, apparatus, terminal and storage medium | |
CN103823747A (en) | Automatic regression testing method | |
CA2763544A1 (en) | M2m service platform and working method thereof | |
CN101071378A (en) | Source code generation method, apparatus and program | |
CN103631590B (en) | The edit methods of automatic test script | |
CN110990274B (en) | Data processing method, device and system for generating test cases | |
US20120167045A1 (en) | Apparatus and method for evaluating autosar meta file-based basic software properties | |
CN113901745A (en) | Chip testing method and device, electronic equipment and computer readable storage medium | |
CN101196844A (en) | System and method of testing hardware module | |
CN102968371A (en) | Method and device for testing JAVA API unit component | |
CN100483429C (en) | Verification operation supporting system and method of the same | |
CN103942140A (en) | Automatic testing program conversion method | |
CN101267645B (en) | Automatic test method and system for service flow software development of W base station | |
CN103425569B (en) | A kind of method and apparatus obtaining reuse degree of software module | |
CN104536897A (en) | Automatic testing method and system based on keyword | |
CN108132881A (en) | A kind of automated testing method and system | |
CN102004660A (en) | Realizing method and device of business flows | |
CN105843602A (en) | Method and system for software development | |
CN103714066B (en) | Database analysis device based on template | |
CN113626342B (en) | Model online testing method and device | |
CN104881455B (en) | A kind of architectural difference processing method and system based on MYSQL | |
CN112256978B (en) | Data processing method, device and medium based on data model | |
CN114282464A (en) | Collaborative simulation method in chip simulation verification and application |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |