diff --git a/mbed_greentea/mbed_report_api.py b/mbed_greentea/mbed_report_api.py
index da3f0d9..82acb5c 100644
--- a/mbed_greentea/mbed_report_api.py
+++ b/mbed_greentea/mbed_report_api.py
@@ -38,6 +38,13 @@ def exporter_json(test_result_ext, test_suite_properties=None):
     @details This is a machine friendly format
     """
     import json
+    for target in test_result_ext.values():
+        for suite in target.values():
+            try:
+                suite["single_test_output"] = suite["single_test_output"]\
+                                              .decode("unicode_escape")
+            except KeyError:
+                pass
     return json.dumps(test_result_ext, indent=4)
 
 
@@ -211,7 +218,10 @@ def exporter_testcase_junit(test_result_ext, test_suite_properties=None):
                 test_cases.append(tc)
 
             ts_name = target_name
-            test_build_properties = test_suite_properties[target_name] if target_name in test_suite_properties else None
+            if test_suite_properties and target_name in test_suite_properties:
+                test_build_properties = test_suite_properties[target_name] 
+            else:
+                test_build_properties = None
             ts = TestSuite(ts_name, test_cases, properties=test_build_properties)
             test_suites.append(ts)
 
@@ -584,7 +594,9 @@ def get_result_overlay_dropdowns(result_div_id, test_results):
     result_output_div_id = "%s_output" % result_div_id
     result_output_dropdown = get_dropdown_html(result_output_div_id,
                                                "Test Output",
-                                               test_results['single_test_output'].rstrip("\n"),
+                                               test_results['single_test_output']
+                                               .decode("unicode-escape")
+                                               .rstrip("\n"),
                                                output_text=True)
 
     # Add a dropdown for the testcases if they are present
@@ -740,10 +752,14 @@ def exporter_html(test_result_ext, test_suite_properties=None):
                     test_results['single_test_count'] += 1
 
                 result_class = get_result_colour_class(test_results['single_test_result'])
+                try:
+                    percent_pass = int((test_results['single_test_passes']*100.0)/test_results['single_test_count'])
+                except ZeroDivisionError:
+                    percent_pass = 100
                 this_row += result_cell_template % (result_class,
                                                     result_div_id,
                                                     test_results['single_test_result'],
-                                                    int((test_results['single_test_passes']*100.0)/test_results['single_test_count']),
+                                                    percent_pass,
                                                     test_results['single_test_passes'],
                                                     test_results['single_test_count'],
                                                     result_overlay)

mbedgt crash with float division by zero
Hi

Here is my command:
mbedgt -V -v -t NUCLEO_F401RE-ARM,NUCLEO_F401RE-GCC_ARM,NUCLEO_F401RE-IAR,NUCLEO_F410RB-ARM,NUCLEO_F410RB-GCC_ARM,NUCLEO_F410RB-IAR,NUCLEO_F411RE-ARM,NUCLEO_F411RE-GCC_ARM,NUCLEO_F411RE-IAR --report-html=/c/xxx.html

It has crashed:

...
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.3680156551
mbedgt: exporting to HTML file 
mbedgt: unexpected error:
	float division by zero
Traceback (most recent call last):
  File "C:\Python27\Scripts\mbedgt-script.py", line 11, in <module>
    load_entry_point('mbed-greentea==1.2.6', 'console_scripts', 'mbedgt')()
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 401, in main
    cli_ret = main_cli(opts, args)
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 1050, in main_cli
    html_report = exporter_html(test_report)
  File "c:\python27\lib\site-packages\mbed_greentea\mbed_report_api.py", line 747, in exporter_html
    int((test_results['single_test_passes']*100.0)/test_results['single_test_count']),
ZeroDivisionError: float division by zero


diff --git a/test/report_api.py b/test/report_api.py
new file mode 100644
index 0000000..122e26e
--- /dev/null
+++ b/test/report_api.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+"""
+mbed SDK
+Copyright (c) 2017 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import unittest
+from mock import patch
+
+from mbed_greentea.mbed_report_api import exporter_html, \
+    exporter_memory_metrics_csv, exporter_testcase_junit, \
+    exporter_testcase_text, exporter_text, exporter_json
+
+
+class ReportEmitting(unittest.TestCase):
+
+
+    report_fns =  [exporter_html, exporter_memory_metrics_csv,
+                   exporter_testcase_junit, exporter_testcase_text,
+                   exporter_text, exporter_json]
+    def test_report_zero_tests(self):
+        test_data = {}
+        for report_fn in self.report_fns:
+            report_fn(test_data)
+
+    def test_report_zero_testcases(self):
+        test_data = {
+            'k64f-gcc_arm': {
+                'garbage_test_suite' :{
+                    u'single_test_result': u'NOT_RAN',
+                    u'elapsed_time': 0.0,
+                    u'build_path': u'N/A',
+                    u'build_path_abs': u'N/A',
+                    u'copy_method': u'N/A',
+                    u'image_path': u'N/A',
+                    u'single_test_output': b'N/A',
+                    u'platform_name': u'k64f',
+                    u'test_bin_name': u'N/A',
+                    u'testcase_result': {},
+                }
+            }
+        }
+        for report_fn in self.report_fns:
+            report_fn(test_data)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
beautifulsoup4==4.13.3
certifi==2025.1.31
charset-normalizer==3.4.1
colorama==0.3.9
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
fasteners==0.19
future==1.0.0
idna==3.10
iniconfig==2.1.0
intelhex==2.3.0
junit-xml==1.9
lockfile==0.12.2
-e git+https://github.com/ARMmbed/greentea.git@86f5ec3211a8f7f324bcdd3201012945ee0534ac#egg=mbed_greentea
mbed-host-tests==1.8.15
mbed-ls==1.8.15
mbed-os-tools==1.8.15
mock==5.2.0
packaging==24.2
pluggy==1.5.0
prettytable==2.5.0
pyserial==3.5
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
requests==2.32.3
six==1.17.0
soupsieve==2.6
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13

name: greentea
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - beautifulsoup4==4.13.3
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - colorama==0.3.9
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - fasteners==0.19
      - future==1.0.0
      - idna==3.10
      - iniconfig==2.1.0
      - intelhex==2.3.0
      - junit-xml==1.9
      - lockfile==0.12.2
      - mbed-host-tests==1.8.15
      - mbed-ls==1.8.15
      - mbed-os-tools==1.8.15
      - mock==5.2.0
      - packaging==24.2
      - pluggy==1.5.0
      - prettytable==2.5.0
      - pyserial==3.5
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - requests==2.32.3
      - six==1.17.0
      - soupsieve==2.6
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - wcwidth==0.2.13
prefix: /opt/conda/envs/greentea

test/report_api.py::ReportEmitting::test_report_zero_testcases
test/report_api.py::ReportEmitting::test_report_zero_tests
mbed_greentea/mbed_report_api.py
mbed_greentea/mbed_report_api.py