Application developers may want to test their code with simulated responses, including errors, from an object of type EnvironmentsClient. To do so, construct an object of type EnvironmentsClient with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.
See Also
This example for how to test your application with GoogleTest. While the example showcases types from the BigQuery library, the underlying principles apply for any pair of *Client and *Connection.
Functions
virtual options()
This function is implemented using gMock's MOCK_METHOD().
Consult the gMock documentation to use this mock in your tests.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThis document outlines the \u003ccode\u003eMockEnvironmentsConnection\u003c/code\u003e class, which is designed to facilitate testing of the \u003ccode\u003eEnvironmentsClient\u003c/code\u003e by simulating responses and errors.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes numerous virtual functions, such as \u003ccode\u003eCreateEnvironment\u003c/code\u003e, \u003ccode\u003eGetEnvironment\u003c/code\u003e, \u003ccode\u003eListEnvironments\u003c/code\u003e, \u003ccode\u003eUpdateEnvironment\u003c/code\u003e, and \u003ccode\u003eDeleteEnvironment\u003c/code\u003e, all using \u003ccode\u003eMOCK_METHOD()\u003c/code\u003e from gMock to mock the corresponding functionalities.\u003c/p\u003e\n"],["\u003cp\u003eIt supports various Airflow command operations including \u003ccode\u003eExecuteAirflowCommand\u003c/code\u003e, \u003ccode\u003eStopAirflowCommand\u003c/code\u003e, and \u003ccode\u003ePollAirflowCommand\u003c/code\u003e, which are crucial for testing Airflow interactions.\u003c/p\u003e\n"],["\u003cp\u003eThe class also enables snapshot management through \u003ccode\u003eSaveSnapshot\u003c/code\u003e and \u003ccode\u003eLoadSnapshot\u003c/code\u003e, and database management with \u003ccode\u003eDatabaseFailover\u003c/code\u003e and \u003ccode\u003eFetchDatabaseProperties\u003c/code\u003e, each with a corresponding request and response type.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version is 2.37.0-rc, and there is a list of previous versions ranging from 2.36.0 all the way down to 2.11.0, which the user can view for older documentation.\u003c/p\u003e\n"]]],[],null,[]]