Skip to content
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

Move common test resources to a central location #23

Open
Whathecode opened this issue Oct 10, 2018 · 9 comments
Open

Move common test resources to a central location #23

Whathecode opened this issue Oct 10, 2018 · 9 comments
Assignees
Labels
enhancement Nice to have, non-functional requirements.

Comments

@Whathecode
Copy link
Member

While adding tests for the new carp.deployment submodule, I had to create test classes and functions to initialize common study protocols.

This is very similar to the test classes and objects in carp.protocols. Can these be moved to common test resources somehow? This might not be as straightforward due to the multiplatform setup (of course, creating yet another library would be an option, but this seems a bit excessive). Moving them to the existing carp.test library would not be possible since then a dependency on carp.protocols would need to be added to carp.test, resulting in a two-way dependency.

@Whathecode Whathecode added the enhancement Nice to have, non-functional requirements. label Oct 10, 2018
@Whathecode
Copy link
Member Author

Possibly related:

While implementing test classes for carp.client.core I now also had to implement a InMemoryDeploymentRepository. This could ideally be tested through the DeploymentRepositoryTest interface provide in carp.deployment.core tests.

How can this be referenced?

@Whathecode
Copy link
Member Author

Similarly, it should be possible to create a base class for <ApplicationService>RequestsTest for each of the application services.

@Whathecode
Copy link
Member Author

Being able to depend on test resources of a project within the same build would resolve this, but I am having an extremely hard time figuring out how to do this.

Posted on Stack Overflow: How to add dependencies to tests of another project in a multi-platform multi-project Kotlin build

@Whathecode
Copy link
Member Author

Since being able to depend on test resources of a project does not seem to have high priority, I already went ahead and moved common protocols test sources to the infrastructure namespace of carp.protocols: https://github.com/cph-cachet/carp.core-kotlin#stub-classes

There might still be merit in refactoring <ApplicationService>RequestsTest to a common base class, which currently is not possible since it relies on kotlin.test and aren't just some test stubs which are reused, independent from the test framework used. Therefore, I will leave this open for now.

@Whathecode
Copy link
Member Author

Similarly, it should be possible to create a base class for <ApplicationService>RequestsTest for each of the application services.

Ran into this again while adding tests for ParticipationService. I think it is time to figure out which dependencies it has and maybe add a carp.common.test which depends on carp.test submodule to at least remove this duplication across all application services right now. It could test common DDD patterns.

@Whathecode
Copy link
Member Author

Currently, integration tests of infrastructure building on top of CARP core needs to retest some of the post conditions of requests on application services.

In case we include a test resources module to CARP core, we could expose post condition checks for operators to centralize these tests.

@Whathecode
Copy link
Member Author

Whathecode commented Apr 16, 2021

More common test logic: ApplicationServiceReflectionTest is copied to each subsystem's JVM tests.

This can currently not be centralized in carp.test because it relies on accessing the ApplicationService and IntegrationEvent type defined in carp.common, and carp.test does not depend on carp.common, and cannot since this would be a bidirectional dependency.

@Whathecode
Copy link
Member Author

Some of these issues have been resolved. I added a 🚀 to each underlying issue for which a suitable solution has been found. I added 👀 to those which still need attention.

However, for the time being, given that Kotlin multiplatform doesn't allow linking to common test sources, I don't see an immediate solution, other than for each module (e.g., carp.deployments.core) creating a corresponding *.test module.

@Whathecode
Copy link
Member Author

The limitation of not being able to publish test sources has to do with Kotlin multiplatform. But, is it perhaps possible to publish the JVM test sources separately instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Nice to have, non-functional requirements.
Projects
None yet
Development

No branches or pull requests

1 participant