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

WIP: test(KMP): use mockative instead of mockito #5706

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

riQQ
Copy link
Collaborator

@riQQ riQQ commented Jun 24, 2024

Preparation for the move to KMP.

~150 tests are still failing. Some are blocked by bugs / missing features in Mockative, but maybe some or all of the failing tests can be changed to work around the issue or to just don't mocks.

Preparation for the move to KMP.
@westnordost

This comment was marked as resolved.

@westnordost
Copy link
Member

westnordost commented Jun 24, 2024

Also, I read somewhere that (at least) JavaScript does not support the fun `my quoted function name`() syntax and therefore this syntax cannot be used in multiplatform projects. I am not sure if this also applies if one does not target JS at all. But if it does, I guess all the nicely readable test functions would need to be renamed from fun `my cool function name`() to fun my_lame_function_name() (or worse, camelCase, but ...🤮)

@riQQ

This comment was marked as resolved.

@westnordost

This comment was marked as resolved.

@westnordost
Copy link
Member

(There are conflicts with master and the PR is marked as draft, that's why I didn't look at it in detail yet. In case you need feedback about something, let me know.)

@riQQ
Copy link
Collaborator Author

riQQ commented Jul 3, 2024

Also, I read somewhere that (at least) JavaScript does not support the fun `my quoted function name`() syntax and therefore this syntax cannot be used in multiplatform projects. I am not sure if this also applies if one does not target JS at all. But if it does, I guess all the nicely readable test functions would need to be renamed from fun `my cool function name`() to fun my_lame_function_name() (or worse, camelCase, but ...🤮)

I've seen this error at some point, I think when writing a test for a Mockative bug. So you're correct that we'll have to rename the methods when switching to the KMP project structure.

@riQQ
Copy link
Collaborator Author

riQQ commented Jul 3, 2024

(There are conflicts with master and the PR is marked as draft, that's why I didn't look at it in detail yet. In case you need feedback about something, let me know.)

Yes, that's why this PR is still a draft. I don't want to put in the work if Mockative doesn't fix / implement everything that is required for the tests here. Progress has slowed down there so I'm waiting, too.

@FloEdelmann FloEdelmann linked an issue Jul 20, 2024 that may be closed by this pull request
@riQQ

This comment was marked as resolved.

@westnordost
Copy link
Member

Mockative and that other one not being compatible with K2, it sounds to me that Mokkery would be the only remaining option (for us), if it has the features we need.

@riQQ riQQ added the blocked blocked by another issue label Sep 12, 2024
@TSampley
Copy link

What a coincidence! I just joined the OpenStreetMap site last week as I'm looking for non-corporate alternatives to Google maps! I just saw the bad news about Mockkative 😔 - I hope I can support this nifty effort!

@westnordost
Copy link
Member

Recently, a lot of tests are failing for me (on master), somethig something with mocks and mockito, even though I didn't even touch the mockito dependency version. So maybe with mockito this is already the same problem as with mockative, using K2 compiler. Do you (guys) also have this problem on master or is it just an issue with my setup?

@FloEdelmann
Copy link
Member

The unit tests are passing in the GitHub Actions run on master: https://github.com/streetcomplete/StreetComplete/actions/runs/11533612917/job/32106745912

@westnordost
Copy link
Member

westnordost commented Oct 28, 2024

hm, okay ¯\_(ツ)_/¯

@riQQ riQQ removed the blocked blocked by another issue label Nov 7, 2024
@riQQ
Copy link
Collaborator Author

riQQ commented Nov 7, 2024

Mockative V3.0.0 with support for Kotlin 2 has been released recently.

There is a migration guide to V3.

@westnordost
Copy link
Member

Cool! I hope it still makes sense for you to continue this PR despite the by now many conflicts and the fact that you need to migrate from v2 to v3.

(Say, do you know Clonk?)

@riQQ

This comment was marked as off-topic.

@westnordost

This comment was marked as off-topic.

@westnordost westnordost added the iOS necessary for iOS port label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS necessary for iOS port
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Use multiplatform mocking library for tests
4 participants