コード例 #1
0
    async def run_with_client(self, args: Namespace, client: Client) -> None:
        await super().run_with_client(args, client)
        if args.install:
            await self.install_bundles(args, client)
        tests_to_run = self.get_tests_to_run(args)
        tests_to_skip = self.get_tests_to_skip(args)
        app_bundle_id = args.app_bundle_id if hasattr(args, "app_bundle_id") else None
        test_host_app_bundle_id = (
            args.test_host_app_bundle_id
            if hasattr(args, "test_host_app_bundle_id")
            else None
        )
        arguments = getattr(args, "test_arguments", [])
        is_ui = args.run == "ui"
        is_logic = args.run == "logic"

        formatter = json_format_test_info if args.json else human_format_test_info
        async for test_result in client.run_xctest(
            test_bundle_id=args.test_bundle_id,
            app_bundle_id=app_bundle_id,
            test_host_app_bundle_id=test_host_app_bundle_id,
            is_ui_test=is_ui,
            is_logic_test=is_logic,
            tests_to_run=tests_to_run,
            tests_to_skip=tests_to_skip,
            timeout=args.timeout,
            env=get_env_with_idb_prefix(),
            args=arguments,
            result_bundle_path=args.result_bundle_path,
            report_activities=args.report_activities or args.report_attachments,
            report_attachments=args.report_attachments,
            activities_output_path=args.activities_output_path,
            coverage_output_path=args.coverage_output_path,
        ):
            print(formatter(test_result))
コード例 #2
0
ファイル: xctest.py プロジェクト: facebook/idb
    async def run_with_client(self, args: Namespace, client: Client) -> None:
        await super().run_with_client(args, client)

        is_ui = args.run == "ui"
        is_logic = args.run == "logic"
        is_app = args.run == "app"

        if args.install:
            # Note for --install specified, test_bundle_id is a path initially, but
            # `install_bundles` will override it.
            test_bundle_location = args.test_bundle_id

            await self.install_bundles(args, client)
            if args.install_dsym_test_bundle:
                if is_ui or is_app:
                    print(
                        "--install-dsym-test-bundle is experimental for ui and app tests; this flag is only supported for logic tests."
                    )
                await self.install_dsym_test_bundle(args, client,
                                                    test_bundle_location)

        tests_to_run = self.get_tests_to_run(args)
        tests_to_skip = self.get_tests_to_skip(args)
        app_bundle_id = args.app_bundle_id if hasattr(
            args, "app_bundle_id") else None
        test_host_app_bundle_id = (args.test_host_app_bundle_id if hasattr(
            args, "test_host_app_bundle_id") else None)
        arguments = getattr(args, "test_arguments", [])
        if args.wait_for_debugger and is_ui:
            print(
                "--wait_for_debugger flag is NOT supported for ui tests. It will default to False"
            )

        formatter = json_format_test_info if args.json else human_format_test_info
        coverage_format = CodeCoverageFormat[args.coverage_format]

        async for test_result in client.run_xctest(
                test_bundle_id=args.test_bundle_id,
                app_bundle_id=app_bundle_id,
                test_host_app_bundle_id=test_host_app_bundle_id,
                is_ui_test=is_ui,
                is_logic_test=is_logic,
                tests_to_run=tests_to_run,
                tests_to_skip=tests_to_skip,
                timeout=args.timeout,
                env=get_env_with_idb_prefix(),
                args=arguments,
                result_bundle_path=args.result_bundle_path,
                report_activities=args.report_activities
                or args.report_attachments,
                report_attachments=args.report_attachments,
                activities_output_path=args.activities_output_path,
                coverage_output_path=args.coverage_output_path,
                coverage_format=coverage_format,
                log_directory_path=args.log_directory_path,
                wait_for_debugger=args.wait_for_debugger,
        ):
            print(formatter(test_result))
コード例 #3
0
ファイル: xctest.py プロジェクト: Unity-Technologies/idb
    async def run_with_client(self, args: Namespace, client: Client) -> None:
        await super().run_with_client(args, client)
        if args.install:
            await self.install_bundles(args, client)
        tests_to_run = self.get_tests_to_run(args)
        tests_to_skip = self.get_tests_to_skip(args)
        app_bundle_id = args.app_bundle_id if hasattr(
            args, "app_bundle_id") else None
        test_host_app_bundle_id = (args.test_host_app_bundle_id if hasattr(
            args, "test_host_app_bundle_id") else None)
        arguments = getattr(args, "test_arguments", [])
        is_ui = args.run == "ui"
        is_logic = args.run == "logic"

        if args.wait_for_debugger and is_ui:
            print(
                "--wait_for_debugger flag is NOT supported for ui tests. It will default to False"
            )

        formatter = json_format_test_info if args.json else human_format_test_info
        crashed_outside_test_case = False
        coverage_format = CodeCoverageFormat[args.coverage_format]

        async for test_result in client.run_xctest(
                test_bundle_id=args.test_bundle_id,
                app_bundle_id=app_bundle_id,
                test_host_app_bundle_id=test_host_app_bundle_id,
                is_ui_test=is_ui,
                is_logic_test=is_logic,
                tests_to_run=tests_to_run,
                tests_to_skip=tests_to_skip,
                timeout=args.timeout,
                env=get_env_with_idb_prefix(),
                args=arguments,
                result_bundle_path=args.result_bundle_path,
                report_activities=args.report_activities
                or args.report_attachments,
                report_attachments=args.report_attachments,
                activities_output_path=args.activities_output_path,
                coverage_output_path=args.coverage_output_path,
                coverage_format=coverage_format,
                log_directory_path=args.log_directory_path,
                wait_for_debugger=args.wait_for_debugger,
        ):
            print(formatter(test_result))
            crashed_outside_test_case = (crashed_outside_test_case or
                                         test_result.crashed_outside_test_case)
        if crashed_outside_test_case:
            raise ExitWithCodeException(3)