As starting a transaction requires a charger to be connected, testing the starting and stopping of a charging session is hard.
Instead, we can create a fake charger that always responds as if it was connected. This means that a specific chargerID can be used to test.
What needs to be done:
Respond with mock data on requests to POST /transactions, passing a specific transactionID every time, when a specific chargerID is used.
Respond with mock data on requests to PUT /transactions/start/{transactionID} when the transactionID is a certain value.
Respond with mock data on requests to GET /transactions/{transactionID} when the transactionID is a certain value.
Respond with mock data on requests to PUT /transactions/stop/{transactionID} when the transactionID is a certain value.
Randomizing certain data in the responses might be a good idea.
Later it might be a good idea to create a "deeper" fake charger that behaves like a real charger, providing updates and such, but this is a good start and shouldn't take too long to implement.
As starting a transaction requires a charger to be connected, testing the starting and stopping of a charging session is hard. Instead, we can create a fake charger that always responds as if it was connected. This means that a specific
chargerID
can be used to test. What needs to be done:POST /transactions
, passing a specifictransactionID
every time, when a specificchargerID
is used.PUT /transactions/start/{transactionID}
when thetransactionID
is a certain value.GET /transactions/{transactionID}
when thetransactionID
is a certain value.PUT /transactions/stop/{transactionID}
when thetransactionID
is a certain value.Randomizing certain data in the responses might be a good idea.