Ejemplo n.º 1
0
    def __call__(self, result: TestReport) -> TestReport:
        """
        :param result: testplan result to export
        """
        exporter = JSONExporter(json_path=self.output)
        exporter.export(result)

        return result
Ejemplo n.º 2
0
    def __call__(self, result: TestReport) -> TestReport:
        # TPR handles commands with a pipeline, resulting in calls like
        #   - tpr convert fromjson $JSON_FILE display
        #   - tpr convert fromdb $DOC_ID display
        # reading data from input and transform it into `TestReport`, then
        # the output of actual command becomes input of the next (display).
        # A `WebUIServer` is used to save the data into a temporary single JSON
        # which will be displayed it in browser. If the original input file is
        # a single JSON, this process might be optimized. But here, we stick to
        # the pipeline concept to make implementation consistent.
        with tempfile.TemporaryDirectory() as tmpdir:
            json_path = os.path.join(tmpdir, "report.json")
            exporter = JSONExporter(json_path=json_path,
                                    split_json_report=False)
            exporter.export(result)

            ui_server = WebUIServer(json_path=json_path, ui_port=self.port)
            ui_server.display()
            ui_server.wait_for_kb_interrupt()

        return result
Ejemplo n.º 3
0
    def __call__(self, result: TestReport) -> TestReport:
        exporter = JSONExporter(json_path=self.output)
        exporter.export(result)

        return result
Ejemplo n.º 4
0
    def to_json(result):

        exporter = JSONExporter(json_path=output)
        exporter.export(result)

        return result