@@ -49,6 +49,7 @@ help: ## Show this help message
4949 @echo " $( YELLOW) Test Configuration:$( NC) "
5050 @echo " TEST_REPORTS_DIR Directory for HTML test reports (default: test-reports)"
5151 @echo " GOTESTSUM_FORMAT Test output format: testname|dots|pkgname|standard-verbose (default: testname)"
52+ @echo " PATTERN Substring pattern to filter tests (alternative to TESTCASE)"
5253
5354cleanup-enterprise : # # Clean up enterprise directories if present
5455 @echo " $( GREEN) Cleaning up enterprise...$( NC) "
@@ -334,9 +335,14 @@ test: install-gotestsum ## Run tests for bifrost-http
334335 echo " $( CYAN) JUnit XML report: $( TEST_REPORTS_DIR) /bifrost-http.xml$( NC) " ; \
335336 fi
336337
337- test-core : install-gotestsum # # Run core tests (Usage: make test-core PROVIDER=openai TESTCASE=SpeechSynthesisStreamAdvanced/MultipleVoices_Streaming/StreamingVoice_echo )
338+ test-core : install-gotestsum # # Run core tests (Usage: make test-core PROVIDER=openai TESTCASE=TestName or PATTERN=substring )
338339 @echo " $( GREEN) Running core tests...$( NC) "
339340 @mkdir -p $(TEST_REPORTS_DIR )
341+ @if [ -n " $( PATTERN) " ] && [ -n " $( TESTCASE) " ]; then \
342+ echo " $( RED) Error: PATTERN and TESTCASE are mutually exclusive$( NC) " ; \
343+ echo " $( YELLOW) Use PATTERN for substring matching or TESTCASE for exact match$( NC) " ; \
344+ exit 1; \
345+ fi
340346 @TEST_FAILED=0; \
341347 REPORT_FILE=" " ; \
342348 if [ -n " $( PROVIDER) " ]; then \
@@ -382,6 +388,30 @@ test-core: install-gotestsum ## Run core tests (Usage: make test-core PROVIDER=o
382388 echo " " ; \
383389 echo " $( CYAN) JUnit XML report: $$ REPORT_FILE$( NC) " ; \
384390 fi ; \
391+ elif [ -n " $( PATTERN) " ]; then \
392+ echo " $( CYAN) Running tests matching '$( PATTERN) ' for $$ {PROVIDER_TEST_NAME}...$( NC) " ; \
393+ REPORT_FILE=" $( TEST_REPORTS_DIR) /core-$( PROVIDER) -$( PATTERN) .xml" ; \
394+ cd core/providers/$(PROVIDER ) && GOWORK=off gotestsum \
395+ --format=$(GOTESTSUM_FORMAT ) \
396+ --junitfile=../../../$$ REPORT_FILE \
397+ -- -v -run " .*$( PATTERN) .*" || TEST_FAILED=1; \
398+ cd ../../..; \
399+ $(MAKE ) cleanup-junit-xml REPORT_FILE=$$ REPORT_FILE; \
400+ if [ -z " $$ CI" ] && [ -z " $$ GITHUB_ACTIONS" ] && [ -z " $$ GITLAB_CI" ] && [ -z " $$ CIRCLECI" ] && [ -z " $$ JENKINS_HOME" ]; then \
401+ if which junit-viewer > /dev/null 2>&1 ; then \
402+ echo " $( YELLOW) Generating HTML report...$( NC) " ; \
403+ junit-viewer --results=$$ REPORT_FILE --save=$$ {REPORT_FILE%.xml}.html 2> /dev/null || true ; \
404+ echo " " ; \
405+ echo " $( CYAN) HTML report: $$ {REPORT_FILE%.xml}.html$( NC) " ; \
406+ echo " $( CYAN) Open with: open $$ {REPORT_FILE%.xml}.html$( NC) " ; \
407+ else \
408+ echo " " ; \
409+ echo " $( CYAN) JUnit XML report: $$ REPORT_FILE$( NC) " ; \
410+ fi ; \
411+ else \
412+ echo " " ; \
413+ echo " $( CYAN) JUnit XML report: $$ REPORT_FILE$( NC) " ; \
414+ fi ; \
385415 else \
386416 echo " $( CYAN) Running Test$$ {PROVIDER_TEST_NAME}...$( NC) " ; \
387417 REPORT_FILE=" $( TEST_REPORTS_DIR) /core-$( PROVIDER) .xml" ; \
@@ -413,11 +443,20 @@ test-core: install-gotestsum ## Run core tests (Usage: make test-core PROVIDER=o
413443 echo " $( YELLOW) Usage: make test-core PROVIDER=openai TESTCASE=SpeechSynthesisStreamAdvanced/MultipleVoices_Streaming/StreamingVoice_echo$( NC) " ; \
414444 exit 1; \
415445 fi ; \
416- REPORT_FILE=" $( TEST_REPORTS_DIR) /core-all.xml" ; \
417- cd core && GOWORK=off gotestsum \
418- --format=$(GOTESTSUM_FORMAT ) \
419- --junitfile=../$$ REPORT_FILE \
420- -- -v ./providers/... || TEST_FAILED=1; \
446+ if [ -n " $( PATTERN) " ]; then \
447+ echo " $( CYAN) Running tests matching '$( PATTERN) ' across all providers...$( NC) " ; \
448+ REPORT_FILE=" $( TEST_REPORTS_DIR) /core-all-$( PATTERN) .xml" ; \
449+ cd core && GOWORK=off gotestsum \
450+ --format=$(GOTESTSUM_FORMAT ) \
451+ --junitfile=../$$ REPORT_FILE \
452+ -- -v -run " .*$( PATTERN) .*" ./providers/... || TEST_FAILED=1; \
453+ else \
454+ REPORT_FILE=" $( TEST_REPORTS_DIR) /core-all.xml" ; \
455+ cd core && GOWORK=off gotestsum \
456+ --format=$(GOTESTSUM_FORMAT ) \
457+ --junitfile=../$$ REPORT_FILE \
458+ -- -v ./providers/... || TEST_FAILED=1; \
459+ fi ; \
421460 cd ..; \
422461 $(MAKE ) cleanup-junit-xml REPORT_FILE=$$ REPORT_FILE; \
423462 if [ -z " $$ CI" ] && [ -z " $$ GITHUB_ACTIONS" ] && [ -z " $$ GITLAB_CI" ] && [ -z " $$ CIRCLECI" ] && [ -z " $$ JENKINS_HOME" ]; then \
@@ -569,12 +608,17 @@ test-chatbot: ## Run interactive chatbot integration test (Usage: RUN_CHATBOT_TE
569608 fi
570609 @cd core && RUN_CHATBOT_TEST=1 go test -v -run TestChatbot
571610
572- test-integrations : # # Run Python integration tests (Usage: make test-integrations [INTEGRATION=openai] [TESTCASE=test_name] [VERBOSE=1])
611+ test-integrations : # # Run Python integration tests (Usage: make test-integrations [INTEGRATION=openai] [TESTCASE=test_name] [PATTERN=substring] [ VERBOSE=1])
573612 @echo " $( GREEN) Running Python integration tests...$( NC) "
574613 @if [ ! -d " tests/integrations" ]; then \
575614 echo " $( RED) Error: tests/integrations directory not found$( NC) " ; \
576615 exit 1; \
577616 fi ; \
617+ if [ -n " $( PATTERN) " ] && [ -n " $( TESTCASE) " ]; then \
618+ echo " $( RED) Error: PATTERN and TESTCASE are mutually exclusive$( NC) " ; \
619+ echo " $( YELLOW) Use PATTERN for substring matching or TESTCASE for exact match$( NC) " ; \
620+ exit 1; \
621+ fi ; \
578622 if [ -n " $( TESTCASE) " ] && [ -z " $( INTEGRATION) " ]; then \
579623 echo " $( RED) Error: TESTCASE requires INTEGRATION to be specified$( NC) " ; \
580624 echo " $( YELLOW) Usage: make test-integrations INTEGRATION=anthropic TESTCASE=test_05_end2end_tool_calling$( NC) " ; \
@@ -633,13 +677,21 @@ test-integrations: ## Run Python integration tests (Usage: make test-integration
633677 if [ -n " $( TESTCASE) " ]; then \
634678 echo " $( CYAN) Running $( INTEGRATION) integration test: $( TESTCASE) ...$( NC) " ; \
635679 cd tests/integrations && pytest tests/test_$(INTEGRATION ) .py::$(TESTCASE ) $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
680+ elif [ -n " $( PATTERN) " ]; then \
681+ echo " $( CYAN) Running $( INTEGRATION) integration tests matching '$( PATTERN) '...$( NC) " ; \
682+ cd tests/integrations && pytest tests/test_$(INTEGRATION ) .py -k " $( PATTERN) " $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
636683 else \
637684 echo " $( CYAN) Running $( INTEGRATION) integration tests...$( NC) " ; \
638685 cd tests/integrations && pytest tests/test_$(INTEGRATION ) .py $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
639686 fi ; \
640687 else \
641- echo " $( CYAN) Running all integration tests...$( NC) " ; \
642- cd tests/integrations && pytest $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
688+ if [ -n " $( PATTERN) " ]; then \
689+ echo " $( CYAN) Running all integration tests matching '$( PATTERN) '...$( NC) " ; \
690+ cd tests/integrations && pytest -k " $( PATTERN) " $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
691+ else \
692+ echo " $( CYAN) Running all integration tests...$( NC) " ; \
693+ cd tests/integrations && pytest $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
694+ fi ; \
643695 fi ; \
644696 else \
645697 echo " $( CYAN) Using uv (fast mode)$( NC) " ; \
@@ -652,13 +704,21 @@ test-integrations: ## Run Python integration tests (Usage: make test-integration
652704 if [ -n " $( TESTCASE) " ]; then \
653705 echo " $( CYAN) Running $( INTEGRATION) integration test: $( TESTCASE) ...$( NC) " ; \
654706 uv run pytest tests/test_$(INTEGRATION ) .py::$(TESTCASE ) $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
707+ elif [ -n " $( PATTERN) " ]; then \
708+ echo " $( CYAN) Running $( INTEGRATION) integration tests matching '$( PATTERN) '...$( NC) " ; \
709+ uv run pytest tests/test_$(INTEGRATION ) .py -k " $( PATTERN) " $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
655710 else \
656711 echo " $( CYAN) Running $( INTEGRATION) integration tests...$( NC) " ; \
657712 uv run pytest tests/test_$(INTEGRATION ) .py $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
658713 fi ; \
659714 else \
660- echo " $( CYAN) Running all integration tests...$( NC) " ; \
661- uv run pytest $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
715+ if [ -n " $( PATTERN) " ]; then \
716+ echo " $( CYAN) Running all integration tests matching '$( PATTERN) '...$( NC) " ; \
717+ uv run pytest -k " $( PATTERN) " $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
718+ else \
719+ echo " $( CYAN) Running all integration tests...$( NC) " ; \
720+ uv run pytest $(if $(VERBOSE ) ,-v,-q) || TEST_FAILED=1; \
721+ fi ; \
662722 fi ; \
663723 fi ; \
664724 if [ $$ BIFROST_STARTED -eq 1 ] && [ -n " $$ BIFROST_PID" ]; then \
0 commit comments