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

Refactor test framework to load test resources dynamically #5876

Merged
merged 6 commits into from
Jan 25, 2024

Conversation

solth
Copy link
Member

@solth solth commented Jan 12, 2024

This pull request refactors the test framework of Kitodo.Production a little bit by loading test resources like images and metadata for individual tests dynamically. This means the content of static test process directories like Kitodo/src/test/resources/metadata/2, Kitodo/src/test/resources/metadata/4 etc. have been moved to a test resource source directory from which they are loaded at the beginning of the corresponding test.

After test execution the test process including its process directory and contents is removed. This ensures processes do not depend on test order and won't accidentally manipulate or remove resources required by other tests. It also makes adding dummy processes to the test database for those static process directories mentioned above obsolte.

Copy link
Collaborator

@markusweigelt markusweigelt left a comment

Choose a reason for hiding this comment

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

Thank you for the comprehensive implementation. In addition to fixing the Checkstyle or Codacy errors, I have some comments.

Copy link
Collaborator

@markusweigelt markusweigelt left a comment

Choose a reason for hiding this comment

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

There are some Codacy Issues to fix. After that, I am satisfied.

@solth solth merged commit c1e6292 into kitodo:master Jan 25, 2024
2 checks passed
@solth solth deleted the refactor-test-resources branch January 25, 2024 09:08
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 26, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 26, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 26, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 26, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 30, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Jan 30, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 2, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 2, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 7, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 7, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 20, 2024
matthias-ronge added a commit to matthias-ronge/kitodo-production that referenced this pull request Feb 20, 2024
solth pushed a commit that referenced this pull request Feb 20, 2024
* Create a base for the Kitodo script

* Add a button in the Kitodo Script Dialog

* Implement

* Add tests

* Fix and complete messages

* Improve readability

* Fix checkstyle

* Fix checkstyle

* Fix checkstyle

* Print meaningful exception

* Print meaningful exception manually

* Fix a control flow error

* Remove error wrapper

* Test more generically, and give better error message on failure

* Fixes a typo

* Fix progress not working

* Prevents tasks not being indexed

* Support test file arrangement before and after PR #5876

* Fix Javadoc

* Remove 'final' modifier from functions used in constructors

Since private methods cannot be meaningfully overridden because of their
visibility, declaring them final is redundant.

* Use Files.walk() with try-with-resources

* Invert if-condition

* Use Files.walk() with try-with-resource

* Invert if-condition

* Fix Javadoc

* Fix a typo

* Spell out abbreviated negations in English

* Remove duplicate class 'TreeDeleter'

* Fix indent

* Reformat try-with-resources statements, remove unnecessary ';'

* Rewrite childDepth() to make use of OptionalInt

* Fix checkstyle

* Rearrange function calls and checks

The order of execution of the underlying tasks depends on the order in
which they are found on the disk and is unpredictable. Reliable testing
is only possible after the end of this group of tasks.

* Remove support for test files before PR #5876

* Use 'ProcessTestUtils' for clean-up

* Remove database IDs from test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants