Skip to content

Conversation

@Randall-Jiang
Copy link
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

The lineOfCodeGenerated and charOfCodeGenerated mismatch numOfUnitTestCaseGenerated which returned from backend. There are 3 situations:

  1. Job failed: The IDE would send a non zero numOfUnitTestCaseGenerated telemetry while the lineOfCodeGenerated and charOfCodeGenerated are 0s.
  2. Job success, test file not exist: If there is no corresponding test file in the package before generate unit test, both lineOfCodeGenerated and charOfCodeGenerated will be 0.
  3. Job success, test file already exist: If there is a corresponding test file already exist, the values for lineOfCodeGenerated and charOfCodeGenerated are still incorrect. Instead of reflecting the newly generated code, the IDE returns the existing test file's total line and character counts.

I implement a new function called getGeneratedFileContent and correct the calculate logic

Checklist

  • [ x] My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Randall-Jiang Randall-Jiang marked this pull request as ready for review January 13, 2025 22:59
@Randall-Jiang Randall-Jiang requested a review from a team as a code owner January 13, 2025 22:59
@Randall-Jiang Randall-Jiang requested a review from ctlai95 January 15, 2025 03:50
@Randall-Jiang Randall-Jiang changed the title feat(amazonq): Fixing an issue that cause the discrepancy between NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated Fix(amazonq): Discrepancy between NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated Jan 15, 2025
@Randall-Jiang Randall-Jiang changed the title Fix(amazonq): Discrepancy between NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated Telemetry(amazonq): Discrepancy between NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated Jan 15, 2025
@Randall-Jiang Randall-Jiang enabled auto-merge (squash) January 15, 2025 17:59
@Randall-Jiang Randall-Jiang merged commit f06bab3 into aws:main Jan 15, 2025
11 checks passed
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 17, 2025
…ith LinesGenerated and CharsGenerated (aws#5254)

* lint

* fix the issue about the discrepancy between  NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated

* fix format issue

* remove print command
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 22, 2025
…ith LinesGenerated and CharsGenerated (aws#5254)

* lint

* fix the issue about the discrepancy between  NumOfUnitTestCasesGenerated with LinesGenerated and CharsGenerated

* fix format issue

* remove print command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants