Giter VIP home page Giter VIP logo

d4t's Introduction

D4T: Design for testability

This repository contains the source code and replication package for our creative learning-based ‘design for testability’ approach in software systems. More information is available at https://m-zakeri.github.io/D4T.

The paper is available at https://www.sciencedirect.com/science/article/abs/pii/S0950584924001162?dgcid=coauthor.

@article{ZAKERINASRABADI2024107511,
  title = {Measuring and improving software testability at the design level},
  journal = {Information and Software Technology},
  volume = {174},
  pages = {107511},
  year = {2024},
  issn = {0950-5849},
  doi = {https://doi.org/10.1016/j.infsof.2024.107511},
  url = {https://www.sciencedirect.com/science/article/pii/S0950584924001162},
  author = {Morteza Zakeri-Nasrabadi and Saeed Parsa and Sadegh Jafari},
  keywords = {Software testability, Design for testability, Object-oriented design, Class diagram, Automated refactoring, Design patterns},
  abstract = {
    Context: The quality of software systems is significantly influenced by design testability, an aspect often overlooked during the initial phases of software development. The implementation may deviate from its design, resulting in decreased testability at the integration and unit levels.
    
    Objective: The objective of this study is to automatically identify low-testable parts in object-oriented design and enhance them by refactoring to design patterns. The impact of various design metrics, mainly coupling (e.g., fan-in and fan-out) and inheritance (e.g., depth of inheritance tree and number of subclasses) metrics on design testability is measured to select the most appropriate refactoring candidates.
    
    Method: The methodology involves creating a machine learning model for design testability prediction using a large dataset of Java classes, followed by developing an automated refactoring tool. The design classes are vectorized by ten design metrics and labeled with testability scores calculated from a mathematical model. The model computes testability based on code coverage and test suite size of classes that have already been tested via automatic tools. A voting regressor model is trained to predict the design testability of any class diagram based on these design metrics. The proposed refactoring tool for dependency injection and factory method is applied to various open-source Java projects, and its impact on design testability is assessed.
    
    Results: The proposed design testability model demonstrates its effectiveness by satisfactorily predicting design testability, as indicated by a mean squared error of 0.04 and an R2 score of 0.53. The automated refactoring tool has been successfully evaluated on six open-source Java projects, revealing an enhancement in design testability by up to 19.11%.
    
    Conclusion: The proposed automated approach offers software developers the means to continuously evaluate and enhance design testability throughout the entire software development life cycle, mitigating the risk of testability issues stemming from design-to-implementation discrepancies.
  }
}

d4t's People

Contributors

m-zakeri avatar sadeghjafari5528 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

d4t's Issues

Class Diagram Bug(set_stereotypes)

after refactor factory pattern in "10_water-simulator", when we want to make class_diagram of refactored code return bellow error:

File "/media/sadegh/Data/sadegh/iust/compiler/compiler projects/main_project/class_diagram.py", line 652, in __calculate_interface_modification_type
if method_info[class_name]['methods'][m]['is_modify_itself']:
KeyError: 'getInstance'

Factory method extended or abstract class does not handle.

We have 2 case in this issue:
1- Imagine that we have products that extends a class that have products-common-methods so in this case we must make a interface from extended class and use this interface in creator class.

2- Imagine that we have products that extends an abstract class, if abstract class does not have non-abstract method we can replace it with an interface and use that interface in the creator class.

Factory detection bug.

In the following example factory can not detected.
if we remove "implements Y" this can detect factory but if we keep it this algorithm can not detect factory pattern in this example.

example:

package com.products;
import com.functions.DecodedImage;

class X
{

}

interface Y
{

}

class GifReader extends X implements Y{
private DecodedImage decodedImage;

public GifReader(String image, int size) {
    this.decodedImage = new DecodedImage(image);
}

public DecodedImage getDecodeImage() {
    return decodedImage;
}

public int getEncodeImage() {
    return 0;
}

}

Statistical analysis

Write some scripts that show the following data:
1- number of detected factory pattern
2- number of injection pattern detected in each case(case1, case2, case3, total)
3- compute complexity for each project or package(in very big project).
4- Find best sensitivity(hyper parameter in factory pattern).
5- Show some useful charts and analyze them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.