Skip to content

LBAF Testing

cwschilly edited this page Jun 1, 2023 · 5 revisions

Testing in LBAF are divided into two types of tests: Unit Tests and Acceptance Tests. Each test is checking for expected output.

Requirements for testing

A file which contains all required packages for testing purposes can be found under:

  • <project-path>/requirements-3.<x>.txt, where <x> stands for python version.

Unit testing

  • Unit Tests are checking for low level logic - functions, methods, classes
  • In order to run unit tests one needs:
    cd <project-path>
    tox
  • tox command will:
    • run all test defined in tox.ini
    • create artifacts directory in main project path <project-path>/artifacts
    • in <project-path>/artifacts following reports can be found:
      • coverage report (html and text)
      • pylint report (text)
    • all tests as well as coverage and pylint output are printed to stdout as well

Badges creation

  • In order to create a badges for further use in repository:
    cd <project-path>
    mkdir badges
    PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./artifacts/pylint.txt)
    anybadge --label=pylint --file=badges/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
    COVERAGE_SCORE=$(sed -n '/TOTAL/,/%/p' artifacts/coverage.txt | rev | cut -d" " -f1 | rev | tr -d % )
    anybadge --value=$COVERAGE_SCORE --file=badges/coverage.svg coverage

Acceptance tests

  • Acceptance Tests are checking for correctness of business logic - based on input data test is checking for expected output
  • This test is a run of LBAF Application, based on special test configuration:
    work_model:
    name: "AffineCombination"
    parameters:
      alpha: 1.
      beta: 0.
      gamma: 0.
    criterion:
      name: "Tempered"
      parameters:
        actual_destination_load: True
    deterministic_transfer: True
    n_iterations: 8
    n_rounds: 4
    fanout: 4
    phase_id: 0
    log_file: "data/synthetic_lb_data/data"
    file_suffix: json
    exodus: True
    x_procs: 2
    y_procs: 2
    z_procs: 1
    output_dir: "output"
    order_strategy: element_id
    logging_level: info
  • test checks for the final imbalance which should be 0
Clone this wiki locally