Bug 492891 - Lack of support for automatic checking of predefined reports
Summary: Lack of support for automatic checking of predefined reports
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (show other bugs)
Version: git (master)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL: https://invent.kde.org/office/kmymone...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-09 15:24 UTC by Ralf Habacker
Modified: 2024-12-19 22:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2024-09-09 15:24:52 UTC
SUMMARY
In KMyMoney, everything revolves around numerical values and totals of numerical values, which are output in the reports in particular. The part contained in KMyMoney for creating reports has now reached a high degree of complexity, so that side effects can easily occur when correcting an error. This can manifest itself, for example, in errors in report variants of the same or other reports, which are not recognized by the existing unit tests for checking the underlying report classes.

It would therefore be helpful to have simple support for the automatic testing of standard reports and for special problems.

STEPS FOR REPRODUCTION
1. build kmymoney from Git 
2. run tests or check build jobs from KDE CI

OBSERVED RESULT
There are no tests to check predefined reports

EXPECTED RESULT
There should be a way to add test files for reports, compare them with a reference and log differences.
Comment 1 Ralf Habacker 2024-09-14 13:23:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/230.
Comment 2 Ralf Habacker 2024-09-14 14:10:53 UTC
It has turned out that the use of CSV files is useful for an initial comparison, but not for finding the relevant places in the source text. This requires an output of the internal structure of the underlying tables. A suitable format for this is XML.
Comment 3 Bug Janitor Service 2024-09-14 14:54:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/alkimia/-/merge_requests/48
Comment 4 Ralf Habacker 2024-09-14 17:27:04 UTC
Git commit ab3b672175f1bca31582d925a7acc3b5a00b590a by Ralf Habacker.
Committed on 14/09/2024 at 16:08.
Pushed by habacker into branch 'master'.

Add generation of XML files for use in tests

For a textual comparison of XMl files, it is necessary that the output
is reproducible (sorted), which is made possible with this
implementation, but not with QDomDocument, QXml...Writer.

M  +1    -0    autotests/CMakeLists.txt
A  +36   -0    autotests/alkdomtest.cpp     [License: LGPL(v2.1+)]
A  +27   -0    autotests/alkdomtest.h     [License: LGPL(v2.1+)]
M  +2    -0    src/CMakeLists.txt
A  +79   -0    src/alkdom.cpp     [License: LGPL(v2.1+)]
A  +62   -0    src/alkdom.h     [License: LGPL(v2.1+)]

https://invent.kde.org/office/alkimia/-/commit/ab3b672175f1bca31582d925a7acc3b5a00b590a
Comment 5 Ralf Habacker 2024-09-15 06:46:34 UTC
Git commit c9294bfaf26207287ff7c74bfc538ff9686a604b by Ralf Habacker.
Committed on 15/09/2024 at 06:22.
Pushed by habacker into branch 'master'.

Fix building on Windows

See https://invent.kde.org/office/kmymoney/-/merge_requests/230#note_1027494

M  +16   -0    kmymoney/plugins/xml/CMakeLists.txt
M  +1    -1    tools/CMakeLists.txt

https://invent.kde.org/office/kmymoney/-/commit/c9294bfaf26207287ff7c74bfc538ff9686a604b
Comment 6 Ralf Habacker 2024-09-15 06:46:35 UTC
Git commit 9aa1b0484b4a4837eb9660155f3abe7b8a06696f by Ralf Habacker.
Committed on 15/09/2024 at 06:22.
Pushed by habacker into branch 'master'.

Add test data for reports from the object info table

M  +1    -0    kmymoney/plugins/views/reports/core/tests/data/CMakeLists.txt
A  +4    -0    kmymoney/plugins/views/reports/core/tests/data/test-infotable-report-infotable-Darlehen-Informationen-_angepasst_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/test-infotable-report-infotable-Informationen-zu-geplanten-Buchungen-_angepasst_.csv
A  +9    -0    kmymoney/plugins/views/reports/core/tests/data/test-infotable-report-infotable-Konto-Informationen-_angepasst_.csv
A  +141  -0    kmymoney/plugins/views/reports/core/tests/data/test-infotable.xml

https://invent.kde.org/office/kmymoney/-/commit/9aa1b0484b4a4837eb9660155f3abe7b8a06696f
Comment 7 Ralf Habacker 2024-09-15 06:46:43 UTC
Git commit d858cd3cca5986fe758bf91577ac3ccf743060d1 by Ralf Habacker.
Committed on 15/09/2024 at 06:22.
Pushed by habacker into branch 'master'.

Add support for testing report generating

The support is based on a command line tool that loads
kmymoney files and exports all user-defined reports to
files that are then compared with reference files using
a cmake script. Any differences that occur are displayed
in the log and marked as errors. For each test file added
to the cmake build system a dedicated cmake test is added.
FIXED-IN:5.2

M  +3    -0    kmymoney/plugins/views/reports/core/tests/CMakeLists.txt
A  +100  -0    kmymoney/plugins/views/reports/core/tests/data/CMakeLists.txt
A  +65   -0    kmymoney/plugins/views/reports/core/tests/data/compare.cmake
M  +16   -0    tools/CMakeLists.txt
A  +213  -0    tools/kmmreport-export.cpp     [License: GPL(v2.0+)]

https://invent.kde.org/office/kmymoney/-/commit/d858cd3cca5986fe758bf91577ac3ccf743060d1
Comment 8 Ralf Habacker 2024-09-15 06:46:51 UTC
Git commit f81423dc7bf4fa5fe98a264254aed314ed5810db by Ralf Habacker.
Committed on 15/09/2024 at 06:22.
Pushed by habacker into branch 'master'.

Add test data for reports from the pivot table

M  +1    -0    kmymoney/plugins/views/reports/core/tests/data/CMakeLists.txt
A  +7    -0    kmymoney/plugins/views/reports/core/tests/data/test-pivottable-report-pivottable-Eigenkapital-Vorhersage--_angepasst_.csv
A  +7    -0    kmymoney/plugins/views/reports/core/tests/data/test-pivottable-report-pivottable-Einnahmen-Ausgaben-Vorhersage-_angepasst_.csv
A  +68   -0    kmymoney/plugins/views/reports/core/tests/data/test-pivottable.xml

https://invent.kde.org/office/kmymoney/-/commit/f81423dc7bf4fa5fe98a264254aed314ed5810db
Comment 9 Ralf Habacker 2024-10-21 21:14:25 UTC
Git commit cb11ba4daeadbd802e299720e02d888740d18d85 by Ralf Habacker.
Committed on 21/10/2024 at 21:13.
Pushed by habacker into branch 'master'.

Fix fatal build error: objectinfotable.h: No such file or directory

The kmmreport-export tool can only be built if the “reportsview” component
in cmake is activated.

Fixup for commit d858cd3cca5986fe758bf91577ac3ccf743060d1

M  +1    -1    tools/CMakeLists.txt

https://invent.kde.org/office/kmymoney/-/commit/cb11ba4daeadbd802e299720e02d888740d18d85
Comment 10 Ralf Habacker 2024-12-19 22:38:11 UTC
Git commit 12e528e75753203680bf32cb6d28aeb98f2a66f5 by Ralf Habacker.
Committed on 19/12/2024 at 22:37.
Pushed by habacker into branch 'master'.

Complete test cases in the report category 'transactions'

Now test files for all entries in the mentioned category are present.

A  +18   -0    kmymoney/plugins/views/reports/core/tests/data/test-buchungen-report-querytable-Buchungen-nach-Abgleichstatus-_angepasst_.csv
A  +8    -0    kmymoney/plugins/views/reports/core/tests/data/test-buchungen-report-querytable-Buchungen-nach-Wochen-_angepasst_.csv
A  +6    -0    kmymoney/plugins/views/reports/core/tests/data/test-buchungen-report-querytable-Buchungen-nach-Zahlungsempfänger-_angepasst_.csv
M  +8    -5    kmymoney/plugins/views/reports/core/tests/data/test-buchungen.xml

https://invent.kde.org/office/kmymoney/-/commit/12e528e75753203680bf32cb6d28aeb98f2a66f5