Test di unità Cloud Pub/Sub (2ª gen.)
bookmark_borderbookmark
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Test di unità di esempio per una funzione attivata da Cloud Pub/Sub in esecuzione su Cloud Functions (2ª gen.).
Esempio di codice
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","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."]]],[]]