-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Discussion on alternatives to package:test_reflective_loader #44537
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
Comments
I doubt it's different. But
Yes.
@scheglov can speak more to the structure idea, but generally our tests are organized into classes, and some inherit from others (including test methods). |
We published The amount of maintenance for Actually, because Dart is object-oriented and class-based, I would argue that it is the right approach to writing tests :-P Also, I suspect that many large packages invent such highly customized team-specific approach to testing anyway. See also CFE, it has its own flavor - sets of input files, with expectations, and their own status files. I understand that initial reason why this discussion was started - there is a wish to remove
There was no design doc. Look at this change for example.
Later we started using mixins to host sets of tests and run them with slightly different configurations - in legacy, and in null safe modes for example. See this file as an example.
Using I will also note that at some point
See the documentation for @FailingTest. |
For the discussion, here's how reflective tests are defined: @reflectiveTest
class UtilitiesTest {
test_parseFile_default_resource_provider() {
...
}
test_parseFile_errors_noThrow() {
...
} This naming convention based test definition is similar to how JUnit 3 works. |
I can definitely see that reflective tests avoids some syntactic overhead, and allows code sharing through inheritance. (Arguably, having to create a Ihe reflective approach prevents some approaches supported by the You would probably be able to transform the existing reflective tests into traditional tests by adding: static void runTests() {
group("Utilities", () {
test("parseFile default resource provider", UtilitiesTest().test_parseFile_default_resource_provider);
test("parseFile default errors noThrow", UtilitiesTest().test_parseFile_errors_noThrow);
});
} to the Definitely more overhead, it's exactly this code that the reflection allows you to avoid writing (and it's something which is notoriously hard to keep up-to-date, with no warning if you forget it when adding a new test). I guess negative tests would have to be wrapped in It's also not using the So, this is effectively a different test framework. Can't prevent anyone from creating one, the only issue is who owns and maintains it, and which guarantees we provide for supporting it in the future (up to and including whether we want to keep maintaining The Dart project as such does not have any need for a second test framework, and most would probably prefer that everybody unifies behind the one recommended test framework. So, we're definitely not going to publish the reflective test package in dart-core. I don't see any alternatives to reflective_test which will still be class based, but without reflection, unless there is some repetition. It's impossible to declare something (statically) and refer to it dynamically without repeating its name. |
Actually, this package doesn't prevent that approach because it's built on top of the test package, so there isn't any problem using
I'd argue that it's an enhancement to the standard test framework in that it uses reflection to dynamically invoke
I suppose that depends on your definition of "need". The analyzer tests often have enough state that writing them without this support would be considerably more painful.
I would argue that many subteams have added enhancements to test recommended test framework, but that the analyzer team just happens to be the only ones to have used |
cc @lrhn @mit-mit - this is one of the Dart team packages that we had previously discussed as one that should not be published anymore.
I'd like to start the conversation on what we'd need in
package:test
or otherwise to drop this package. At a low level we want to minimize the surface area of published packages maintained by the Dart team. At a high level we want to avoid highly customized team-specific approaches to writing Dart.I've taken some of the discussion from #44489 to bootstrap.
@scheglov
Can you elaborate on this? Was there a design doc for
test_reflective_loader
that discussed the increase in structure?@srawlins
How does
@solo
differ from thesolo:
argument totest()
orgroup()
?What does
@failingTest
do? Is it something different fromskip:
? Does it specifically run the test and expect an exception (such that it would fail if the annotated test passes instead)? We could put a higher priority on dart-lang/test#1178 if those are the semantics you have today.What other features in
package:test
do we need to investigate to allow migrating back topackage:test
fromtest_reflective_loader
?The text was updated successfully, but these errors were encountered: