Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Install and Setup JavaSDK and Cucumber (Windows): Difference between revisions

From KKM-STUDIO-WIKI
Line 24: Line 24:
= Download and Install the Cucumber plugin =
= Download and Install the Cucumber plugin =
== Eclipse ==
== Eclipse ==
From the Eclipse marketplace (from inside the Help menu of Eclipse), download the "Cucumber" plugin.[[File:03.png|300px|center|thumb|Install Cucumber (Eclipse)]]
From the Eclipse marketplace (from inside the Help menu of Eclipse), download the "Cucumber" plugin.[[File:03.png|500px|center|thumb|Install Cucumber (Eclipse)]]
 
== IntelliJ ==
== IntelliJ ==
IntelliJ already comes with a Cucumber plugin. But I recommend you also download a plugin called Cucumber for Java since it can add support for Cucumber testing tools with step definitions written in Java. You can download that from '''File -> Settings -> plugins'''. [[File:04.png|300px|center|thumb|Install Cucumber (IntelliJ)]]
IntelliJ already comes with a Cucumber plugin. But I recommend you also download a plugin called Cucumber for Java since it can add support for Cucumber testing tools with step definitions written in Java. You can download that from '''File -> Settings -> plugins'''. [[File:04.png|300px|center|thumb|Install Cucumber (IntelliJ)]]

Revision as of 22:30, 22 January 2023

The tutorial on this page is only applicable to the WINDOWS operating system, other operating systems have not yet been verified.

Download and Install JavaSDK

Download JavaSDK

Go to the JavaSDK Download Page. Based on your OS, download the following file (Java 19 recommended):

Windows: x64 Installer

Install JavaSDK

Double-click the file you downloaded, you should see the following interface

Java(TM) Installing Program

Click NEXT, and choose where you want to install it. Then you wait for it to finish installing and click CLOSE.

Verify JavaSDK (Optional)

You can verify your JavaSDK using the terminal command.

java --version

You should see the following content:

Verify JavaSDK

Download and Install IDE (Eclipse or IntelliJ)

The course will use Eclipse in its teaching material but all the things we do in the course can be done in IntelliJ too. You can download the latest version of Eclipse and IntelliJ (Community Edition) here.

Download and Install the Cucumber plugin

Eclipse

From the Eclipse marketplace (from inside the Help menu of Eclipse), download the "Cucumber" plugin.

Install Cucumber (Eclipse)

IntelliJ

IntelliJ already comes with a Cucumber plugin. But I recommend you also download a plugin called Cucumber for Java since it can add support for Cucumber testing tools with step definitions written in Java. You can download that from File -> Settings -> plugins

Install Cucumber (IntelliJ)

Restart your IDE

After you install the Cucumber plugin, you need to restart your IDE (Your IDE will also notify you to do that).

Download and Import the project "libaray01" to your IDE

You can download the zip file library01.zip here. And then you should unpack the zip file first.

Eclipse

You can now import the project into Eclipse by clicking File -> Projects from Folder or Archive. And then you click the Directory and choose the file you unpacked from the zip file. Then you mark that project library01 and click Finish.

Import project (Eclipse)

IntelliJ

You can now import the project into Eclipse by clicking Open and Choosing the file you unpacked from the zip file. Then click OK and Trust Project.

Import project (IntelliJ)

Click now Load button. The Maven script will then be loaded and you can now wait for the project to be built.

Load Maven script

Run the project in your IDE

Eclipse

Find the file AcceptanceTest.java under the src/test/java/dtu.library.acceptance_tests and then right-click -> Run as -> JUnit Test. You will see the following content:

Run the project in Eclipse

Although the program fails the test (as it should), it proves that you can already run the cucumber plugin. You can now begin to implement the production code such that the scenarios "Admin login", "Admin logout", "Add book", and "Search book" pass.

IntelliJ

Find the file AcceptanceTest.java under the src/test/java/dtu.library/acceptance_tests and then right-click -> Run 'AcceptanceTest'. You will see the following content:

Run the project in IntelliJ

Although the program fails the test (as it should), it proves that you can already run the cucumber plugin. You can now begin to implement the production code such that the scenarios "Admin login", "Admin logout", "Add book", and "Search book" pass.