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

Increase test coverage Arrow Core #2894

Open
5 of 9 tasks
nomisRev opened this issue Jan 19, 2023 · 23 comments
Open
5 of 9 tasks

Increase test coverage Arrow Core #2894

nomisRev opened this issue Jan 19, 2023 · 23 comments

Comments

@nomisRev
Copy link
Member

nomisRev commented Jan 19, 2023

This ticket tracks classes that are lacking in test coverage. All of this code has been stable for a long time, but it's a good way to get familiar with the Arrow codebase.

If you're looking to contribute to Arrow, and want a small piece of work writing some tests is a good way to get started. If you're not sure if a function, or code branch, is missing coverage in a certain file you can run ./gradlew koverHtmlReport and open the resulting report.

Or feel free to pick any of the items listed below and add missing tests for the .kt file.

Arrow Core

@lgtout
Copy link
Collaborator

lgtout commented Jan 25, 2023

@raulraja @nomisRev Please assign this to me. Thanks!

@poseidon2060
Copy link
Contributor

Hey, @nomisRev I'm going to try this issue out since I am not very well-versed with Kotlin Tests so this can be a good learning opportunity for me.😄
Can you brief me slightly on what to learn and how to approach this issue?

@lgtout
Copy link
Collaborator

lgtout commented Feb 3, 2023

@nomisRev Multiple contributors working on the same issue. Should it be split? What do you propose?
@poseidon2060 I'm working on currying.kt, so don't do that one. Thanks!
Posting on here which one you're working on might be a good idea, too.

@poseidon2060
Copy link
Contributor

@nomisRev Multiple contributors working on the same issue. Should it be split? What do you propose?
@poseidon2060 I'm working on currying.kt, so don't do that one. Thanks!
Posting on here which one you're working on might be a good idea, too.

Yes, I was planning to work on Either.kt anyways since I just worked on that file in another issue.

@nomisRev
Copy link
Member Author

nomisRev commented Feb 3, 2023

@poseidon2060 & @lgtout I added in the list that both are in progress by you, and checked the items. I would say to avoid having to create so many issues, we can just continue this approach.

If you want to work on something, or started working on something just tag me here and mention what you're working on and I'll update the original comment to reflect this. Thank you both for your contributions 🙏

lgtout added a commit to lgtout/arrow that referenced this issue Feb 3, 2023
lgtout added a commit to lgtout/arrow that referenced this issue Feb 3, 2023
@poseidon2060
Copy link
Contributor

I'm sorry @nomisRev but I'll be a bit slow with this issue since I have my exams going on, I assure you that I'm slowly learning and working on it.

@nomisRev
Copy link
Member Author

nomisRev commented Feb 4, 2023

No worries at all @poseidon2060! Exams are more important, so take your time and focus on exams. The Either issue is reserved for you 😉 And best of luck! 🤞

@poseidon2060
Copy link
Contributor

hey @nomisRev, I am available and can continue working on this issue, can you please guide me slightly on how to approach this issue? Thanks!😄

@nomisRev
Copy link
Member Author

Hey @poseidon2060,
Sorry for the late reply. In terms of guidance, we don't have any strict rules around tests but we favour property based tests. I'm not sure if you're familiar with those, but they test behavior without assuming anything about the generic code since Either for example is a structure that doesn't care about what values is nested inside E or A. You can find some more guidance here, https://kotest.io/docs/proptest/property-based-testing.html and inside of the EitherTest.kt file you will find many examples of what is currently already being tested.

To figure out what tests are missing I suggest running ./gradlew :arrow-core:koverHtmlReport and then checking the html page that is outputted by Gradle after the tasks finishes running. There you will find insights into which methods, or code branches, are missing test coverage.

Feel free to ask more questions here, or open a PR and I'd be happy to provide more guidance.

lgtout added a commit to lgtout/arrow that referenced this issue Feb 18, 2023
lgtout added a commit to lgtout/arrow that referenced this issue Feb 18, 2023
lgtout added a commit to lgtout/arrow that referenced this issue Feb 18, 2023
@gutiory
Copy link
Collaborator

gutiory commented Feb 21, 2023

As I've been working Ior API deprecation, I'm taking Ior 😎

lgtout added a commit to lgtout/arrow that referenced this issue Feb 21, 2023
lgtout added a commit to lgtout/arrow that referenced this issue Feb 21, 2023
lgtout added a commit to lgtout/arrow that referenced this issue Feb 21, 2023
@lgtout
Copy link
Collaborator

lgtout commented Feb 21, 2023

@nomisRev partials.kt needs the unreleased high-arity Kotest property testing methods, so I'll take it. Please update the checklist for me. Thanks!

@poseidon2060
Copy link
Contributor

Hey @poseidon2060, Sorry for the late reply. In terms of guidance, we don't have any strict rules around tests but we favour property based tests. I'm not sure if you're familiar with those, but they test behavior without assuming anything about the generic code since Either for example is a structure that doesn't care about what values is nested inside E or A. You can find some more guidance here, https://kotest.io/docs/proptest/property-based-testing.html and inside of the EitherTest.kt file you will find many examples of what is currently already being tested.

To figure out what tests are missing I suggest running ./gradlew :arrow-core:koverHtmlReport and then checking the html page that is outputted by Gradle after the tasks finishes running. There you will find insights into which methods, or code branches, are missing test coverage.

Feel free to ask more questions here, or open a PR and I'd be happy to provide more guidance.

Hey @nomisRev, just wanted to update you on my progress with the issue
I apologise I was not being very active with the assigned issue, I just had some work come up urgently with college
I am finally free now and have started working on the issue, will give an update by tomorrow💪🫡

@nomisRev
Copy link
Member Author

Hey @poseidon2060,

I apologise I was not being very active with the assigned issue, I just had some work come up urgently with college
No worries at all! ☺️ School, and life, definitely comes first! Thank you for taking an interest and the time to look into and contribute to Arrow 🙏

@poseidon2060
Copy link
Contributor

Hey @nomisRev,

I am not very experienced with testing but with help of link you provided and referring to already written tests, I came up with following test for flatMap function in Either
Can you check if it's correct or not and point out the mistakes?

"flatMap should preserve Left value and transform the Right value" {
    checkAll(
      Arb.either(Arb.string(), Arb.int()),
      Arb.int().filter { it > 0 }
    ) { either, int ->
      val f = { b: Int -> Either.right(b * int) }
      when (either) {
        is Either.Left -> either.flatMap(f) == either
        is Either.Right -> either.flatMap(f) == (either.value * int).right()
      }
    }
  }

I may have made a lot of mistakes but I am trying to learn🫡

@gutiory
Copy link
Collaborator

gutiory commented Feb 27, 2023

Ior tests are added in 818cab1 (#2928), inside the same API deprecatiion PR. New tests are added where missed, except for the deprecated methods.

@abendt abendt mentioned this issue Mar 6, 2023
@abendt
Copy link
Contributor

abendt commented Mar 6, 2023

hi @nomisRev i have created a PR that contains a couple of tests for Iterable: #2960

@abendt
Copy link
Contributor

abendt commented Mar 6, 2023

Also i think there is a bug in the implementation of unalign. Its not exposed by the tests because Arb.ior only generates Ior.Both values. In effect some of branches in the logic are never executed. When the Arb is fixed (see PR) the test "align is the inverse of unalign" starts to fail.

@l2hyunwoo
Copy link
Contributor

Hey @nomisRev Can you assign me on NonEmptyList.kt issue?

@nomisRev
Copy link
Member Author

Done @l2hyunwoo ☺️ Thank you for taking an interest to contributing. Feel free to ask any questions or doubts you have here or an a draft PR 😉

@abendt
Copy link
Contributor

abendt commented Mar 11, 2023

Hi @nomisRev. I would also like to work on the Map tests. Please update the list

nomisRev pushed a commit that referenced this issue Apr 3, 2023
Co-authored-by: Julian Abiodun <lgtout@users.noreply.github.com>
Co-authored-by: Alejandro Serrano <trupill@gmail.com>
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 13, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 13, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 16, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 17, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 17, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 25, 2023
jsoizo added a commit to jsoizo/arrow that referenced this issue Apr 25, 2023
@daczczcz1
Copy link

@nomisRev Hello, is this task still valid? I would like to start working on it but I can see there is already an open PR for Iterable. Not sure about the last two items on the list.

@pimfm
Copy link
Contributor

pimfm commented Oct 13, 2023

Good day @nomisRev,

Could you assign me to the Tuples and Partials ones?
The PR for the Tuples is #3143, with Partials up next :)

@HOjjAT87
Copy link

HOjjAT87 commented Dec 1, 2023

I have some free time, assign me anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants