Database Usage

Requirements

Currently, only SQLite is supported. SQLite operates using a local .db file for data storage and retrieval, as opposed to a server-based database.

To view the tables, you'll need SQLite installed. However, to begin, you can simply create an empty .db file using the touch command. For example:

Copy

touch run_tests.db

Running with an external DB

You can run Cover Agent using the --log-db-path option. For example:

Copy

cover-agent \
  --source-file-path "templated_tests/python_fastapi/app.py" \
  --test-file-path "templated_tests/python_fastapi/test_app.py" \
  --code-coverage-report-path "templated_tests/python_fastapi/coverage.xml" \
  --test-command "pytest --cov=. --cov-report=xml --cov-report=term" \
  --test-command-dir "templated_tests/python_fastapi" \
  --coverage-type "cobertura" \
  --desired-coverage 70 \
  --max-iterations 10 \
  --log-db-path "run_tests.db"

Cover Agent will create a table called unit_test_generation_attempts within the database.

Integration Tests

Run the integration test suite and provide the local .db file to each Docker container.

Copy

Observing the test data

View the test results using either an external database viewer or the basic SQLite command-line tool.

Copy

After executing some tests, a table named unit_test_generation_attempts will be created.

Copy

To get the definition of the table run:

Copy

To display all test results run the query:

Copy

This query may be easier to view outside of the CLI.

You can also filter the results to show only failed tests, for example:

Copy

Last updated