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

Improved testing coverage and TranscribeAudio endpoint refactor #50

Merged

Conversation

citomcclure
Copy link
Owner

Overall

Testing Coverage

Increased testing coverage from 35% to 55%:

image

TranscribeAudio Refactor

Created wrapper classes for S3 and Transcribe and moved non-business logic out of activity class. This made the class testable and provided much better readability.

Implementation

Unit tests for the following classes:

  • ModelConverter
  • NoteDateTimeConverter
  • TranscriptionUtils
  • GetNotesActivity
  • ClientProviders (ddb, s3, transcribe)
  • TranscribeAudioActivity

New methods (and moved logic):

  • S3Wrapper
    • putAudioInS3()
    • getAudioLocation()
    • getTranscriptionJobResult()
  • TranscribeWrapper
    • startTranscriptionJob()
    • pollTranscriptionJob()
  • TranscriptionUtils
    • getSampleRate()

Other

  • Remaining tests to write include S3Wrapper and TranscribeWrapper, which would put the testing coverage up to ~65%
  • Made several attempts at creating unit tests for ClientProvider classes. Was only able to test for null region. Likely would require a refactoring of those classes and how they are used in Dependency Injection by having each client provider class depend on the client builder and then providing those through DI. Then those builders could be mocked and the Region value could be intercepted using an ArgumentCaptor
  • For my own future reference, static methods make mocking a bit trickier and should not be used all the time for utility classes
  • Deleted CollectionUtils class - was not being used
  • Deleted methods from NullUtils class - were note being used
  • Deleted S3Utils class - moved bucket names over to S3Wrapper

…rTranscript(), and generateTranscriptionId()
…eturning no notes. Also removed last udpated values from NoteOrder since they are not being used and last updated time has not been implemented for sort yet.
…ion, log statements, and refactored use of transcription id, key, and job names to just all use id for readability in activity class.
…cumentation and fixed checkstyles for current branch.
…ogger being used as method argument and refactored broken unit test.
…r from activity. Updated test class. TranscribeAudioActivty fully refactored to only have business logic.
…to mock static method from AudioSystem for testing.
@citomcclure citomcclure merged commit 39e4313 into main Jun 20, 2024
3 checks passed
@citomcclure citomcclure linked an issue Jun 20, 2024 that may be closed by this pull request
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.

Refactor TranscribeAudioActivity for better testing coverage
1 participant