Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe how the tool works #57

Open
matveypashkovskiy opened this issue Nov 17, 2020 · 2 comments
Open

Describe how the tool works #57

matveypashkovskiy opened this issue Nov 17, 2020 · 2 comments

Comments

@matveypashkovskiy
Copy link
Contributor

we have to add somethign like that to one of our documents (copied from the paper):

Our technique uses Git version control system and Coverage.py for tracking changes in the code. For the test runner, PyTest is used. The procedure of the technique is as follows: First, an initial run of all tests is performed. While performing the firsts run of the tests, a locally stored SQLite database is constructed with the coverage data provided by Coverage.py. The database contains six tables:

  • 'source file' which contains the full path to the source file, along with an id
  • 'test file' which contains the full path to the test file, along with an id
  • 'test function' which contains the test function name extracted from PyTest and information about where it's located, such as test file id and start and end line numbers in that test file
  • 'test map' which contains information about which test function ran specific line in a specific source file
  • 'new tests' which contains information about newly added tests after the previous run
  • 'last update hash' which contains information when the database was last updated

After the initial full test suite run, the tool is ready to be used. When changes are made to the target project's files, the tool checks for changes in the Git working directory. The tool first constructs a list of changed files according to Git and checks which of those files are either source code files or test code files in our local database. After the tool has determined which files are taken into consideration, it checks the Git diff -output for each of those files. From this 'diff', the tool can determine which lines have changed and which lines have shifted from their original position. Then the tool can query all the test functions from our database according to the list of line numbers for the changed lines and run them with PyTest. No database state updating is performed during this. If a user wishes to make these changes final, a Git commit operation is required. When the changes are committed, the tool checks whether the current Git HEAD hash differs from the one that is marked as a last update hash. If so, the tool queries the changes and tests for those changes almost as before. As a small addition, it does two additional things. The tool calculates how unchanged lines have shifted in the files and performs a database update based on this information. It also checks for newly added test functions by checking what test functions PyTest can find and comparing it to the current state in the database. When the tests are run after this, new coverage data is collected and inserted into the database.

@matveypashkovskiy matveypashkovskiy changed the title Describe how the tool work Describe how the tool works Nov 17, 2020
@matveypashkovskiy
Copy link
Contributor Author

sequence diagrams from #59 could be added (and diagrams should be updated if they are outdated)

@soft-nougat
Copy link
Collaborator

soft-nougat commented Mar 16, 2021

@almirasogeti & @eeerikjansen please take a look :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants