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

Unit tests coverage for properties helpers #491

Closed
6 tasks
andrii-bodnar opened this issue Oct 7, 2022 · 29 comments · Fixed by #500, #503 or #509
Closed
6 tasks

Unit tests coverage for properties helpers #491

andrii-bodnar opened this issue Oct 7, 2022 · 29 comments · Fixed by #500, #503 or #509

Comments

@andrii-bodnar
Copy link
Member

Some classes in the com.crowdin.cli.properties namespace have low coverage by Unit tests. It would be great to add Unit tests for these classes.

Similar tests for reference can be found here

@andrii-bodnar andrii-bodnar added good first issue hacktoberfest This issue welcomes contributions for Hacktoberfest labels Oct 7, 2022
@andrii-bodnar andrii-bodnar changed the title Unit test coverage for properties helpers Unit tests coverage for properties helpers Oct 7, 2022
@manish-singh-bisht
Copy link

Hey @andrii-bodnar in order to complete this task, what knowledge should one have?
Thank You

@andrii-bodnar
Copy link
Member Author

@manish-singh-bisht you need to have a basic knowledge of writing Unit tests in Java using Jupiter and Mockito libraries

@DukeRino7
Copy link
Contributor

DukeRino7 commented Oct 10, 2022

Hello @andrii-bodnar. Is it possible to assign this issue to write unit test and assing it to me? Thanks for reply.

@andrii-bodnar
Copy link
Member Author

Hi @DukeRino7! It sounds great! I would suggest you to check the code coverage report, find the part of code you like and cover this code by unit tests. What do you think about this idea? Or you need a specific issue for that?

@andrii-bodnar
Copy link
Member Author

andrii-bodnar commented Oct 10, 2022

@DukeRino7 also, this issue is unassigned yet. I could assign it to you

@DukeRino7
Copy link
Contributor

DukeRino7 commented Oct 10, 2022

@andrii-bodnar im not sure if Iam able to do tests for all classes.can i take a look at the code and write you tomorrow? Until then can you assign me to this issue?

@andrii-bodnar
Copy link
Member Author

@DukeRino7 you can split this issue into several PRs and begin from just one or two classes

@DukeRino7
Copy link
Contributor

@DukeRino7 you can split this issue into several PRs and begin from just one or two classes

@andrii-bodnar ok i think it can work. Can you assign it to me?

@andrii-bodnar
Copy link
Member Author

Hi @DukeRino7, do you need any assistance here? Just wondering what the progress on this issue

@DukeRino7
Copy link
Contributor

Hello @andrii-bodnar. I had some problems but now im working on it. If i will be in trouble i will write you. Do you have specific deadline or something like that?

@andrii-bodnar
Copy link
Member Author

@DukeRino7 thanks for the update! There is no specific deadline 🙂

@DukeRino7
Copy link
Contributor

@andrii-bodnar i will do it as fast as possible

@calfaand
Copy link
Contributor

calfaand commented Nov 3, 2022

Hello, can I contribute to this project with writing tests ?

@andrii-bodnar
Copy link
Member Author

Hi @calfaand, sure, thank you!

Feel free to take some classes from the issue description.

Also, you are welcome to check other parts of the project for classes or methods where it's possible to write some tests.

@andrii-bodnar
Copy link
Member Author

andrii-bodnar commented Nov 3, 2022

@DukeRino7 which classes you are currently working on?

@calfaand
Copy link
Contributor

calfaand commented Nov 3, 2022

@andrii-bodnar so I will take the first 3 classes okay?

@andrii-bodnar
Copy link
Member Author

@calfaand sure, please let me know if you need any assistance

@calfaand
Copy link
Contributor

calfaand commented Nov 5, 2022

@andrii-bodnar In PropertiesWithTargetBuilder.java you will always get exception because Targets are not able to be initialized. Problem lies in ParamsWithTargets as it does not have any variable Targets that can be populated if you are not using config file. Is this by design or it's only possible way of doing that?

@andrii-bodnar
Copy link
Member Author

@calfaand what exact method do you mean? As I see from the PropertiesWithTargetsBuilder class, we call the getTargets getter only once:

https://github.com/crowdin/crowdin-cli/blob/cli3/src/main/java/com/crowdin/cli/properties/PropertiesWithTargetsBuilder.java#L68

It is called on the props object which is the PropertiesWithTargets class instance

@calfaand
Copy link
Contributor

calfaand commented Nov 6, 2022

I mean this class.
https://github.com/crowdin/crowdin-cli/blob/cli3/src/main/java/com/crowdin/cli/properties/ParamsWithTargets.java

If I try to initialize targets with this class I am not able to do this.

@andrii-bodnar
Copy link
Member Author

@calfaand I'm not sure if I understand you correctly. Could you please provide the related code and the failed test error message?

@andrii-bodnar andrii-bodnar linked a pull request Nov 7, 2022 that will close this issue
@DukeRino7
Copy link
Contributor

@andrii-bodnar i get to point where i want to test some methods but they are "protected". How can i continue? Because from my understanding i cant reach protected methods when test are in different folder. Should i chAnge them to public? Thanks for advice.

@andrii-bodnar
Copy link
Member Author

@DukeRino7 it's not recommended to make some methods public just for tests. I'm not familiar with Java Unit testing so I'm not sure how to test such methods. Maybe there is some workaround.

@DukeRino7
Copy link
Contributor

@andrii-bodnar okay, today i will look into it and hopefully i will be able to make it work somehow. If i will find way to make it work i will probably finish writing test this week. I will keep you updated If i will have some difficulties

@andrii-bodnar
Copy link
Member Author

@DukeRino7 great, thanks for the update!

@DukeRino7
Copy link
Contributor

@andrii-bodnar i find way how to test methods and im writing test for them right now. Sorry for lack of communication up to now, i had some problems that i need to solve first. Now im working on it and hopefully i will be able to finish writing test this week. I will also keep you updated about my progress.

@andrii-bodnar
Copy link
Member Author

@DukeRino7 no worries, thanks for the update!

@DukeRino7
Copy link
Contributor

@andrii-bodnar hello, i request pull, coverage is increased by 2,5%

@andrii-bodnar
Copy link
Member Author

Hi @DukeRino7, awesome, thanks a lot for the contribution!

Briefly looked over the PR and it looks good to me. I'll review it in more detail tomorrow and then will merge it. Thanks!

@andrii-bodnar andrii-bodnar linked a pull request Nov 10, 2022 that will close this issue
@andrii-bodnar andrii-bodnar linked a pull request Nov 25, 2022 that will close this issue
@andrii-bodnar andrii-bodnar added tests and removed hacktoberfest This issue welcomes contributions for Hacktoberfest labels Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants