Lab 3 Python unittest II

March 1, 2023

Attached Files:

  •  math.py (1.63 KB) 
  •  square.py (280 B) 
  •  weather_client.py (883 B) 

In in this lab, we will utilize advanced features of the Python unittest framework (mocks) to develop automated integration tests. You will work on developing integration tests for a weather client and a simple Square class, which uses the Math utility class from Week 2. The WeatherClient class performs RESTful API calls to the open weather platform to obtain current and forecast weather conditions for a given zip code.

In your unit/integration tests, you need to use mocks and patching features of the Python unittest framework to create necessary fake dependencies and stubs. Unit/integration tests MUST provide 100% code coverage of the WeatherClient and Square classes.

Readings:

Steps:

  1. Study attached python classes (weather_client.py and square.py) to get a sense of what these modules do. Pay careful attention to module dependencies.
  2. Study the different functions (units) in each class and design a set of test cases that would result in 100% statement coverage.
  3. Use the unittest framework to develop unit tests for each of the test cases identified in 2. Use mocks to inject necessary dependencies and provide stubs when needed.
  4. Run your unit tests using the unittest runner and make sure all unit tests pass.
  5. Use the coverage tool to generate a coverage report.

Deliverables:

  1. Python unit test code for both weather_client and square modules.
  2. Screenshot showing successful run of all unit tests.
  3. Coverage report.

Get expert help on all your assignments

Trusted Assignment Help

Buy Assignment Writing Help Online

25% Off

0.00
Get Free Quote

HomeworkChoice is a dedicated paper writing service for students the world over. Our team crafts exceptional college application essays or other types of academic papers. The main goal is to help students eliminate stress and work with them to create brilliant, thought compelling – and most importantly, top mark academic papers.

Get In Touch

Email

support@homeworkchoice.com

Phone

+1 520 556 7735

Newsletter



© 2023 HomeworkChoice. All Rights Reserved.

Terms And Conditions Privacy Policy Refund Policy