Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
832 views
in Technique[技术] by (71.8m points)

Creating Cucumber Test on Executable Docker Image

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
            }
        }
    }
}

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.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...