Open IgnatBeresnev opened 1 year ago
Improving the integration tests is also connected to improving Dokka's Gradle build files #2703, since the integration tests break project isolation to publish Dokka to Maven Local
I'm working on a Gradle Plugin for solving this problem, (though it's still awaiting approval in the Plugin Portal). I actually manually tested it using Dokka! It required a significant amount of changes though, so I'll make a PR as a demonstration, but I wanted to break it up into smaller pieces.
There was a discussion on Gradle Slack this week and https://github.com/gradle/exemplar was recommended for running integration tests. Although I find it pretty tough to understand how to use it, I think it would be worth investigating.
Grooming notes
We have some integration tests already, but they've proven to be somewhat difficult to maintain, to extend, and they have some problems in their core that are getting in the way of other related things. These tests were a good start, but since their inception we've figured out additional use cases, figured out what works and what doesn't, and what's useful or would be nice to have in general.
The hypothesis is that it'll be much easier and faster to start completely from scratch and re-implement integration (e2e) tests based on the specific desires / requirements and our experience, than to try to salvage the existing tests. Moreover, starting from scratch should also be safer, as it'll allow us to have a seamless transition from the old tests to the new, without worrying that the old (primary) tests accidentally break after refactoring.
There are two types of integration / end-to-end tests:
They could have the same setup (like now), but because they are useful in different ways - it might be easier to separate them, where each type has its own requirements.
Examples of issues it helps find:
NoSuchMethodException
or something similar.Notes:
Examples of issues it helps find:
Notes:
Some pain points of the existing tests:
dokka-subprojects
should mark the tests as not up to date.Things to keep in mind while designing the solution:
Error class
substrings in signatures, or that private API is not documented. Right now these asserts are somewhat copy-pasted, it would be nice to have a single place for them or to make the copy-paste as little as possible.cinterop
types were resolved properly in a Kotlin/Native test project.-dev
versions of KGP and/or RC versions of Gradle from CI builds (so the use of dynamic versions)dokkaHtml
, but also some other/additional ones, so that we can verify other formats or intermediate results.It makes sense to start with something smaller and approachable, and then build on top of it.
The first iteration can focus on:
Dokka's integration tests run Dokka on real projects using various versions of Gradle, Kotlin and Android, and make sure there are no abnormalities, all links are present, everything is resolved and is able to be built, etc. This is extremely useful, and the same behaviour should be preserved.
Additionally, the integration tests are used for generating and publishing live demos of documentation to S3, which is very useful for reviewing UI/UX changes. This feature should be preserved as well.
However, the way that the tests are set up now is not optimal, and it's causing problems in various places:
kotlinx.coroutines
, are imported as git submodules. This is just annoying to maintain and update, and not obvious to someone encountering it for the first time. Maybe these projects could be added as dependencies, more information hereThe outlined problems should be researched and addressed if possible.