Skip to content

Conversation

@AlpTorac
Copy link
Contributor

@AlpTorac AlpTorac commented Jul 27, 2025

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
Comment on lines 43 to 60
@Override
protected Collection<AbstractJaMoPPParserSimilarityTestFactory> getTestFactories() {
var res = new ArrayList<AbstractJaMoPPParserSimilarityTestFactory>();
res.add(new EAllContentSimilarityTestFactory(this.getSCC()));
// TODO Determine whether the order of Resource contents should matter
// Especially important due to synthetic elements from TrivialRecovery
// Use ModelComparisonTestFactory(boolean) to set it (true by default)
res.add(new ModelComparisonTestFactory());
res.forEach((tf) -> tf.setExpectedSimilarityResultProvider(getExpectedSimilarityResultProviderForCommits()));
return res;
}

@Override
protected RepoParserTestOptions initResourceTestOptions() {
var opts = super.initResourceTestOptions();
opts.setShouldDeleteRepositoryClones(true);
return opts;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a code duplication, which should be avoided. The same code is also in the TeammatesRepoTest class.

protected Resource prepareArtificialResource(Resource modelResource, URI artificialResourceURI) {
var modelResourceSet = modelResource.getResourceSet();

protected Resource prepareArtificialResource(ResourceSet modelResourceSet, List<Resource> directModelResources,
Copy link
Member

Choose a reason for hiding this comment

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

The JavaDoc and maybe the method name needs to be updated.

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.
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