-
Notifications
You must be signed in to change notification settings - Fork 75
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
UnitTests: Explicitily call $Self->DoneTesting() at the end of scripts #293
Comments
TODO:
|
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
Looks like this was a temporary hack during development.
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
So that layer caching cab help to avoid some work.
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
bschmalhofer
added a commit
that referenced
this issue
Aug 3, 2020
Is sane because tests from DESTROY are gone now.
Compared the output of two runs with Dev::UnitTest::Run. There are many diffs because things like dates and IDs are different. But altogether everything is looking good. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I suspect that there are some cases where test scripts exit before they reach the end of the script. This should be flagged as problems when the test are run with
prove
.These cases can be caught by explicitly calling
$Self->DoneTesting()
explicitily at the end of the script.Currently
DoneTesting()
is called in an the END block provided byKernel::System::UnitiTest::RegisterDriver
. But this is not sufficient asDoneTesting()
is also called when the script exits early.Just to muddy the water, there are 104 scripts that already call
DoneTesting()
explicitly. This makes no sense whatsoever, as in these case the plan is printed twice.Just to be on the safe side the method
Kernel::System::UnitTest::Driver::DoneTesting()
should print nothing when the test script is run via Dev::UnitTest::Run. This can checked by inspecting the call stack.The check for PlanWasSubmitted() can be removed, as the test script author is responsible for calling either
$Self->Plan()
or$Self->DoneTesting()
.This plan required that destructors do not execute test functions. The only apparent case is
Kernel::System::UnitTest::DESTROY()
. In this sub the test functions can be replaced by calls toNote()
.The text was updated successfully, but these errors were encountered: