crowdin-cli icon indicating copy to clipboard operation
crowdin-cli copied to clipboard

Add testReviewedOnly test

Open Genne23v opened this issue 2 years ago • 2 comments

I know this test should be updated, but I would like to discuss below.

  • Although there are many lines added from --reviewed implementation, many functions in DownloadSourceAction.java are private functions. Only act() function is public. Please let me know if you have any expectation for private functions.
  • Maybe my lack of understanding. To me, I see a few branches to add tests in act() function. I can change reviewedOnly, properties.getPreserveHierarchy(). I would like to seek some advice how to approach to this test suite.
  • I haven't found a way to test console messages to test below code. DownloadSourceAction.java line 85 to 88. But I'm not sure if this is a good test plan. Let me know what you think.
if (!isOrganization && this.reviewedOnly) {
            out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("error.only_enterprise")));
            return;
        }
  • Lastly, is there a way to check test coverage on my local?

Sorry that it took so long to get here. But I would appreciate your advise.

Genne23v avatar Oct 19 '22 08:10 Genne23v

Codecov Report

Merging #496 (0067249) into cli3 (80598c8) will increase coverage by 2.54%. The diff coverage is n/a.

@@             Coverage Diff              @@
##               cli3     #496      +/-   ##
============================================
+ Coverage     56.93%   59.47%   +2.54%     
- Complexity      984     1036      +52     
============================================
  Files           153      153              
  Lines          4771     4771              
  Branches        737      737              
============================================
+ Hits           2716     2837     +121     
+ Misses         1687     1538     -149     
- Partials        368      396      +28     
Impacted Files Coverage Δ
.../java/com/crowdin/cli/properties/SettingsBean.java 63.64% <0.00%> (ø)
...in/cli/commands/actions/DownloadSourcesAction.java 49.08% <0.00%> (+1.23%) :arrow_up:
.../com/crowdin/cli/properties/PropertiesBuilder.java 55.47% <0.00%> (+3.37%) :arrow_up:
...ava/com/crowdin/cli/properties/BaseProperties.java 59.19% <0.00%> (+4.09%) :arrow_up:
...in/java/com/crowdin/cli/properties/TargetBean.java 18.58% <0.00%> (+18.58%) :arrow_up:
...com/crowdin/cli/properties/PropertiesBuilders.java 48.49% <0.00%> (+21.22%) :arrow_up:
.../com/crowdin/cli/properties/ParamsWithTargets.java 33.34% <0.00%> (+33.34%) :arrow_up:
...owdin/cli/properties/PropertiesBuilderChecker.java 39.22% <0.00%> (+39.22%) :arrow_up:
...n/cli/properties/PropertiesWithTargetsBuilder.java 41.38% <0.00%> (+41.38%) :arrow_up:
...owdin/cli/properties/ProjectPropertiesBuilder.java 55.32% <0.00%> (+55.32%) :arrow_up:
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Oct 19 '22 08:10 codecov[bot]

@Genne23v thanks a lot for your contribution!

It looks like the test is not affecting coverage (according to the CodeCov report comment)

For generating coverage reports locally you could use the ./gradlew build jacocoTestReport command

@yevheniyJ could you please assist with the best way to write tests for this functionality?

andrii-bodnar avatar Oct 19 '22 08:10 andrii-bodnar

@andrii-bodnar I updated two tests. Although the coverage increase is small, it certainly improves. Please let me know if you have any suggestions. Thanks

Genne23v avatar Nov 17 '22 16:11 Genne23v

Hi @Genne23v, thanks a lot for the update!

Just left a minor comment, please take a look

andrii-bodnar avatar Nov 17 '22 16:11 andrii-bodnar

@Genne23v thanks for the contribution!

andrii-bodnar avatar Nov 18 '22 08:11 andrii-bodnar

@Genne23v thanks for the contribution!

It is my pleasure and I learned a lot from this project. Thanks

Genne23v avatar Nov 18 '22 16:11 Genne23v