-
Notifications
You must be signed in to change notification settings - Fork 184
restructure CI tests into class-based unit tests #620
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
Conversation
|
In a few local trials I have the following approximate breakdown of runtime per test class, including the contributions of the longest individual tests. In total, the tests take about ~11 minutes when run on my laptop.
If the application repo tests are removed as suggested in issue #619, in addition to skipping the passive yaw cases, this decreases the test runtime by ~80%. The integration tests can be gradually broken down into unit tests over time to prevent duplicate tests. This will improve runtime even further in the future. |
|
See akeeste#7 |
Use test suites to control execution
|
A few additions since this PR has been opened:
As indicated in the above discussion, removing the applications and passive yaw tests significantly decreases run time. Now the tests take ~2 minutes locally, only 15% of the previous run time. |
|
Adam, how much time is saved by not running the passive yaw regression test? My concern is that if they are not run by default, then they will never be run at all. I would also consider replacing the test runner. If we are going to collect coverage info (which I think we should soon) we need to use a plugin on a test runner: https://uk.mathworks.com/help/matlab/ref/matlab.unittest.plugins.codecoverageplugin-class.html What is the difference in output between using run and using the test runner? |
|
@H0R5E My problem with the test runner is that it currently does not give the same diagnostic information as the run command (in R2021a). For example, right now the first BEMIO test fails (the fix is already in dev). When using the testRunner, This almost seems like a Matlab bug, I don't know why the testRunner would give less information than the standard run command. If the testRunner will be required for code coverage information, I can look again at how to get around this issue. However until code coverage is implemented, I think the run command is more insightful. |
|
I think I might have been calling the runner incorrectly. Can you try the
method here:
https://uk.mathworks.com/help/matlab/ref/matlab.unittest.testrunner-class.html#mw_8602d5ca-8748-4425-8fa1-9c2fdaef84e3
I.e.
runner = TestRunner.withTextOutput;
result = run(runner,suite);
T
…On Tue, Jul 6, 2021, 18:55 Adam Keester ***@***.***> wrote:
@H0R5E <https://github.com/H0R5E>
That is a fair point, most users might not remember to turn on passive yaw
when appropriate. Maybe we just remove the passive yaw regression
altogether? The functionality will be covered in the Applications
repository, though without a comparison to the previous result.
My problem with the test runner is that it currently does not give the
same diagnostic information as the run command (in R2021a). For example,
right now the first BEMIO test fails (the fix is already in dev).
When using the testRunner, results(1).Details is empty. Whereas the
run(suites) command gives useful debugging information in
Details.DiagnosticRecord such as Exception, Stack, Scope, Report that
provide details on where the error occurred and the error message received.
This almost seems like a Matlab bug, I don't know why the testRunner would
give less information than the standard run command. If the testRunner will
be required for code coverage information, I can look again at how to get
around this issue. However until code coverage is implemented, I think the
run command is more insightful.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#620 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABG2KF6UZ65A3KHGMSLUZ63TWM7PXANCNFSM47CEPKUA>
.
|
|
It's weird though, they should be equivalent ways of calling the same
thing. Do you mind if I take a look at this tomorrow morning?
Mat
…On Tue, Jul 6, 2021, 19:08 Mathew Topper ***@***.***> wrote:
I think I might have been calling the runner incorrectly. Can you try the
method here:
https://uk.mathworks.com/help/matlab/ref/matlab.unittest.testrunner-class.html#mw_8602d5ca-8748-4425-8fa1-9c2fdaef84e3
I.e.
runner = TestRunner.withTextOutput;
result = run(runner,suite);
T
On Tue, Jul 6, 2021, 18:55 Adam Keester ***@***.***> wrote:
> @H0R5E <https://github.com/H0R5E>
> That is a fair point, most users might not remember to turn on passive
> yaw when appropriate. Maybe we just remove the passive yaw regression
> altogether? The functionality will be covered in the Applications
> repository, though without a comparison to the previous result.
>
> My problem with the test runner is that it currently does not give the
> same diagnostic information as the run command (in R2021a). For example,
> right now the first BEMIO test fails (the fix is already in dev).
>
> When using the testRunner, results(1).Details is empty. Whereas the
> run(suites) command gives useful debugging information in
> Details.DiagnosticRecord such as Exception, Stack, Scope, Report that
> provide details on where the error occurred and the error message received.
>
> This almost seems like a Matlab bug, I don't know why the testRunner
> would give less information than the standard run command. If the
> testRunner will be required for code coverage information, I can look again
> at how to get around this issue. However until code coverage is
> implemented, I think the run command is more insightful.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#620 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABG2KF6UZ65A3KHGMSLUZ63TWM7PXANCNFSM47CEPKUA>
> .
>
|
|
Hi Mat, Yes I'll take a look at this today and can discuss with you over the next few days. |
|
I looked at the test plugins more today and discovered the one that seems to be recording diagnostic information in the testResult struct. I tested the following TestRunner options that contain the respective plugins: DiagnosticsRecordingPlugin is the option that adds the diagnostic information to the testResult object. This is included as the default plugin when Given these items, I opted for the following setup, which will contain TestRunProgressPlugin, DiagnosticsOutputPlugin, DiagnosticsRecordingPlugin and CodeCoveragePlugin. This results in sufficient debugging information and allows code coverage in the future. . |
|
@akeeste, good work. It's kind of weird that the DiagnosticsRecordingPlugin gets added in certain situations but not others. I would say that is probably a bug. Do you want me to review the PR? |
|
@H0R5E Yes that would be great. There should not be much changed since you pushed to this branch. Last note--I am aware of one BEMIO test currently failing. The dev branch already contains the fix for this and the tests should all pass once the PR is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @akeeste, overall I think this is a really good update to the testing framework. I've got a few minor style changes that I suggested in comments, but I also think there are three "blockers" to merging this right now. These are:
- The test suite should not fail just because of the combine_bem test. I've added a solution to this in akeeste#8
- There is no documentation added to describe how to use the test suite. There should be something, even if its just a docstring for the wecSimTest function.
- I don't think we should skip the passive yaw tests by default. It was 200 seconds without and 260 seconds with on my machine and I think once you're in the minutes an extra one won't hurt. Explaining to users how to turn off the tests (in the doctring or whatever) is a better approach.
I'm happy to help out with any of these changes, so just give me a shout.
Mat
EDIT: It's best to look at my comments in the Files changed tab, rather than below.
| hydro(end).body = {'cylinder_nemoh'}; | ||
| hydro = Read_WAMIT(hydro,'..\..\WAMIT\Cylinder\cyl.out',[]); | ||
| hydro(end).body = {'cylinder_wamit'}; | ||
| hydro = Combine_BEM(hydro); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to skip this test as a known error, rather than leave it as a failure. The automated CI is always going to fail if we leave it like this. See akeeste#8 for the approach to skip this test based on a known failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree the test should be skipped if the fix is not already present. However since this PR is only merging into dev, the fix will be present and the test will pass as soon as the PR is merged. To simplify this I pulled dev into this branch so that all tests are passing before the merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Shouldn't we be putting this into master as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed this wouldn't happen until the entire dev branch is merged into master and a new release is tagged. I believe v4.3 was planned for the near future.
|
Offered an improvement to the docstring in akeeste#9 |
Improve docstring of wecSimTest.m
H0R5E
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Please go ahead and merge it (I would recommend a squash and merge).
This PR restructures the CI tests into class-based continuous integration tests. Right now there are classes for each:
Each class has specific setup, teardown and test methods. I also added tests for the BEMIO functions to ensure they are working correctly. This should make it easier to properly skip long tests (irregular Passive Yaw, MCR application, etc) by marking them "incomplete" instead of "failed".
I still need to work on improving the test runtime. Creating a draft PR so @H0R5E can review.