我们可以 运行 在 google 云上创建一个 .feature(Gherkin) 文件吗?

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

我一直在研究使用 Python Behave(黄瓜,小黄瓜语言)的代码。我想将该代码作为 google 云函数。我的问题是我们可以从 google 云 shell 中触发 .feature 文件吗?

不幸的是,Google Cloud Functions 当前不支持 Gherkin 语言,如您所见here,因为它们是在特定于语言的运行时中执行的:

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

即使您可以 add Python dependencies, the language must be Python; as you are trying to deploy Gherkin code, I would suggest trying to use the library 而不是 CLI,在这种情况下您可以获得更多成功的机会,因为使用的语言仍然是 Python。这样,您就不必使用 .feature 文件。你可以在上面提到的link中看到如何添加依赖。

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.

如果在任何情况下您在使用该库时遇到问题,您仍然可以更改为 Google Cloud Run,因为它具有类似无服务器架构的方法,可以自由使用任何语言、库或二进制文件。

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.