Documentation ¶
Overview ¶
Package utgen is a service that generates unit tests for a given source code file.
Index ¶
- Constants
- func GetCodeLanguage(sourceFilePath string) string
- func RunCommand(command string, cwd string, logger *zap.Logger) (stdout string, stderr string, exitCode int, commandStartTime int64, err error)
- type AIClient
- type Choice
- type CompletionParams
- type Coverage
- type CoverageProcessor
- func (cp *CoverageProcessor) ParseCoverageReport() (*models.CoverageResult, error)
- func (cp *CoverageProcessor) ParseCoverageReportCobertura() (*models.CoverageResult, error)
- func (cp *CoverageProcessor) ProcessCoverageReport(latestTime int64) (*models.CoverageResult, error)
- func (cp *CoverageProcessor) VerifyReportUpdate(latestTime int64) error
- type Cursor
- type Delta
- type Message
- type ModelResponse
- type Prompt
- type PromptBuilder
- type ResponseChunk
- type Service
- type Source
- type Telemetry
- type Test
- type UnitTestGenerator
- type Usage
Constants ¶
View Source
const ADDITIONAL_INCLUDES_TEXT = `` /* 217-byte string literal not displayed */
View Source
const ADDITIONAL_INSTRUCTIONS_TEXT = `
## Additional Instructions
======
{{.AdditionalInstructions}}
======
`
View Source
const FAILED_TESTS_TEXT = `` /* 250-byte string literal not displayed */
View Source
const MAX_TESTS_PER_RUN = 4
Variables ¶
This section is empty.
Functions ¶
func GetCodeLanguage ¶
Types ¶
type AIClient ¶
func NewAIClient ¶
type CompletionParams ¶
type CoverageProcessor ¶
CoverageProcessor handles the processing of coverage reports
func NewCoverageProcessor ¶
func NewCoverageProcessor(reportPath, srcpath, format string) *CoverageProcessor
NewCoverageProcessor initializes a CoverageProcessor object
func (*CoverageProcessor) ParseCoverageReport ¶
func (cp *CoverageProcessor) ParseCoverageReport() (*models.CoverageResult, error)
ParseCoverageReport parses the coverage report based on its type
func (*CoverageProcessor) ParseCoverageReportCobertura ¶
func (cp *CoverageProcessor) ParseCoverageReportCobertura() (*models.CoverageResult, error)
func (*CoverageProcessor) ProcessCoverageReport ¶
func (cp *CoverageProcessor) ProcessCoverageReport(latestTime int64) (*models.CoverageResult, error)
ProcessCoverageReport verifies the report and parses it based on its type
func (*CoverageProcessor) VerifyReportUpdate ¶
func (cp *CoverageProcessor) VerifyReportUpdate(latestTime int64) error
VerifyReportUpdate verifies the coverage report's existence and update time
type ModelResponse ¶
type PromptBuilder ¶
type PromptBuilder struct { Src *Source Test *Test CovReportContent string IncludedFiles string AdditionalInstructions string Language string Logger *zap.Logger }
func NewPromptBuilder ¶
func NewPromptBuilder(srcPath, testPath, covReportContent, includedFiles, additionalInstructions, language string, logger *zap.Logger) (*PromptBuilder, error)
func (*PromptBuilder) BuildPrompt ¶
func (pb *PromptBuilder) BuildPrompt(file, failedTestRuns string) (*Prompt, error)
type ResponseChunk ¶
type ResponseChunk struct {
Choices []Choice `json:"choices"`
}
type UnitTestGenerator ¶
type UnitTestGenerator struct { Files []string // contains filtered or unexported fields }
func NewUnitTestGenerator ¶
func (*UnitTestGenerator) GenerateTests ¶
func (*UnitTestGenerator) ValidateTest ¶
func (g *UnitTestGenerator) ValidateTest(generatedTest models.UT) error
Click to show internal directories.
Click to hide internal directories.