[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-24ddc0f5d75046c5622901739e7c5dd533143b0c8e959d652212380cedb1ea36.svg)](https://classroom.github.com/a/T37use2l) # Mutation Testing - Practical Assignment 1 (4pts) ## Task Manager - Project In this repository, you are given a simple task manager project that features basic CRUD operations on tasks. You are required to write unit tests for this project and apply mutation testing to improve your tests. > **Note:** We use poerty for dependency management, pytest for running tests and mutmut for mutation. 1. **Setup**: - Ensure `pytest` and `mutmut` are installed: `poetry add pytest` `poetry add mutmut` 2. **Implementation**: - Write tests for both modules of the project [Task, TaskManager] inside `/tests/test_taskManager.py` > **Note:** Build you tests inside of `./tests/test_taskManager.py` [see the test file](./tests/test_taskManager.py) and __strictly__ follow the provided example. 3. **Execution**: - Run tests using: `poetry run pytest ./tests/test_taskManager.py` 4. **Mutation testing**: - Run mutmut using: `poetry run mutmut run --paths-to-mutate ./taskManager/ --runner="pytest tests/test_taskManager.py` 5. **Check results**: - Use: `poetry run mutmut show` `poetry run mutmut results` 6. **Analyze survived mutations and improve tests**: - Run: `poetry run mutmut show ` > **Note:** Requirements to pass: Minimum number of mutations to cover with tests: 20 For example: You will have a lot of mutations that are not meaningful. You have to get rid of them using `# pragma: no mutate`. Then when you have the set of meaningful mutations - you have to kill them using your tests. # Random Testing - Practical Assignment 2 (2pts) ## InnoDrive - Problem The InnoDrive is a hypothetical autonomous car-sharing service that provides transportation in the Kazan region and was created by SQR graduates from Innopolis. The service proposes two types of cars __budget__ and __luxury__. The service offers flexible two tariff plans. With the “Minute” plan, the service charges its client by time per minute of use. The Service also proposes a “Fixed price” plan where the price is fixed at the reservation time when the route is chosen. If the driver deviates from the planned route for more than 10%, the tariff plan automatically switches to the “Minute” plan. The deviation is calculated as the difference in the distance or duration from the initially planned route. The “Fixed price” plan is available for budget cars only. The Innopolis city sponsors the mobility and offers a 10% discount to Innopolis residents. You are a member of the quality assurance team at InnoDrive. You learned about input domain testing methods and would like to apply them to the billing application that charges the client when he or she completes the ride. > **Note:** the exact __tariffs__, __deviation %__ and __discount %__ will differ for your individual case see below. ## InnoDrive Service The InnoDrive app offers 2 services that can be accessed via the following URL [https://instructors.pg.innopolis.university/innodrive/](https://instructors.pg.innopolis.university/innodrive/): * `/spec` - provides you with the specification for your individual problem * you_email is your IU e-mail address in all lowercase letters e.g. * `/rangeprice` - calculate the price for a given ride. The possible input parameters are: * type={budget|luxury} * plan={fixed_price|minute} * distance=110 * planned_distance=100 * time=110 * planned_time=100 * inno_discount={yes|no} * the output is the price calculated according to the specification * In case of error, __406 Not Acceptable:__ is raised with the __Error code: Price == -1__ * In case of the type error, __422 Unprocessable Entity__ is raised > **Note:** You can see the API and try the services at [https://instructors.pg.innopolis.university/innodrive/docs](https://instructors.pg.innopolis.university/innodrive/docs) ## Tasks The customers have discovered some anomalies in the InnoDrive services when applying __minute__ plans for both types of cars. The input space is enormous, and exhaustive testing of all inputs is out of the question. With the help of the `Hypothesis`, identify at least one failing test case for __time__ parameter in the range of 1-1000 minutes. Prevent exhaustive search and minimize executions. > **Note:** Build you tests inside of `./tests/test_innodrive.py` [see the test file](./tests/test_innodrive.py) and __strictly__ follow the provided example. **Email:** > **Note:** Make sure to replace the email with your Innopolis email ### Error in the Time range Please replace each __ with a __time__ parameter value in minutes for which a failure occurred. _Example (100)_: > **Note:** Keep round brackets * **Budget plan failure on Time =** (124) * **Luxury plan failure on Time =** (817) # Useful resources http://testdriven.io/blog/testing-python/ https://mutmut.readthedocs.io/en/latest/ https://hypothesis.readthedocs.io/en/latest/ https://www.inspiredpython.com/course/testing-with-hypothesis/testing-your-python-code-with-hypothesis