Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/extrawest/bdd-charge-point-tester-via-ocpp-j-
OCPP Charge Point Tester on Cucumber is a software tool that is designed to simulate Central System in the Open Charge Point Protocol (OCPP) 1.6 specification using the Cucumber testing framework.
https://github.com/extrawest/bdd-charge-point-tester-via-ocpp-j-
bdd cucumber cucumber-framework java ocpp ocpp-j ocpp-j-simulator ocpp16 ocpp16j spring-boot
Last synced: 18 days ago
JSON representation
OCPP Charge Point Tester on Cucumber is a software tool that is designed to simulate Central System in the Open Charge Point Protocol (OCPP) 1.6 specification using the Cucumber testing framework.
- Host: GitHub
- URL: https://github.com/extrawest/bdd-charge-point-tester-via-ocpp-j-
- Owner: extrawest
- Created: 2023-02-23T10:16:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-17T11:53:57.000Z (almost 2 years ago)
- Last Synced: 2024-01-28T17:45:38.206Z (12 months ago)
- Topics: bdd, cucumber, cucumber-framework, java, ocpp, ocpp-j, ocpp-j-simulator, ocpp16, ocpp16j, spring-boot
- Language: Java
- Homepage:
- Size: 444 KB
- Stars: 10
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BDD Charge Point Tester via OCPP J
OCPP Charge Point Tester on Cucumber is a software tool that is designed to simulate a charge point in the Open Charge Point Protocol (OCPP) 1.6 specification using the Cucumber testing framework.
Cucumber is a behavior-driven development (BDD) testing framework that uses the Gherkin language to write test cases in a human-readable format. With the OCPP Charge Point Simulator on Cucumber, test cases can be written in Gherkin and automated using Cucumber's testing framework.
The simulator provides a set of predefined OCPP messages that can be sent and received by the charge point. These messages include basic operations such as boot notification, status notification.
## Badges
![release version](https://img.shields.io/github/v/release/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-?style=for-the-badge)
![release maven](https://img.shields.io/github/actions/workflow/status/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/release-publish.yml?event=push&label=RELEASE%20VERSION%20BUILD&style=for-the-badge)
![snap](https://img.shields.io/github/actions/workflow/status/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/snapshot-publish.yml?branch=dev&label=SNAPSHOT%20VERSION%20BUILD&style=for-the-badge)
![contr](https://img.shields.io/github/contributors/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-?style=for-the-badge)
![commits](https://img.shields.io/github/commit-activity/w/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-?style=for-the-badge)
![OCPP](https://img.shields.io/badge/OCPP-1.6-brightgreen?style=for-the-badge)
![JDK](https://img.shields.io/badge/JDK-17-yellow?style=for-the-badge)
![social](https://img.shields.io/github/forks/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-?style=for-the-badge)## Publication
You can find the latest version of the release in the [Maven Central repository](https://mvnrepository.com/artifact/io.github.extrawest/bdd-charge-point-tester-via-ocpp-j)## Technologies used
- [Spring Boot](https://spring.io/projects/spring-boot)
- [Cucumber for Java](https://cucumber.io/docs/cucumber/api/?lang=java)
- [OCPP library EuChargetime](https://github.com/ChargeTimeEU/Java-OCA-OCPP)## Requirements
- [Java 17 or higher](https://www.oracle.com/java/)
- [Maven 3.6 or higher](https://maven.apache.org/)## Features
Operations Initiated by Charge Point:
- Authorize
- Boot Notification
- Data Transfer
- Diagnostics Status Notification
- Firmware Status Notification
- Heartbeat
- Meter Values
- Start Transaction
- Status Notification
- Stop TransactionOperations Initiated by Central System:
- Cancel Reservation
- Change Availability
- Change Configuration
- Clear Cache
- Clear Charging Profile
- Data Transfer
- Get Composite Schedule
- Get Configuration
- Get Diagnostics
- Get Local List Version
- Remote Start Transaction
- Remote Stop Transaction
- Reset
- Send Local List
- Set Charging Profile
- Trigger Message
- Unlock Connector
- Update Firmware## Installation
Install 1/2: Add this to pom.xml:
```
com.extrawest
bdd-charge-point-tester-via-ocpp-j
0.1.2```
Install 2/2: Run via command line
```bash
mvn install
```
## Setup
You need to set port via [application.properties](src/main/resources/application.properties). For example:
```
server.port=3000
```
## Running Tests1. You need to create a feature file. The file should be located in ['src/test/resources/features'](src/test/resources/features).
2. You need to write a test scenario. [Mandatory sequence of the steps](#Mandatory-sequence-of-the-steps) is REQUIRED.
3. Run the scenario.Or you can copy scenario script from [the folder](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/tree/main/src/test/resources/features). Just change data and run
#### Mandatory sequence of the steps
- [Starting the Central System(CS)](#Starting-the-CS)
- [Waiting for a Charge Point(CP) connection](#Waiting-for-connection)
- [Operation test](#operation-test)###### All text in steps is case-sensitive.
### Starting the CS
###### You can run CS by next steps:
```gherkin
Given the Central System is started
Given the Central System is started on "129.39.32.0"
```
###### In the first case CS will start on 'localhost'.
###### In the second - CS will start on specified IP.### Waiting for connection
###### CS can wait connection with any CP(the first case) or with only specified CP(the second case).
```gherkin
Given the Charge Point is connected
Given the Charge Point "ChargePointId" is connected
```### Operation test
###### According to the OCPP documentation, operations are divided into two parts:
- operations initiated by CP
- operations initiated by CS
###### Also every sent request must receive confirmation response.
###### The next steps combination is used to test operation, regardless of what data will be received or sent:
#### initiated by CP without parameters
```gherkin
When the Central System must receive "ClearCache.req"
Then the Central System must send confirmation response
```
#### initiated by CS without parameters
```gherkin
When the Central System sends "Reset.req" request to the Charge Point
Then the Central System receives confirmation
```
###### The sending messages will be created with the [default values](#default-values):#### Message's parameters
###### According to OCPP documentation messages can have required and optional parameters.###### The next steps combination is used to test operation, with specified parameters:
#### initiated by CP with parameters
```gherkin
When the Central System must receive "BootNotification.req" with given data
| chargePointModel | CurrentModel |
| chargePointVendor | CurrentVendor |
Then the Central System must send confirmation response with given data
| currentTime | any |
| interval | 60 |
| status | Accepted |
``````
#### initiated by CS with parameters
```gherkin
When the Central System sends "Reset.req" request to the Charge Point with given data
| type | Hard |
Then the Central System receives confirmation with given data
| status | any |
```
###### All required fields must be specified, optional fields - optional.#### Validation
###### A receiving message and the specified parameters will be validated according to OCPP documentation.
#### Assertion
###### If parameters are specified then all received data in message will be asserted to these parameters.#### Wildcard
###### Parameters can be specified as wildcard(by default 'any').
```gherkin
| currentTime | any |
```
###### For the receiving message this means that current field must have any value(can't be Null).
###### For the sending message - current field value will be set to [default value](#default-values).### List of available steps:
- ``` Given``` [the Central System is started](#Starting-the-CS)
- ``` Given``` [the Central System is started on "specified IP"](#Starting-the-CS)
- ``` Given``` [the Charge Point is connected](#Waiting-for-connection)
- ``` Given``` [the Charge Point "specified Charge Point Id" is connected](#Waiting-for-connection)
- ``` When``` [the Central System must receive "OCPPMessageType.req"](#initiated-by-CP-without-parameters)
- ``` When``` [the Central System must receive "OCPPMessageType.req" with given data](#initiated-by-CP-with-parameters)
- ``` Then``` [the Central System must send confirmation response](#initiated-by-CP-without-parameters)
- ``` Then``` [the Central System must send confirmation response with given data](#initiated-by-CP-with-parameters)
- ``` When``` [the Central System sends "OCPPMessageType.req" request to the Charge Point](#initiated-by-CS-without-parameters)
- ``` When``` [the Central System sends "OCPPMessageType.req" request to the Charge Point with given data](#initiated-by-CS-with-parameters)
- ``` Then``` [the Central System receives confirmation](#initiated-by-CS-without-parameters)
- ``` Then``` [the Central System receives confirmation with given data](#initiated-by-CS-with-parameters)
- ``` Then``` the Central System must receive requested message. [Used only with TriggerMessage.req](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/triggerMessage.feature)
- ``` Then``` the Central System must receive requested message with given data. [Used only with TriggerMessage.req](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/triggerMessage.feature)### Default values
###### All messages have the default values for every field. These values can be set in application.properties file. If field value is a complicated type(IdTagInfo for example) then you can specify it via JSON string. For example:
```
- BootNotification.confirmation.interval=60
- Authorize.confirmation.idTagInfo=IdTagInfo{expiryDate="2023-12-31T23:59:59.712244462+02:00[Europe/Kyiv]", parentIdTag=FH7R5JKK6SQ8, status=Accepted}
- Reset.request.requestedMessage=Soft
- TriggerMessage.request.requestedMessage=BootNotification
```#### Scenario example:
* [Authorize](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/incoming/authorize.feature) message
* [Boot Notification](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/incoming/bootNotification.feature) message
* [Data Transfer](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/incoming/dataTransfer.feature) message
* [Meter Values](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/incoming/meterValues.feature) message
* [Status Notification](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/incoming/statusNotification.feature) message
* [Change Availability](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/changeAvailability.feature) message
* [Clear Cache](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/clearCache.feature) message
* [Get Configuration](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/getConfiguration.feature) message
* [Reset](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/reset.feature) message
* [Trigger Message](https://github.com/extrawest/BDD-Charge-Point-Tester-via-OCPP-J-/blob/main/src/test/resources/features/outcoming/triggerMessage.feature) message