Bug 40444

Summary: Add a test to ensure all Perl test files use Test::NoWarnings
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: Needs documenting --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: david, fridolin.somers, lucas, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.04
Circulation function:
Bug Depends on: 18772, 40018, 40019, 40020, 40021, 40316, 40317, 40347, 40348, 40350, 40351, 40371, 40372, 40373, 40374, 40376, 40377, 40378, 40380, 40381, 40384, 40385, 40387, 40388, 40390, 40403, 40404, 40405, 40406, 40407, 40409, 40410, 40411, 40429, 40437, 40438, 26157, 26186, 26417, 26892, 28483, 29273, 29315, 30731, 34697, 34838, 36356, 36917, 36918, 36919, 36923, 36924, 36935, 36936, 36937, 36938, 36939, 38944, 40379, 40401    
Bug Blocks: 40315, 40375, 40382, 40442, 40443, 40448, 40449    
Attachments: Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
Bug 40444: Add Test::NoWarnings to xt tests
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
Bug 40444: Add Test::NoWarnings to xt tests
Bug 40444: (follow-up) Remove EDI tests from the exclude list
Bug 40444: Add Test::NoWarnings to newly added api/v1/cash_registers.t
Bug 40444: Fix onboarding and installer selenium tests

Description Jonathan Druart 2025-07-18 09:57:29 UTC
Once all children bug reports of bug 25515 will be pushed, only 7 (non-tribial) tests will be left.

We should add a test now to ensure no new occurrence will be added.
Comment 1 Jonathan Druart 2025-07-18 10:01:56 UTC
Created attachment 184319 [details] [review]
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings

This patch adds a new xt test (xt/use-test-no-warnings.t) to make sure
all our Perl test files will use Test::NoWarnings.

It also adds Test::NoWarnings to some files that were missing it and
that didn't need any other changes.

However we still have 7 non-trivial tests that we will consider
exception for now, until they are fixed.

Test plan:
  prove xt/use-test-no-warnings.t
should return green.
And all other tests modified by this patch (the qa script will do that
for you)

You can also test the 2 selenium tests:
1. DROP and CREATE the DB
  DROP DATABASE koha_kohadev;
  CREATE DATABASE koha_kohadev;
  restart_all
2. KOHA_TESTING=1 prove t/db_dependent/selenium/00-onboarding.t
3. Repeat 1
2. KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t
Comment 2 Jonathan Druart 2025-07-18 12:15:27 UTC
Created attachment 184364 [details] [review]
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings

This patch adds a new xt test (xt/use-test-no-warnings.t) to make sure
all our Perl test files will use Test::NoWarnings.

It also adds Test::NoWarnings to some files that were missing it and
that didn't need any other changes.

However we still have 7 non-trivial tests that we will consider
exception for now, until they are fixed.

Test plan:
  prove xt/use-test-no-warnings.t
should return green.
And all other tests modified by this patch (the qa script will do that
for you)

You can also test the 2 selenium tests:
1. DROP and CREATE the DB
  DROP DATABASE koha_kohadev;
  CREATE DATABASE koha_kohadev;
  restart_all
2. KOHA_TESTING=1 prove t/db_dependent/selenium/00-onboarding.t
3. Repeat 1
2. KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t
Comment 3 Jonathan Druart 2025-07-18 12:15:29 UTC
Created attachment 184365 [details] [review]
Bug 40444: Add Test::NoWarnings to xt tests
Comment 5 David Nind 2025-07-18 22:43:57 UTC
Some tests fail for me, not sure if I have to do anything else after applying the patches (KTD started up with selenium, koha and KTD updated, fresh ktd pull):

prove xt/use-test-no-warnings.t
xt/use-test-no-warnings.t .. 1/2 
#   Failed test 'All Perl test files should contain Test::NoWarnings'
#   at xt/use-test-no-warnings.t line 61.
#          got: '8'
#     expected: '0'
# The following test files should use Test::NoWarnings:
# 	t/ImportBatch.t
# 	t/db_dependent/Auth.t
# 	t/db_dependent/Budgets.t
# 	t/db_dependent/Koha/Patron.t
# 	t/db_dependent/www/auth_values_input_www.t
# 	t/db_dependent/www/batch.t
# 	t/db_dependent/www/history.t
# 	t/db_dependent/www/search_utf8.t
# Looks like you failed 1 test of 2.
xt/use-test-no-warnings.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests 

Test Summary Report
-------------------
xt/use-test-no-warnings.t (Wstat: 256 (exited 1) Tests: 2 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=2,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.04 cusr  0.03 csys =  0.08 CPU)
Result: FAIL

Running the QA script - several of the tests fail for me:
- t/db_dependent/Patron/Borrower_Discharge.t
- t/db_dependent/selenium/00-onboarding.t
- t/db_dependent/selenium/01-installation.t
- t/db_dependent/selenium/opac_ill_requests.t
- xt/find-misplaced-executables.t
- xt/use-test-no-warnings.t
Comment 6 Jonathan Druart 2025-07-21 11:08:00 UTC
(In reply to David Nind from comment #5)
> Some tests fail for me, not sure if I have to do anything else after
> applying the patches (KTD started up with selenium, koha and KTD updated,
> fresh ktd pull):

Yes, same as bug 40315, you need the patches from the dependencies of bug 25515.
Comment 7 Martin Renvoize (ashimema) 2025-07-23 10:11:10 UTC
I'm going to give this a QA run.. I've changed the order of the dependency tree to make it trivial for git bz to apply all the dependencies.
Comment 8 Martin Renvoize (ashimema) 2025-07-23 10:16:37 UTC
Created attachment 184540 [details] [review]
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings

This patch adds a new xt test (xt/use-test-no-warnings.t) to make sure
all our Perl test files will use Test::NoWarnings.

It also adds Test::NoWarnings to some files that were missing it and
that didn't need any other changes.

However we still have 7 non-trivial tests that we will consider
exception for now, until they are fixed.

Test plan:
  prove xt/use-test-no-warnings.t
should return green.
And all other tests modified by this patch (the qa script will do that
for you)

You can also test the 2 selenium tests:
1. DROP and CREATE the DB
  DROP DATABASE koha_kohadev;
  CREATE DATABASE koha_kohadev;
  restart_all
2. KOHA_TESTING=1 prove t/db_dependent/selenium/00-onboarding.t
3. Repeat 1
2. KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 9 Martin Renvoize (ashimema) 2025-07-23 10:16:39 UTC
Created attachment 184541 [details] [review]
Bug 40444: Add Test::NoWarnings to xt tests

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 10 Martin Renvoize (ashimema) 2025-07-23 10:16:41 UTC
Created attachment 184542 [details] [review]
Bug 40444: (follow-up) Remove EDI tests from the exclude list

We've got those tests running without warnings now too.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 11 Martin Renvoize (ashimema) 2025-07-23 10:24:30 UTC
I think we're near the end of the road here.. woop woop.

In my opinion, we should go with this as soon as the EDI tests that are awaiting QA are passed.
Comment 12 Lucas Gass (lukeg) 2025-07-24 23:01:33 UTC
I don't see any missing dependencies now. It should be safe to push this now, I believe?
Comment 13 Jonathan Druart 2025-07-25 07:02:33 UTC
Created attachment 184612 [details] [review]
Bug 40444: Add Test::NoWarnings to newly added api/v1/cash_registers.t
Comment 14 Jonathan Druart 2025-07-25 07:03:05 UTC
(In reply to Lucas Gass (lukeg) from comment #12)
> I don't see any missing dependencies now. It should be safe to push this
> now, I believe?

Yes, go! :)
Comment 15 Jonathan Druart 2025-07-28 08:40:11 UTC
Created attachment 184708 [details] [review]
Bug 40444: Fix onboarding and installer selenium tests
Comment 16 Lucas Gass (lukeg) 2025-07-28 22:31:01 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 17 Paul Derscheid 2025-09-16 12:06:17 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 18 Fridolin Somers 2025-09-26 13:57:20 UTC
Enhancement not pushed to 24.11.x