Skip to content

Suresoft-GLaDOS/SBFL

Repository files navigation

Spectrum-based Fault Localization

test

Environment

  • Developed & tested under Python 3.9.1
  • To develop this module, set up the required dependencies:
    python -m pip install -r requirements.txt
    

Installing the sbfl module

git clone https://github.com/Suresoft-GLaDOS/SBFL
cd SBFL
python -m pip install --upgrade pip
python -m pip install .

Or simply do:

pip install git+https://github.com/Suresoft-GLaDOS/SBFL.git

Getting Started

import numpy as np
from sbfl.base import SBFL

if __name__ == "__main__":
    """
    X: coverage data
    y: test results
    """
    X = np.array([
        [1,0,1], # coverage of test t0
        [0,0,1], # coverage of test t1
        [1,1,0]  # coverage of test t2
    ], dtype=bool)

    y = np.array([
        1, # t0: PASS
        0, # t1: FAIL
        1  # t2: PASS
    ], dtype=bool)

    """
    Calculate the suspiciousness scores
    """
    sbfl = SBFL(formula='Ochiai')
    sbfl.fit(X, y)
    print(sbfl.ranks(method='max'))

See the full example usage of this engine in ./main.ipynb.

Running tests

  • If you implement new functionality, please add the test cases for it.
  • After any code change, make sure that the entire test suite passes.
# without measuring coverage
python -m pytest

# with measuring coverage
python -m pip install coverage
python -m coverage run --source=sbfl -m pytest
python -m coverage report

Running mutation testing

pip install mutmut
mutmut run

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •