0% found this document useful (0 votes)
27 views21 pages

SE 2025 Tutorial

This document outlines the integration of Eclipse with GitHub, including steps for creating a repository, committing changes, and cloning projects. It also discusses Behavior Driven Development (BDD) using Cucumber and automated unit testing with JUnit 4, emphasizing the importance of collaboration and clear requirements. Additionally, it provides instructions for setting up a Maven project with necessary dependencies for Cucumber and JUnit, along with a practical example of a grocery cost calculation library.

Uploaded by

Jana Droubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views21 pages

SE 2025 Tutorial

This document outlines the integration of Eclipse with GitHub, including steps for creating a repository, committing changes, and cloning projects. It also discusses Behavior Driven Development (BDD) using Cucumber and automated unit testing with JUnit 4, emphasizing the importance of collaboration and clear requirements. Additionally, it provides instructions for setting up a Maven project with necessary dependencies for Cucumber and JUnit, along with a practical example of a grocery cost calculation library.

Uploaded by

Jana Droubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Eclipse + github + BDD + junit Testing

Integrate Eclipse with Github


Go to github https://github.com and signup.
Create a new repository on github as follows.
Add the collaborators (team)(2-3 Max).
Right click on the project and choose Team ⇒ share project
Convert the perspective of Eclipse to Git. Follow next figure

Choose Git. Make sure that Eclipse has the Git Plugin else you need to plugin.

You should see the following perspective.


May asked you for your credential of github: username and TOKEN.

To generate TOKEN ⇒ Go to settings on your github account→ developer setting→


Personal access tokens→Generate new token.
Press finish then for the last dialog press OK.

DONE!!!!!!!!!!

Check github to see the project.


When you make any change on project you should repeat the same steps:
right click on project⇒ commit then follow the same process and write commit message
Cloning any github project from eclipse
Eclipse→ File→ import → Git—> projects from Git→ Clone URL
Then Next→ choose branch→ next … Then press finish and OK.
TDD/BDD (Behaviour Driven Development built on TOy of Test Driven Development/)
“From TestCases to production code”

The technologies used for:


1. Behaviour-driven development (BDD) is: Cucumber
2. Automated unit testing is: JUnit 4 (Verification- are you building the product in the
right way?)
Cucumber is still relying on JUnit 4 instead of Junit 5
Cucumber
● Open-source tool
● Collaboration and documentation tool (automate interactions with customer)
● Business-readable domain specific language (DSL) to describe the behaviour
your customers want from the system.
● Let software development teams describe how software should behave in plain text.
● helps teams communicate more effectively with their customers
○ goodbye forever to misunderstood requirements
○ goodbye for tedious manual acceptance tests (Validation: are you building
the right product that meets the needs of the customer?)
○ goodbye for out-of-date documentation.

“WitZo› tZe a› omatet acce ta ce tes s, it's Zazd fo× he zog×a


me×c to xow £icZ unit estc tZey neeb o w×i e”

Traditional
From Production code → To Test
1. Test succeeds
2. Test fails → fix production code

Better (Agile)(TDD):
From Test → To production code
1. tests as goals
2. API design … ”wish list” for production code
3. Testable software

Requirements:
● Java SDK 8 or higher. https://adoptopenjdk.net/
● To check the java version you have installed on your PC, write the
following command "javac -version".
● Install your favourite IDE. Eclipse or IntelliJ. https://www.eclipse.org/

● Building tools : Ant / Maven /gradle

● In Eclipse go to Help menu ⇒ From the Eclipse marketplace , search


for "Cucumber", download the "Natural 0.9" plugin

○ Natural is a set of plugins providing a smooth experience in editing


and maintaining BDD/ATDD files. The currently supported languages
are Cucumber (Gherkin syntax) and JBehave, the latter still in the early
development stage.

If this choice does not work and give the following error : No repository found at
http://rlogiacco.github.com/Natural ⇒ GO TO STACKOVERFLOW

https://stackoverflow.com/questions/67356740/error-no-repository-found-at-http-rlogi
acco-github-com-natural
● Creating Maven Project
 Add all needed dependencies from MAVEN repository
https://mvnrepository.com/ to the pom.xml

1. The PicoContainer Cucumber integration makes use of constructor injection


<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>7.3.4</version>
<scope>test</scope>
</dependency>

2. Cucumber-java is used to support Java language


<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.3.4</version>
</dependency>

3. Cucumber-Core contains the core domain logic to execute


Cucumber features.
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.3.4</version>
</dependency>

4. To use JUnit to execute cucumber scenarios add the cucumber-junit


dependency to your pom.
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.3.4</version>
<scope>test</scope>
</dependency>

Cucumber acceptance test example: Cucumber feature


file
 Feature file: keep requirements documents, tests, and
code all in sync (shared source for all stakeholders-
manager,developer, tester,product owner/customer)
Example
Write a Java library that calculates the cost of your groceries at the
supermarket. The library will take two inputs
1. the prices of available items
2. the notification of items as they are scanned at the checkout (read
barcode via scanner or cloud-based service that uses the camera on your
mobile. The checkout will keep track of the total cost.

Finally, run the junit by clicking on AcceptanceTest.java and


then run it as a junit test. The result should fail, because the
feature is not implemented yet.
NOW,... we start to implement each step…And then the
feature will be ready for use as a backend service.
Now start building your source code.
Concl sio : we se BQQ anb TQQ o ge ezate t£e ap licatiox
(so ×ce cobe)

Resources:
https://cucumber.io/docs/guides/10-minute-tutorial/
https://cucumber.io/docs/cucumber/api/

You might also like