在可执行的Docker映像上创建Cucumber测试 [英] Creating Cucumber Test on Executable Docker Image

查看:143
本文介绍了在可执行的Docker映像上创建Cucumber测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个关于如何在Docker可执行映像上创建黄瓜测试的想法?

I am trying to come up with an idea on how to create a Cucumber Test on Docker Executable Image?

public class GenerateNumber {
    public static void main(String[] args) {
        if (args != null && args.length > 0) {
            String input = args[0];

            if(input.equals("ODD")) {
                //GENERATE ODD NUMBERS FROM 0 TO 1000
            }else {
                //GENERATE EVEN NUMBERS FROM 0 TO 1000
            }
        }
    }
}



<假设我有这个简单的类文件...我将其包装到可执行的Jar文件中,并使用该类作为应用程序中的入口点。
将Java文件部署为将运行我的类的容器化映像。

Supposed I have this simple class file...I am packaging it into an executable Jar File and use this class as an entry point in my application. The java file is deployed as a containerized image that will run my class.

现在,从Cucumber Test的角度来看,如何创建步骤定义文件

Now, from a Cucumber Test perspective, how do I create a step definition file for such case?

这是码头工人形象吗?我正在提出一项如何进行此测试的策略。
是否有完成类似要求的人提供任何提示?

This is a docker image right? I am coming up with a strategy on how to do this test. Any hints from someone who have done similar requirements?

推荐答案

如何连接到示例取决于您何时需要

How you connect to your example depends on when you want to verify that it works.

我的策略是在应用程序的构建期间执行此操作。这样可以减少Docker的负担,任何适用于Cucumber的Java教程都将适用。我的博客上有很多教程。也许发布可以有所帮助。使用现代版本的工具。

My strategy would be to do it during build time of the application. This reduces Docker from the equation and any Java tutorial on Cucumber will be applicable. I have plenty of tutorials on my blog. Maybe this post can be of some help. Use modern versions of the tools.

如果要在Docker中运行应用程序时从Cucumber步骤连接到应用程序,则需要某种方式进行连接。这与从外部连接到任何服务器应用程序相同。一个示例可能是从Cucumber步骤驱动Selenium并验证Web应用程序。此帖子可能是帮助您了解如何验证不同类型的应用程序。再次过时,但想法保持不变。

If you want to connect to the application from a Cucumber step when the application runs in Docker, you need some way to do the connection. This is the same as connecting to any server application from the outside. An example could be to drive Selenium from Cucumber steps and and verify a web application. This post may be of help to understand how you can verify different types of applications. Again a bit dated, but the ideas have stayed the same.

这篇关于在可执行的Docker映像上创建Cucumber测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆