Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Instructions A developer colleague of yours is working on a chatbot which receives user messages in JSON format and then sends back a list of responses to these users

Instructions A developer colleague of yours is working on a chatbot which receives user messages in JSON format and then sends back a list of responses to these users

Computer Science

Instructions
A developer colleague of yours is working on a chatbot which receives user messages in JSON format and then sends back a list of responses to these users. We expect this particular bot to be able to scale efficiently in production as we expect it to receive lots of traffic once deployed, so QA has been asked to help out reviewing the development and testing approaches.

Unfortunately your teammate went on vacation before they could fully finish their work. They asked you whether you could help them out by taking a look at their code while they're gone. As your colleague ran out in a rush they shouted "It's basically done - just the test `test_retrieve_history` is failing for some weird reason".

The code they left is in the `bot_prototype.py` file, together with a file which contains the tests in `test_bot_prototype.py`.

The third and last file includes the library dependencies for the project. You can install them via `pip install -r requirements.txt` . Please use Python 3.6 or higher.

# Part 1: Code review (no coding required)

As you run `test_retrieve_history` you indeed run into an error ?

Additionally, when working on the code you get the impression that your colleague got a bit sloppy when trying to finish their work in a rush. There are some pieces of code which don't comply with common software engineering best practices. In addition you also discover that `test_retrieve_history` doesn't [cover all branches](https://en.wikipedia.org/wiki/Code_coverage) of `retrieve_conversation_history`. 

- **Task 1**: Please explain the reason for the error on `test_retrieve_history` and suggest a fix.

- **Task 2**: Please make a list of things which should be improved in your colleague's code before putting this project in production

- **Task 3**: What systems should we set up to simplify merging and ensuring quality of developer contributions?

# Part 2: Implementing tests

In order to ship quickly, QA has agreed to work on missing coverage while your colleage implements your suggestions on their code. 

**Task 1 - Coding Challenge** Please add any missing tests that are needed for optimal coverage. Keeping in mind that the bot will be deployed into a high-traffic environment and may need to be scaled up quickly, focus your efforts on missing code coverage, scalability, and stability.

**Task 2** Please make recommendations on any kind of additional testing that should be done in order to ensure the quality of this code in production. If you find any information is missing to support your recommendations, feel free to make your own assumptions and document them. (**You don't need to implement this additional testing**).

# Part 3: Automation & CI/CD

We are a fast moving company, so to make sure we do not break stuff we need to test and deploy continuously. To achieve this, we need a stable local and CI setup as well as CD. Our user base is quite diverse, using Windows, Linux and Mac running setups with or without Docker. For optimal QA, we want to run unit tests and integration tests (backend and frontend) both locally and using the CI, and ensure they are performant at scale.

**Task 1**: Which tasks can we automate in this process, beginning at the python source code development and ending with a published package on the python package repository (pypi.org)? Which frameworks and automated test setup would be most useful? Which best practices should we follow?

**This task is an open question by design. It is your chance to show us your knowledge and strengths. If any requirements are unclear or not mentioned - please make them up as you go and document your decisions.**

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE