CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query

From Expertiza_Wiki
Revision as of 00:07, 8 April 2023 by Psangan (talk | contribs)
Jump to navigation Jump to search

Team

Mentor

  • Jialin Cui

Team Members

  • Aman Waoo (awaoo)
  • Girish Wangikar (gwangik)
  • Pranavi Sharma Sanganabhatla (psangan)

Description and Testing

According to the instructions, we appear to be expected to work on a Python project that makes API calls to the GitHub GraphQL API using the requests package. We must rewrite the current test cases such that mocking libraries are used in place of actual API calls, and we must also add new test cases to boost the test coverage.

Tasks to be accomplished :

  • Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.
  • Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.
  • Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).
  • Get the code fully tested.

Files Involved

  • test_suit.py
  • requirements.txt
  • env file


Project Description

This project appears to be a Python one that uses the requests library to perform API calls to the GitHub GraphQL API, based on the instructions that were supplied. We are tasked with increasing the test coverage by introducing new test cases, as well as restructuring the current test cases to use mocking libraries rather than actual API calls.

The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.

We took the next actions to accomplish this: 1. Use the command below to install the packages pytest-cov and pytest-mock:

Code Snippet :

   pip install pytest-cov pytest-mock

This will set up the packages your project needs for code coverage and mocking.

Test Plan

Test Execution

We divided the work among the teammates and started tackling the problems. We stubbed the data using the factory and mocked the method calls which were being done internally to get the desired output from the methods that were calling other methods internally.


Conclusion

We have refactored the code in the answer.rb file to return answers in each response. We have tested the model fully and attaching the video of the passed test cases in the submission.