Open Source Project - Open Energy Dashboard
Open Source Project - Open Energy Dashboard
Introduction
During last 4 weeks our CTI team (Hyunoh, Abas, Ezequiel, and Mon) worked on Open Energy Dashboard open-source project. Open Energy Dashboard(OED) is a project where it is used as an energy dashboard so that all the users can manage the energy usage of their worksite. (link)
The Issue
We as a team coded a line group reading test case(c11) in JavaScript and TypeScript using Docker and Visual Studio Code, ensuring values are read correctly to reflect 14 days giving hourly point and middle readings. (Link)
Test cases are important to enhance accuracy of a software. By writing and updating test case, we estimate we improved test coverage by 30% and enhanced data accuracy by 25% in a Dockerized environment, ensuring seamless integration and reliable energy value processing.
To resolve the issue, our team
1. looked up for development document,
2.starting Docker and activate web and database server.
3. After fetching test data from csv file, we added test code in readingsCompareMeterQuantity.js file.
4.We could add correct values into the variables to make tests by checking document(DesignDocs/testing/testing.md).
5.After giving test command(npm run testsome src/server/test/web/readingsCompareMeterQuantity.js), I bumped into error like below
but after searching developer guide I realized test command should be made in shell script, and also added correct information in the variable according to the error message like below.
then, all the test cases passed with no error.
Tech stack
Backend
Node.js
A JavaScript runtime used for server-side application logic.Mocha
A feature-rich JavaScript test framework running on Node.js.
It is used for writing and executing unit and integration tests.Chai
An assertion library for JavaScript, often used with Mocha to write expressive tests.
The Chai HTTP plugin is used to test API endpoints.REST API Architecture
The backend follows REST principles, exposing endpoints such as /api/compareReadings/meters/ for handling client requests.
Database
PostgreSQL
A powerful, open-source relational database used to store application data, including user and energy usage information.pg & pg-promise
PostgreSQL clients for Node.js that handle database queries and transactions.
Testing
BDD (Behavior Driven Development) with Mocha & Chai
The test suite follows a BDD-style approach using Mocha's describe/it pattern.
API tests use chai-http to send HTTP requests and verify responses.
DevOps & Deployment
nodemon
Used in development mode to automatically restart the server when code changes.dotenv
Manages environment variables securely.Webpack
Bundles front-end assets and manages dependencies.
Comments
Post a Comment