@@ -129,27 +129,27 @@ jobs:
129129 exit 1
130130 fi
131131
132- - name : Test Action - Custom Output Path
132+ - name : Test Action - Custom Output Directory
133133 uses : ./
134134 with :
135135 trx-file-path : ' ./TestResults/sample.trx'
136- output-path : ' ./custom-playlist.playlist '
136+ output-directory : ' ./custom-playlists '
137137 test-outcomes : ' Failed,Passed'
138138 artifact-name : ' test-playlist-custom'
139139
140140 - name : Verify custom playlist file was created
141141 run : |
142- if [ -f "./custom-playlist .playlist" ]; then
142+ if [ -f "./custom-playlists/sample .playlist" ]; then
143143 echo "✅ Custom playlist file created successfully"
144144 echo "Content:"
145- cat "./custom-playlist .playlist"
145+ cat "./custom-playlists/sample .playlist"
146146 # Ensure playlist is not empty
147- if [ ! -s "./custom-playlist .playlist" ]; then
147+ if [ ! -s "./custom-playlists/sample .playlist" ]; then
148148 echo "❌ Custom playlist file is empty"
149149 exit 1
150150 fi
151151 # Ensure playlist contains at least one test name (e.g., TestMethod1 or TestMethod2)
152- if grep -q "TestMethod" "./custom-playlist .playlist"; then
152+ if grep -q "TestMethod" "./custom-playlists/sample .playlist"; then
153153 echo "✅ Custom playlist contains test names"
154154 else
155155 echo "❌ Custom playlist does not contain any test names"
@@ -165,18 +165,18 @@ jobs:
165165 uses : ./
166166 with :
167167 trx-file-path : ' ./TestResults/comprehensive.trx'
168- output-path : ' ./passed-only.playlist '
168+ output-directory : ' ./passed-only'
169169 test-outcomes : ' Passed'
170170 artifact-name : ' test-playlist-passed'
171171
172172 - name : Verify passed-only playlist
173173 run : |
174- if [ -f "./passed-only.playlist" ]; then
174+ if [ -f "./passed-only/comprehensive .playlist" ]; then
175175 echo "✅ Passed-only playlist created successfully"
176176 echo "Content:"
177- cat "./passed-only.playlist"
177+ cat "./passed-only/comprehensive .playlist"
178178 # Should contain only PassedTest
179- if grep -q "PassedTest" "./passed-only.playlist"; then
179+ if grep -q "PassedTest" "./passed-only/comprehensive .playlist"; then
180180 echo "✅ Contains expected PassedTest"
181181 else
182182 echo "❌ Missing expected PassedTest"
@@ -191,18 +191,18 @@ jobs:
191191 uses : ./
192192 with :
193193 trx-file-path : ' ./TestResults/comprehensive.trx'
194- output-path : ' ./notexecuted-only.playlist '
194+ output-directory : ' ./notexecuted-only'
195195 test-outcomes : ' NotExecuted'
196196 artifact-name : ' test-playlist-notexecuted'
197197
198198 - name : Verify NotExecuted-only playlist
199199 run : |
200- if [ -f "./notexecuted-only.playlist" ]; then
200+ if [ -f "./notexecuted-only/comprehensive .playlist" ]; then
201201 echo "✅ NotExecuted-only playlist created successfully"
202202 echo "Content:"
203- cat "./notexecuted-only.playlist"
203+ cat "./notexecuted-only/comprehensive .playlist"
204204 # Should contain only NotExecutedTest
205- if grep -q "NotExecutedTest" "./notexecuted-only.playlist"; then
205+ if grep -q "NotExecutedTest" "./notexecuted-only/comprehensive .playlist"; then
206206 echo "✅ Contains expected NotExecutedTest"
207207 else
208208 echo "❌ Missing expected NotExecutedTest"
@@ -217,18 +217,18 @@ jobs:
217217 uses : ./
218218 with :
219219 trx-file-path : ' ./TestResults/comprehensive.trx'
220- output-path : ' ./inconclusive-only.playlist '
220+ output-directory : ' ./inconclusive-only'
221221 test-outcomes : ' Inconclusive'
222222 artifact-name : ' test-playlist-inconclusive'
223223
224224 - name : Verify Inconclusive-only playlist
225225 run : |
226- if [ -f "./inconclusive-only.playlist" ]; then
226+ if [ -f "./inconclusive-only/comprehensive .playlist" ]; then
227227 echo "✅ Inconclusive-only playlist created successfully"
228228 echo "Content:"
229- cat "./inconclusive-only.playlist"
229+ cat "./inconclusive-only/comprehensive .playlist"
230230 # Should contain only InconclusiveTest
231- if grep -q "InconclusiveTest" "./inconclusive-only.playlist"; then
231+ if grep -q "InconclusiveTest" "./inconclusive-only/comprehensive .playlist"; then
232232 echo "✅ Contains expected InconclusiveTest"
233233 else
234234 echo "❌ Missing expected InconclusiveTest"
@@ -243,18 +243,18 @@ jobs:
243243 uses : ./
244244 with :
245245 trx-file-path : ' ./TestResults/comprehensive.trx'
246- output-path : ' ./timeout-only.playlist '
246+ output-directory : ' ./timeout-only'
247247 test-outcomes : ' Timeout'
248248 artifact-name : ' test-playlist-timeout'
249249
250250 - name : Verify Timeout-only playlist
251251 run : |
252- if [ -f "./timeout-only.playlist" ]; then
252+ if [ -f "./timeout-only/comprehensive .playlist" ]; then
253253 echo "✅ Timeout-only playlist created successfully"
254254 echo "Content:"
255- cat "./timeout-only.playlist"
255+ cat "./timeout-only/comprehensive .playlist"
256256 # Should contain only TimeoutTest
257- if grep -q "TimeoutTest" "./timeout-only.playlist"; then
257+ if grep -q "TimeoutTest" "./timeout-only/comprehensive .playlist"; then
258258 echo "✅ Contains expected TimeoutTest"
259259 else
260260 echo "❌ Missing expected TimeoutTest"
@@ -270,20 +270,20 @@ jobs:
270270 uses : ./
271271 with :
272272 trx-file-path : ' ./TestResults/comprehensive.trx'
273- output-path : ' ./all-outcomes.playlist '
273+ output-directory : ' ./all-outcomes'
274274 test-outcomes : ' Failed,Passed,NotExecuted,Inconclusive,Timeout'
275275 artifact-name : ' test-playlist-all'
276276
277277 - name : Verify all-outcomes playlist
278278 run : |
279- if [ -f "./all-outcomes.playlist" ]; then
279+ if [ -f "./all-outcomes/comprehensive .playlist" ]; then
280280 echo "✅ All-outcomes playlist created successfully"
281281 echo "Content:"
282- cat "./all-outcomes.playlist"
282+ cat "./all-outcomes/comprehensive .playlist"
283283 # Should contain all test types
284284 TESTS=("FailedTest" "PassedTest" "NotExecutedTest" "InconclusiveTest" "TimeoutTest")
285285 for test in "${TESTS[@]}"; do
286- if grep -q "$test" "./all-outcomes.playlist"; then
286+ if grep -q "$test" "./all-outcomes/comprehensive .playlist"; then
287287 echo "✅ Contains expected $test"
288288 else
289289 echo "❌ Missing expected $test"
@@ -300,20 +300,20 @@ jobs:
300300 uses : ./
301301 with :
302302 trx-file-path : ' ./TestResults/comprehensive.trx'
303- output-path : ' ./whitespace-test.playlist '
303+ output-directory : ' ./whitespace-test'
304304 test-outcomes : ' Failed , Passed , NotExecuted '
305305 artifact-name : ' test-playlist-whitespace'
306306
307307 - name : Verify whitespace handling
308308 run : |
309- if [ -f "./whitespace-test.playlist" ]; then
309+ if [ -f "./whitespace-test/comprehensive .playlist" ]; then
310310 echo "✅ Whitespace test playlist created successfully"
311311 echo "Content:"
312- cat "./whitespace-test.playlist"
312+ cat "./whitespace-test/comprehensive .playlist"
313313 # Should contain Failed, Passed, and NotExecuted tests
314314 TESTS=("FailedTest" "PassedTest" "NotExecutedTest")
315315 for test in "${TESTS[@]}"; do
316- if grep -q "$test" "./whitespace-test.playlist"; then
316+ if grep -q "$test" "./whitespace-test/comprehensive .playlist"; then
317317 echo "✅ Contains expected $test"
318318 else
319319 echo "❌ Missing expected $test"
@@ -330,22 +330,26 @@ jobs:
330330 uses : ./
331331 with :
332332 trx-file-path : ' ./TestResults/*.trx'
333- output-path : ' ./glob-test.playlist '
333+ output-directory : ' ./glob-playlists '
334334 test-outcomes : ' Failed'
335335 artifact-name : ' test-playlist-glob'
336336
337337 - name : Verify glob pattern handling
338338 run : |
339- if [ -f "./glob-test.playlist" ]; then
340- echo "✅ Glob pattern test playlist created successfully"
341- echo "Content:"
342- cat "./glob-test.playlist"
343- # Should use the first matching TRX file (which could be any of them)
344- echo "✅ Glob pattern processed successfully"
345- else
346- echo "❌ Glob pattern test playlist file not found"
347- exit 1
348- fi
339+ FILES=(glob-playlists/sample.playlist glob-playlists/additional.playlist glob-playlists/comprehensive.playlist)
340+ for file in "${FILES[@]}"; do
341+ if [ -f "$file" ]; then
342+ echo "✅ $file created"
343+ cat "$file"
344+ if [ ! -s "$file" ]; then
345+ echo "❌ $file is empty"
346+ exit 1
347+ fi
348+ else
349+ echo "❌ $file not found"
350+ exit 1
351+ fi
352+ done
349353
350354 # Test default artifact name behavior
351355 - name : Test Action - Default artifact name
@@ -388,3 +392,70 @@ jobs:
388392 echo "❌ Action should have failed for missing TRX file"
389393 exit 1
390394 fi
395+
396+ test-multi-trx-glob :
397+ runs-on : ubuntu-latest
398+ steps :
399+ - name : Checkout
400+ uses : actions/checkout@v4
401+
402+ - name : Create sample TRX files for glob test
403+ run : |
404+ mkdir -p TestResults
405+ cat > TestResults/first.trx << 'EOF'
406+ <?xml version="1.0" encoding="utf-8"?>
407+ <TestRun id="1" name="First Test Run" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
408+ <Results>
409+ <UnitTestResult executionId="execution-1" testId="test-1" testName="FirstTest" outcome="Failed" />
410+ </Results>
411+ <TestDefinitions>
412+ <UnitTest name="FirstTest" id="test-1">
413+ <TestMethod codeBase="TestAssembly.dll" className="TestClass" name="FirstTest" />
414+ </UnitTest>
415+ </TestDefinitions>
416+ </TestRun>
417+ EOF
418+ cat > TestResults/second.trx << 'EOF'
419+ <?xml version="1.0" encoding="utf-8"?>
420+ <TestRun id="2" name="Second Test Run" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
421+ <Results>
422+ <UnitTestResult executionId="execution-2" testId="test-2" testName="SecondTest" outcome="Failed" />
423+ </Results>
424+ <TestDefinitions>
425+ <UnitTest name="SecondTest" id="test-2">
426+ <TestMethod codeBase="TestAssembly.dll" className="TestClass" name="SecondTest" />
427+ </UnitTest>
428+ </TestDefinitions>
429+ </TestRun>
430+ EOF
431+
432+ - name : Test Action - Multi-file glob
433+ uses : ./
434+ with :
435+ trx-file-path : ' ./TestResults/*.trx'
436+ test-outcomes : ' Failed'
437+ artifact-name : ' test-playlist-multiglob'
438+
439+ - name : Verify all playlists created and not empty
440+ run : |
441+ for file in ./TestResults/first.playlist ./TestResults/second.playlist; do
442+ if [ -f "$file" ]; then
443+ echo "✅ $file created"
444+ echo "Content:"
445+ cat "$file"
446+ if [ ! -s "$file" ]; then
447+ echo "❌ $file is empty"
448+ exit 1
449+ fi
450+ else
451+ echo "❌ $file not found"
452+ exit 1
453+ fi
454+ done
455+ # Check for expected test names
456+ if grep -q "FirstTest" ./TestResults/first.playlist && grep -q "SecondTest" ./TestResults/second.playlist; then
457+ echo "✅ Both playlists contain expected test names"
458+ else
459+ echo "❌ One or both playlists missing expected test names"
460+ exit 1
461+ fi
0 commit comments