Behavior Driven Development with JUnit 5. Part 4
Behavior Driven Development with JUnit 5. Part 4
The fourth part of our article on Behavior Driven Development with JUnit 5. Happy reading.
15 лют 2021
1152
Інші статті
How to incrementally migrate the data from RDBMS to Hadoop using Sqoop Incremental Last Modified technique?
How to implement Slowly Changing Dimensions(SCD) Type 2 in Spark?
How to incrementally migrate the data from RDBMS to Hadoop using Sqoop Incremental Append technique?
Why MongoDB don't fetch all the matching documents for the query fired
How to solve the issue of full disk utilization in HDFS Namenode
Can We Use HDFS as Back-up Storage?
How to do Indexing in MongoDB with Elastic Search? Part 1
How to do Indexing in MongoDB with Elastic Search? Part 2
How to store data on browser using NoSQL IndexedDB?
How to Apply MBTI in HR: Motivation for every day. Groups of People & their Motivations
The keywords Feature, Scenario, Given, When, Then, and And are highlighted. Right-clicking this feature file shows the option to run it directly (figure 2).
This is possible only if two requirements are fulfilled. First, the appropriate plugins must be activated. To do this in IntelliJ, go to File > Settings > Plugins and install the Cucumber for Java and Gherkin plugins (figures 3 and 4).
Second, we must configure the way the feature is run. Go to Run > Edit Configurations, and set the following options (figure 5):
Running the feature directly generates the skeleton of the Java Cucumber tests (figure 6).
Figure 2 Directly running the passengers_policy.feature file by right-clicking the file
This is possible only if two requirements are fulfilled. First, the appropriate plugins must be activated. To do this in IntelliJ, go to File > Settings > Plugins and install the Cucumber for Java and Gherkin plugins (figures 3 and 4).
Figure 3 Installing the Cucumber for Java plugin from the File > Settings > Plugins menu
Figure 4 Installing the Gherkin plugin from the File > Settings > Plugins menu
Second, we must configure the way the feature is run. Go to Run > Edit Configurations, and set the following options (figure 5):
Figure 5 Setting the feature configuration by filling in the Main Class, Glue, Feature or Folder Path, and Working Directory fields
- Main Class: cucumber.api.cli.Main
- Glue (the package where step definitions are stored): com.luxoft.bddjunit5.airport
- Feature or Folder Path: the test/resources/features folder we have created
- Working Directory: the project folder
Running the feature directly generates the skeleton of the Java Cucumber tests (figure 6).
Figure 6 Getting the skeleton of the Passengers Policy feature by directly running the feature file. The annotated methods are executed to verify the scenarios.
Interested in JUnit? Check out our trainings.
Catalin Tudose
Java and Web Technologies Expert