Cloud Pub/Sub(第 2 世代)の単体テスト
bookmark_borderbookmark
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Cloud Functions(第 2 世代)で実行される Cloud Pub/Sub トリガー関数の単体テストの例。
コードサンプル
Cloud Run functions に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証を設定するをご覧ください。
Cloud Run functions に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証を設定するをご覧ください。
Cloud Run functions に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証を設定するをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],[],[[["This webpage provides unit test examples for Cloud Pub/Sub-triggered functions running on Cloud Functions (2nd Gen) in C#, Go, and PHP."],["The C# code demonstrates testing a function that processes messages with and without text data, using `Xunit` for assertions and a `MemoryLogger` for logging checks."],["The Go example showcases testing `helloPubSub` function with varying input data, by capturing the log output, and it utilizes the `cloudevents` library to simulate CloudEvents."],["The PHP unit tests use `PHPUnit` to test the `helloworldPubsub` function by simulating a CloudEvent and asserting that the function's output contains the expected greeting, handling output capture by overriding the function's logging."],["Setting up Application Default Credentials is required for authenticating to Cloud Run functions during local development, and a link is provided for more details on the process."]]],[]]