Skip to content

Repository parser tests (using old SimilarityChecker) - #17

Open
AlpTorac wants to merge 72 commits into
CIPM-tools:build-pipelinefrom
AlpTorac:repoparser-pull-req
Open

Repository parser tests (using old SimilarityChecker)#17
AlpTorac wants to merge 72 commits into
CIPM-tools:build-pipelinefrom
AlpTorac:repoparser-pull-req

Conversation

@AlpTorac

@AlpTorac AlpTorac commented Jul 27, 2025

Copy link
Copy Markdown
Contributor

Introduction

This pull request (based on fd6d6e8) introduces repository parser tests and their pre-requisites.

Contains tests for the Teammates repository and the Corona Warn App Server repository. The tests include the commits from the corresponding CI tests in "vsum.tests" (5 commits for Teammates, 8 commits for cwa-server).

All tests under cipm.consistency.fitests.repositorytests run successfully at the time of writing this description.

About this pull request

2 plug-ins "fitests" (cipm.consistency.fitests) and "fitests.repositorytests" (cipm.consistency.fitests.repositorytests) are included in this pull requests. "fitests" provides the classes that were originally planned and used by "unittests" (see #14 ), which are needed by repository parser tests as well. "fitests.repositorytests" contains repository-relevant classes including: Repository parser tests, diff patch analysis, (approximative) commentary removal, expected similarity result computation and model resource caching.

Despite "fitests" being introduced in earlier pull requests (such as #14 ), this pull request does not require the refactoring changes (proposed in #9 and #10 ) to FirstInstance bundles. Commits introduced here only create the 2 aforementioned plug-ins and do not modify anything else, except for the .gitignore file in 486fe38, in order to exclude generated test resource files for parser tests.

To keep this pull request as simple as possible, numerous classes and methods from the "fitests" plug-in have been left out (see #14 ).

To discuss

  1. Names in general (classes, methods, plug-ins, etc.)
  2. Time measuring in repository parser tests
    2.1. Whether ParserTestTimeMeasurer class should be used for measuring time
    2.2. Tags used for time measuring
    2.3. Positions in code where time is measured
    2.4. How time measurements are saved
  3. The complexity in cipm.consistency.fitests.similarity.jamopp.parser
  4. What commits to use in repository parser tests (for the Teammates and cwa-server tests)

AlpTorac added 30 commits July 27, 2025 17:56
Removed project-specific settings for fitests
with default methods that are the standard JaMoPP tests
that analyses Resource file content
The idea is to spare multiple test classes for the same test repository. With this interface it is possible to just have a list of commits and then to iterate them in certain ways.
It contains a template method @testfactory createTests(...) for generating dynamic parser tests. This way, dynamic test generation can be re-used in future repository parser tests.
in Java source files

Note: Commentary removal is only an approximation
Assumes reflexivity, symmetry and transitivity properties (explained in RepoTestResultCache commentary)
that provides cached expected similarity results
to local repository clone removal
Move Resource factory registry setup to resource parsing strategy
Edit commentary
Edit its commentary
To match the terminology in README.md
Relativize paths and URIs to hide sensitive data in paths

Gather all time measurement files generated from a test run within a folder, so that it is possible to tell what time measurements are taken from which test runs
…tate

ResourceContentSimilarityResultProvider is currently only used by ModelComparisonTestFactory as default provider. It is however currently changed in all concrete tests, so that this fix makes no difference
now subtypes can copy attributes from supertypes
Edit commentary
to ensure saved time measurements are parseable via GSON
to provide an introduction and terminology
to provide an introduction and link to the README of fitests plug-in
The time measurement sample file touched by GIT had its line separator(s) replaced with the one for UNIX systems. This led to the parsed and re-serialised file in the tests to have slightly different contents (line separators). Solved by using FileUtil to get their effective content.
*
* @author Alp Torac Genc
*/
public class GSONLoadingStrategy implements ITimeMeasurementLoadingStrategy {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a default constructor, which initializes an instance with the DefaultTimeMeasurementDataStructure and available ITimeMeasurementTag enums? This would simplify using this class when using it with the default classes.

* implement a version of this method for their own type, in order to enable
* partially copying attributes from super-types.
*/
public void copyLayoutFrom(RepoParserTestFileLayout layout) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the goal behind this method? Should this support cloning objects? In this case, cf., https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html

Comment on lines +136 to +138
* directory. Refer to the concrete implementation
* for more information on where this path is
* supposed to point at.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be actually not defined by concrete implementations, as it could violate the substitution principle.

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

Successfully merging this pull request may close these issues.

2 participants