Search code examples
pythongoogle-cloud-functionspython-behave

Can we run a .feature(Gherkin) file on google cloud?


I have been working on a code that uses Python Behave(cucumber, language gherkin). I wanna put that code as a google cloud function. My question is can we fire .feature files from the google cloud shell?


Solution

  • Unfortunately, the Gherkin language is not currently supported by Google Cloud Functions, as you can see here, because they are executed in language-specific runtimes:

    Cloud Functions can be written in Node.js, Python, Go, Java, .NET, Ruby, and PHP programming languages, and are executed in language-specific runtimes.

    Even though you can add Python dependencies, the language must be Python; as you are trying to deploy Gherkin code, I would suggest trying to use the library instead of the CLI, in which case you can have more chances to succeed, as the language used is still Python. That way, you don’t have to use .feature files. You can see how to add the dependency in the link mentioned above.

    Using the library is the preferred way to use Gherkin, since it produces easily consumable AST and Pickle objects in-process without having to fork a CLI process or parse JSON.

    The library itself provides a stream API, which is what the CLI is based on. This is the recommended way to use the library, as it provides a high level API that is easy to use.

    If in any case you find trouble using the library, you can still change to Google Cloud Run, as it has a similar approach of serverless architecture with the freedom of using any language, library or binary.

    Any language, any library, any binary.

    Use the programming language of your choice, any language or operating system libraries, or even bring your own binaries.