File tree Expand file tree Collapse file tree
Sources/DatadogSDKTesting Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ extension Test: TestRun {
119119 }
120120
121121 func set( tag name: String , value: SpanAttributeConvertible ) {
122- setTag ( key: name, value: value)
122+ span . setAttribute ( key: name, value: value. spanAttribute )
123123 }
124124
125125 func set( metric name: String , value: Double ) {
Original file line number Diff line number Diff line change @@ -85,6 +85,27 @@ internal class DDXCTestObserverTests: XCTestCase {
8585 XCTAssertEqual ( spanData. attributes [ DDHostTags . hostVCPUCount] ? . description, String ( Double ( PlatformUtils . getCpuCount ( ) ) ) )
8686 }
8787
88+ func testWhenTestRunSetTagGetsBoolValue_tagIsSetAsStringAttribute( ) async {
89+ let group = DDXCTestRetryGroup ( for: self , observer: testObserver)
90+ testObserver. testBundleWillStart ( Bundle . main)
91+ testObserver. testSuiteWillStart ( theSuite)
92+ testObserver. testRetryGroupWillStart ( group)
93+
94+ let spanData = group. context. suite. withActiveTest ( named: self . testId. test) { test in
95+ test. set ( tag: " test.bool_tag " , value: true )
96+
97+ let span = OpenTelemetry . instance. contextProvider. activeSpan as! SpanSdk
98+ return span. toSpanData ( )
99+ }
100+
101+ testObserver. testRetryGroupDidFinish ( group)
102+ testObserver. testSuiteDidFinish ( theSuite)
103+ testObserver. testBundleDidFinish ( Bundle . main)
104+ await destroyObserver ( )
105+
106+ XCTAssertEqual ( spanData. attributes [ " test.bool_tag " ] , AttributeValue . string ( " true " ) )
107+ }
108+
88109 func testWhenTestCaseDidFinishIsCalled_testStatusIsSet( ) async {
89110 let group = DDXCTestRetryGroup ( for: self , observer: testObserver)
90111 testObserver. testBundleWillStart ( Bundle . main)
You can’t perform that action at this time.
0 commit comments