CN103425569A - Method and device for acquiring reuse degree of software module - Google Patents

Method and device for acquiring reuse degree of software module Download PDF

Info

Publication number
CN103425569A
CN103425569A CN2012101471811A CN201210147181A CN103425569A CN 103425569 A CN103425569 A CN 103425569A CN 2012101471811 A CN2012101471811 A CN 2012101471811A CN 201210147181 A CN201210147181 A CN 201210147181A CN 103425569 A CN103425569 A CN 103425569A
Authority
CN
China
Prior art keywords
module
tested module
contact pin
tested
reusing degree
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.)
Granted
Application number
CN2012101471811A
Other languages
Chinese (zh)
Other versions
CN103425569B (en
Inventor
戴康
吴金坛
吕苏
尹祥龙
翟威
何欣娟
刘弋
黄文蓓
章春芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Unionpay Co Ltd
Original Assignee
China Unionpay Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201210147181.1A priority Critical patent/CN103425569B/en
Publication of CN103425569A publication Critical patent/CN103425569A/en
Application granted granted Critical
Publication of CN103425569B publication Critical patent/CN103425569B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for acquiring reuse degree of a software module. The method includes the steps: inserting a pin into a tested module to insert a test code which is used for calculating the reuse degree of the tested module into the tested module, configuring test cases, and executing the test cases. When the test cases are executed, the number of triggered times of the tested module is recorded by the test code in the tested module inserted with the pin and is used as the reuse degree of the tested module.

Description

A kind of method and apparatus that obtains the software module reusing degree
Technical field
The present invention relates to soft project, and relate in particular to a kind of method and apparatus that obtains the software module reusing degree.
Background technology
In prior art, the efficiency of carrying out in order to improve software engineering quality and software, only carry out test statistics to the coverage of software module usually, and according to the corresponding software module of the results modification of coverage test statistics.Yet this mode only is concerned about whether software module is performed, the result of test statistics is only that the optimization of the design of software module provides support in limited scope.
Summary of the invention
According to one object of the present invention, a kind of method of obtaining the software module reusing degree is provided, comprise the following steps: tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module; The configuration testing case; Carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module.
Preferably, determine tested module according to the monitoring module scope, wherein the monitoring module scope comprises three class contact pin ranks, respectively file-level, function rank and custom block rank, wherein, when the monitoring module scope is file-level, all functions of specific file are all carried out to contact pin as tested module, when the monitoring module scope is the function rank, carry out contact pin using specific function as tested module, when monitoring module scope custom block rank, carry out contact pin using custom block as tested module.
Preferably, further according to the external command statement, determine tested module, wherein said external command statement is performed grammatical analysis, thereby determines tested module.
Preferably, the software interface title that the external command statement comprises is determined in described grammatical analysis, and the described tested module be determined is the function of having realized this software interface.
According to another object of the present invention, a kind of device that obtains the software module reusing degree is provided, it is characterized in that, comprise with lower unit: ,Gai unit, contact pin unit is for inserting the test code of the reusing degree for calculating this tested module at tested module; Dispensing unit, this unit is for test cases; Performance element, this unit is for test cases, and wherein, performance element, when carrying out test cases, is recorded by the test code in the tested module of contact pin the number of times that described tested module is triggered, and this number of times is as the reusing degree of described tested module.
Preferably, tested module is determined according to the monitoring module scope in the contact pin unit, wherein the monitoring module scope comprises three class contact pin ranks, it is respectively file-level, function rank and custom block rank, wherein, when the monitoring module scope is file-level, described contact pin unit all carries out contact pin as tested module using all functions of specific file, when the monitoring module scope is the function rank, described contact pin unit carries out contact pin using specific function as tested module, when the monitoring module scope is the custom block rank, described contact pin unit carries out contact pin using custom block as tested module.
Preferably, tested module is determined according to the external command statement in the contact pin unit, and wherein, grammatical analysis is carried out to described external command statement in the contact pin unit, thereby determines tested module.
Preferably, the software interface title that the external command statement comprises is determined in described grammatical analysis, and the described tested module be determined is the function of having realized this software interface.
According to another object of the present invention, a kind of method of revising software systems is provided, described software systems comprise one or more tested modules, the method comprises the following steps: tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module; The configuration testing case; Carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module; Revise described software systems according to described reusing degree.
The accompanying drawing explanation
After the reference accompanying drawing has been read the specific embodiment of the present invention, those skilled in the art will become apparent various aspects of the present invention.One skilled in the art will appreciate that these accompanying drawings are only for coordinating embodiment that technical scheme of the present invention is described, and not be intended to protection scope of the present invention is construed as limiting.
Fig. 1 is the step schematic diagram according to the method for obtaining the software module reusing degree of the embodiment of the present invention.
Fig. 2 is the device schematic diagram according to the method for obtaining the software module reusing degree of the embodiment of the present invention.
Embodiment
With reference to the accompanying drawings, the specific embodiment of the present invention is described in further detail.
Fig. 1 is the step schematic diagram according to the method for obtaining the software module reusing degree of the embodiment of the present invention.As described in Figure 1, in step 1, tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module.In step 2, the configuration testing case.In step 3, carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module.
In one embodiment, obtain the method for software module reusing degree and determine tested module according to the monitoring module scope, wherein the monitoring module scope comprises three class contact pin ranks, is respectively file-level, function rank and custom block rank.When the monitoring module scope is file-level, all functions of specific file are all carried out to contact pin as tested module, when the monitoring module scope is the function rank, carry out contact pin using specific function as tested module, when monitoring module scope custom block rank, carry out contact pin using custom block as tested module.
In one embodiment, can further according to the external command statement, determine tested module, wherein said external command statement is performed grammatical analysis, thereby determines tested module.In one example, utilize grammatical analysis to determine the software interface title that the external command statement comprises, the described tested module be determined is the function of having realized this software interface.If determine a plurality of tested modules, form the tested module list.
Fig. 2 is the device schematic diagram according to the method for obtaining the software module reusing degree of the embodiment of the present invention.As shown in Figure 2, the device that obtains the software module reusing degree comprises with lower unit: ,Gai unit, contact pin unit is for inserting the test code of the reusing degree for calculating this tested module at tested module; Dispensing unit, this unit is for test cases; Performance element, this unit is for test cases, and wherein, performance element, when carrying out test cases, is recorded by the test code in the tested module of contact pin the number of times that described tested module is triggered, and this number of times is as the reusing degree of described tested module.
In one embodiment, tested module is determined according to the monitoring module scope in the contact pin unit, and wherein the monitoring module scope comprises three class contact pin ranks, is respectively file-level, function rank and custom block rank.When the monitoring module scope is file-level, described contact pin unit all carries out contact pin as tested module using all functions of specific file, when the monitoring module scope is the function rank, described contact pin unit carries out contact pin using specific function as tested module, when the monitoring module scope is the custom block rank, described contact pin unit carries out contact pin using custom block as tested module.
In one embodiment, tested module is determined according to the external command statement in the contact pin unit, and wherein, grammatical analysis is carried out to described external command statement in the contact pin unit, thereby determines tested module.In one example, utilize grammatical analysis to determine the software interface title that the external command statement comprises, the described tested module be determined is the function of having realized this software interface.
The reusing degree of the software module of obtaining according to described one or more embodiment, can be used to improve Software for Design, improves software quality.For example,, in the example of an improvement Software for Design, by carrying out test cases, can be low (for example to reusing degree, only be triggered once, reusing degree is 1) a plurality of software modules carry out the extraction of common logic, this common logic can be to carry out the program element of same operation; For example, software module for reusing degree high (, be triggered more than twice, reusing degree is greater than 2), keep its independence, and adopt the mode of the software module that the combination reusing degree is high to realize service logic.
The present invention will set forth the example of improving software quality according to reusing degree hereinafter, but it will be appreciated by persons skilled in the art that protection scope of the present invention is not limited to this specific example.In the system of this example, use three method add, modify, delete carrys out typing, modification and the deletion of deal with data.In the business scenario measuring executing process of typing, modification and a deletion, add, modify, tri-methods of delete all are performed 1 time, i.e. add, modify, the reusing degree of tri-software modules of delete is 1.In the software system design later stage, increase the business scenario of msu message, now increase again a method audit and process audit.In the business scenario measuring executing process of typing, modification, deletion and an audit, add, modify, delete, tetra-methods of audit all are performed 1 time, i.e. add, modify, delete, the reusing degree of tetra-software modules of audit is all 1.In above-mentioned four business scenarios, the operation of database is had to common part, to revise and to examine these two operations, they all need elder generation to inquire a record from lane database, then modify or examine.Therefore, can carry out the extraction of common logic to modified module and auditing module, this common logic can be to carry out the program element of same operation, enquiry module.According to the above-mentioned analysis for reusing degree, the design database operation-interface can comprise four method: db_add, db_update, and db_query, db_delete, the service logic interface can comprise three method: add, update, delete.Wherein, add method call db_add complete operation, in like manner, update calls db_query, two methods of db_update, delete method call db_query, two methods of db_delete.In the business scenario measuring executing process of typing, modification and deletion, db_query can be performed 2 times, and other method is respectively carried out 1 time.When the later stage adds the audit business again, only need to add operational approach audit, database interface can be multiplexing, do not need to do change, and the audit method will be called db_query, two method complete operations of db_update.Like this, in the business scenario measuring executing process of typing, modification, deletion and an audit, the db_query method will be performed 3 times, and the db_update method is carried out 2 times, and other method is carried out 1 time.Thus, improved the efficiency of design and the execution of software systems.
For designing software systems preferably, should keep the independence of the software module that reusing degree is high, by the software module high to reusing degree, adopt the mode of combination rather than merging to complete new demand.For example, the input link that offers the user has radio button, the multiselect button, and text input domains etc., still, merge these input links if attempt, and will be inappropriate, because the member merged out is only suitable for specific application scenarios.On the contrary, it is suitable that these members are done to the function that has combined requirement, because member's member of combination is made to replace or revise and wants relatively easy, and, synthetic than member, the component reusage combined and maintenance are also relatively easy, because the design of the various piece of assembly has higher reusability.The reusing degree of the software module obtained according to the method and apparatus that obtains the software module reusing degree of the embodiment of the present invention, the software module low to reusing degree carried out the extraction of general character, the software module high to reusing degree combined, can make software evolve towards better 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 of revising software systems is provided, described software systems comprise one or more tested modules, the method comprises the following steps: tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module; The configuration testing case; Carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module; Revise described software systems according to described reusing degree.
By the description of above embodiment, those skilled in the art can understand, in the situation that without departing from the spirit and scope of the present invention, can also do various changes and replacement to the specific embodiment of the present invention.These changes and replacement all drop in the claims in the present invention book limited range.

Claims (9)

1. a method of obtaining the software module reusing degree, is characterized in that, comprises the following steps:
Tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;
The configuration testing case;
Carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module.
2. method according to claim 1, is characterized in that,
Determine tested module according to the monitoring module scope, wherein the monitoring module scope comprises three class contact pin ranks, is respectively file-level, function rank and custom block rank, wherein,
When the monitoring module scope is file-level, all functions of specific file are all carried out to contact pin as tested module,
When the monitoring module scope is the function rank, carry out contact pin using specific function as tested module,
When monitoring module scope custom block rank, carry out contact pin using custom block as tested module.
3. method according to claim 2, is characterized in that, further according to the external command statement, determines tested module, and wherein said external command statement is performed grammatical analysis, thereby determine tested module.
4. method according to claim 3, is characterized in that, the software interface title that the external command statement comprises is determined in described grammatical analysis, and the described tested module be determined is the function of having realized this software interface.
5. a device that obtains the software module reusing degree, is characterized in that, comprises with lower unit:
,Gai unit, contact pin unit is for inserting the test code of the reusing degree for calculating this tested module at tested module;
Dispensing unit, this unit is for test cases;
Performance element, this unit is for test cases, and wherein, performance element, when carrying out test cases, is recorded by the test code in the tested module of contact pin the number of times that described tested module is triggered, and this number of times is as the reusing degree of described tested module.
6. device according to claim 5, is characterized in that,
Tested module is determined according to the monitoring module scope in the contact pin unit, and wherein the monitoring module scope comprises three class contact pin ranks, is respectively file-level, function rank and custom block rank, wherein,
When the monitoring module scope is file-level, described contact pin unit all carries out contact pin as tested module using all functions of specific file,
When the monitoring module scope is the function rank, described contact pin unit carries out contact pin using specific function as tested module,
When the monitoring module scope is the custom block rank, described contact pin unit carries out contact pin using custom block as tested module.
7. device according to claim 6, is characterized in that, tested module is determined according to the external command statement in the contact pin unit, and wherein, grammatical analysis is carried out to described external command statement in the contact pin unit, thereby determine tested module.
8. device according to claim 7, is characterized in that, the software interface title that the external command statement comprises is determined in described grammatical analysis, and the described tested module be determined is the function of having realized this software interface.
9. a method of revising software systems, described software systems comprise one or more tested modules, it is characterized in that, comprise the following steps:
Tested module is carried out to contact pin, to insert the test code of the reusing degree for calculating this tested module in this tested module;
The configuration testing case;
Carry out test cases, wherein, when carrying out test cases, by the test code in the tested module of contact pin, recorded the number of times that described tested module is triggered, this number of times is as the reusing degree of described tested module;
Revise described software systems according to described reusing degree.
CN201210147181.1A 2012-05-14 2012-05-14 A kind of method and apparatus obtaining reuse degree of software module Active CN103425569B (en)

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 true CN103425569A (en) 2013-12-04
CN103425569B 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 (4)

* Cited by examiner, † Cited by third party
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
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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
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
CN103425569B (en) 2016-09-28

Similar Documents

Publication Publication Date Title
CN101098200B (en) Method for implementing customizable test procedure
CN101902756B (en) M2M (Machine To Machine) business platform and working method thereof
CN108415835B (en) Distributed data library test method, device, equipment and computer-readable medium
CN108459951B (en) Test method and device
CN103631590B (en) The edit methods of automatic test script
CN103927314A (en) Data batch processing method and device
CN101887370A (en) Method and device for creating system user interface
CN103631719A (en) Web automated testing method and device
CN111966760A (en) Hive data warehouse-based test data generation method and device
CN101634965B (en) Method for testing Linux kernel-grade unit
US8510693B2 (en) Changing abstraction level of portion of circuit design during verification
CN105335156B (en) A kind of method and system of java object serialization
CN104536897A (en) Automatic testing method and system based on keyword
CN103902450A (en) Analyzing method and system of advertisement piece normal behavior in mobile application
CN103425569A (en) Method and device for acquiring reuse degree of software module
CN110321282A (en) The XML configuration file amending method and system of Mock test
CN103714066B (en) Database analysis device based on template
KR20090003040A (en) Method and system of managing data quality through provisioning of metadata in the execution of business process
CN104881455B (en) A kind of architectural difference processing method and system based on MYSQL
CN113419957A (en) Rule-based big data offline batch processing performance capacity scanning method and device
US20060235657A1 (en) System of accumulating component design experience and method thereof
CN105893243A (en) Test frame used for test tool, and test tool
CN104572087A (en) Adaptation mode method and system for business logic implementation
CN109656619A (en) Low code platform data roams configuration system
US20110022501A1 (en) Service change component generation system, method and recording medium

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