Skip to content

MadeTechAcademy/harder2heat-stephane-torres-madetech

 
 

Repository files navigation

Review Assignment Due Date

Harder2Heat

In bootcamp, you explored and created an MVP which displayed how you are able to use 3rd party information to show which homes are difficult to heat. A local government in France has heard what you've done, but you need to make some changes for the pitch-and correct some bugs.

This checkpoint is aimed at seeing how well you can:

  • Use TDD principals to implement features on existing code
  • Develop code using Clean Code Principals (heavy emphasis on encapsulation, resuability, and readability)
  • Expand your knowledge of TDD with mocking and other DD frameworks
  • Share and advocate for TDD within your project

Please keep these in mind as not enough evidence will mean you need to repeat this assignment, or not receive your intended mark. Please ask if you're usure!

After creating the venv, you can run the app via flask run

Part 1-This Looks Familiar... ⭐

Completing this will allow you to pass the checkpoint

After running the app, you should see on the page how many properties should be available; as you may notice, there are no tests. How can you confirm this is the correct number?

Once you have done that, here are some other outstanding tickets:

  • Here's a list of the features needed for the demo:

    • The full list of the property coordinates (to be able to sketch the property on the map)
    • The size of the property in metric
    • The OSID
    • When the building age was updated
    • Connectivity; however instead of 'Standalone','Semi-Detached', and 'End Connected', it should read 'Free-Standing','Dual-Connected' and 'Single Connected'

    There should be a mix of both E2E and Unit testing to cover these cases. You should aim to have an average of 80% coverage between the two

  • As your implemented the above features, think carefully how you can implement new changes whilst improving code readability, encapsulation and reducing data leakage. Here's some examples:

    • In utils.py there's i in range and j in range. Looking at them now, is it clear what they do?

    • What's the role of Property? Can you say it has one job? Are there other objects that should be present (hint: yes)? Can the principle of composition be useful in future adaptations?

To be successful you need to improve the encapsulation and readability of this code by 30%.

Part 2-If It Walks Like a Duck... ⭐⭐

Completing this and part 1 will allow you to pass the checkpoint with a merit

This week we explored the merits of mocking and other ways to do developing code

  • On your project, document your use of a mocking framework and submit evidence of your use of mocking in a feature or to fix a bug.

  • This European local government would like to know if they can use their API with this app. The API will be able to send information like number of floors, and distance to public transport in meters. Create a branch in your project to demonstrate using a mocking framework of how you would test this implementation.

  • Using a BDD or other framework, rewrite the tests done in part 1.

Part 3-Be the Change ⭐⭐⭐

Completing this and part 2 will allow you to pass the checkpoint with a distinction

Hopefully by now you should appreciate the benefits of TDD, and you want to share the message with non-developers

  • Show a non-dev (user researcher, delivery manager etc.) the tests written in part 2 with your new framework. How easy is it for them to understand what the code should do? What improvements can be made?

  • Document how you are sharing TDD either with non-developers on your team or developers new to TDD. It must be clear they are new, to TDD, and include how you are working with them, and what test they have written.

How to Run

Set Up

cd into correct directory

python3 -m venv .
pip install requirements.txt

Make sure to be in the correct directory, create a python virtual environment and install necessary dependencies

npm install

install the relevant Node packages/dependencies

Tests

npm run cy:open 

Before launching cypress, run the app by running "flask run" from the command line from the app root directory Launches cypress, click E2E tests, click "Start E2E Testing " and run spec.cy.js by double clicking spec.cy.js

pytest tests/

Runs unit tests

coverage run -m pytest tests/

Runs unit tests with coverage

coverage report

gets coverage report, run after running coverage with unit tests

python3 src/euro-api/test_using_euro_api.py

Runs test for euro-api calls

cd src/morelia
pytest test_acceptance.py

Runs BDD stlye tests

App

flask run

Spins up flask app locally, default is 'http://localhost:5000' check this is the case, if not E2E tests may fail

flask run --debug

Runs app, any code changes and the server will automatically (hot reloading?)

About

madetechacademy-classroom-a752bc-harder2heat-Harder2Heat created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 71.3%
  • JavaScript 18.0%
  • Gherkin 5.8%
  • HTML 4.9%