Documentation
¶
Index ¶
- func CollectAllPaths(elem *etree.Element, parentPath string) []string
- func CompareDOMTrees(original, marshaled *etree.Element, path string, comp *DOMComparison)
- func GenerateFieldCoverageReport(t *testing.T, xmlPath string, validator RoundTripValidator)
- func GetTestFilePath(messageType, version, filename string) string
- func LoadTestFileFromFS(t *testing.T, fsys embed.FS, filename string) []byte
- func Max(a, b int) int
- func RunConformanceTests(t *testing.T, messageType, version string, unmarshaler UnmarshalerFunc, ...)
- func RunConformanceTestsFS(t *testing.T, fsys embed.FS, testFiles TestFileMap, ...)
- func RunConformanceTestsWithData(t *testing.T, testData map[string][]byte, unmarshaler UnmarshalerFunc, ...)
- func RunFieldCompletenessTests(t *testing.T, fsys embed.FS, testFiles TestFileMap, ...)
- func RunIntegrityTests(t *testing.T, messageType, version string, validator RoundTripValidator)
- func RunMarshalingPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc, ...)
- func RunPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc)
- func RunRoundTripPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc, ...)
- func ValidateRequiredFields(t *testing.T, fields []FieldCheck)
- type DOMComparison
- type FieldCheck
- type RoundTripValidator
- type TestFileMap
- type UnmarshalerFunc
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectAllPaths ¶
CollectAllPaths collects all unique element paths in the XML
func CompareDOMTrees ¶
func CompareDOMTrees(original, marshaled *etree.Element, path string, comp *DOMComparison)
CompareDOMTrees recursively compares two XML DOM trees
func GenerateFieldCoverageReport ¶
func GenerateFieldCoverageReport(t *testing.T, xmlPath string, validator RoundTripValidator)
GenerateFieldCoverageReport generates a detailed field coverage report using a custom validator
func GetTestFilePath ¶
GetTestFilePath returns the full path to a test file (for non-embed usage)
func LoadTestFileFromFS ¶
LoadTestFileFromFS loads and returns the content of a test file from embedded FS
func RunConformanceTests ¶
func RunConformanceTests(t *testing.T, messageType, version string, unmarshaler UnmarshalerFunc, validator ValidatorFunc)
RunConformanceTests runs conformance tests by dynamically scanning for test files
func RunConformanceTestsFS ¶
func RunConformanceTestsFS(t *testing.T, fsys embed.FS, testFiles TestFileMap, unmarshaler UnmarshalerFunc, validator ValidatorFunc)
RunConformanceTestsFS runs conformance tests using embedded file system (legacy)
func RunConformanceTestsWithData ¶
func RunConformanceTestsWithData(t *testing.T, testData map[string][]byte, unmarshaler UnmarshalerFunc, validator ValidatorFunc)
RunConformanceTestsWithData runs conformance tests using embedded data maps
func RunFieldCompletenessTests ¶
func RunFieldCompletenessTests(t *testing.T, fsys embed.FS, testFiles TestFileMap, unmarshaler UnmarshalerFunc, fieldValidator func(*testing.T, interface{}, string))
RunFieldCompletenessTests runs tests to verify required fields are populated using embedded FS
func RunIntegrityTests ¶
func RunIntegrityTests(t *testing.T, messageType, version string, validator RoundTripValidator)
RunIntegrityTests runs XML round-trip integrity tests with a custom validator
func RunMarshalingPerformanceTests ¶
func RunMarshalingPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc, marshaler func(interface{}) ([]byte, error))
RunMarshalingPerformanceTests runs performance benchmarks for marshaling by dynamically scanning for test files
func RunPerformanceTests ¶
func RunPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc)
RunPerformanceTests runs performance benchmarks for parsing by dynamically scanning for test files
func RunRoundTripPerformanceTests ¶
func RunRoundTripPerformanceTests(b *testing.B, messageType, version string, unmarshaler UnmarshalerFunc, marshaler func(interface{}) ([]byte, error))
RunRoundTripPerformanceTests runs performance benchmarks for full round-trip operations by dynamically scanning for test files
func ValidateRequiredFields ¶
func ValidateRequiredFields(t *testing.T, fields []FieldCheck)
ValidateRequiredFields validates that required fields are not nil/empty
Types ¶
type DOMComparison ¶
type DOMComparison struct {
ElementsOriginal int
ElementsMarshaled int
AttributesOriginal int
AttributesMarshaled int
MissingElements []string
MissingAttributes []string
ValueMismatches []string
ExtraElements []string
MarshaledParseable bool // Can the marshaled XML be parsed back successfully
Success bool
}
DOMComparison holds the comparison results between two XML documents
func PerformRoundTripValidation ¶
func PerformRoundTripValidation(xmlPath string, validator RoundTripValidator) *DOMComparison
PerformRoundTripValidation performs XML → Proto → XML validation with a custom validator
func PerformRoundTripValidationFromData ¶
func PerformRoundTripValidationFromData(originalXML []byte, validator RoundTripValidator) *DOMComparison
PerformRoundTripValidationFromData performs XML → Proto → XML validation with a custom validator using byte data
type FieldCheck ¶
type FieldCheck struct {
Name string
Value interface{}
}
FieldCheck represents a field validation check
type RoundTripValidator ¶
RoundTripValidator represents a function that can perform round-trip validation
type TestFileMap ¶
TestFileMap represents a map of test name to filename
type UnmarshalerFunc ¶
UnmarshalerFunc represents a function that can unmarshal XML data to a message
type ValidatorFunc ¶
ValidatorFunc represents a function that validates a parsed message