<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psangan</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psangan"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Psangan"/>
	<updated>2026-06-30T11:03:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149724</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149724"/>
		<updated>2023-04-13T03:45:02Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here is a code sample of a function that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_gists(mocker):&lt;br /&gt;
      contribution_type = 'gists'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_issues(mocker):&lt;br /&gt;
      contribution_type = 'issues'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
In the above code, &lt;br /&gt;
&lt;br /&gt;
test_end_cursor_gists: This is a test case that is testing a function called user_contribution_type_history_page with the contribution type set to 'gists'. It uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
test_end_cursor_issues: This is another test case that is similar to the previous one, but it tests the user_contribution_type_history_page function with the contribution type set to 'issues'. It also uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
* Generating a coverage report: The pytest-cov package has been used to generate a coverage report, which provides information about the percentage of code that is covered by the current test cases. This report can help identify sections of the code that are not being exercised during testing, indicating potential gaps in test coverage.&lt;br /&gt;
&lt;br /&gt;
* Identifying uncovered code sections: The coverage report generated by pytest-cov has been used to pinpoint sections of the code that are not being covered by the existing test cases. These uncovered code sections are areas of the codebase that are not executed during the current test suite, and may represent potential vulnerabilities or untested functionality.&lt;br /&gt;
&lt;br /&gt;
* Introducing more test cases: In order to improve the overall test coverage and include these uncovered code sections, additional test cases have been introduced. These new test cases are designed to specifically target the areas of the code that were identified as lacking coverage in the coverage report. By adding more test cases, the goal is to thoroughly exercise the codebase and ensure that all sections of the code are tested, thereby improving the reliability and quality of the testing process.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the testing coverage. Additional test coverage is yet to be done, so the code snippets and the results will be added as the future work.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149723</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149723"/>
		<updated>2023-04-13T03:44:33Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here is a code sample of a function that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_gists(mocker):&lt;br /&gt;
      contribution_type = 'gists'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_issues(mocker):&lt;br /&gt;
      contribution_type = 'issues'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
In the above code, &lt;br /&gt;
&lt;br /&gt;
test_end_cursor_gists: This is a test case that is testing a function called user_contribution_type_history_page with the contribution type set to 'gists'. It uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
test_end_cursor_issues: This is another test case that is similar to the previous one, but it tests the user_contribution_type_history_page function with the contribution type set to 'issues'. It also uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
* Generating a coverage report: The pytest-cov package has been used to generate a coverage report, which provides information about the percentage of code that is covered by the current test cases. This report can help identify sections of the code that are not being exercised during testing, indicating potential gaps in test coverage.&lt;br /&gt;
&lt;br /&gt;
* Identifying uncovered code sections: The coverage report generated by pytest-cov has been used to pinpoint sections of the code that are not being covered by the existing test cases. These uncovered code sections are areas of the codebase that are not executed during the current test suite, and may represent potential vulnerabilities or untested functionality.&lt;br /&gt;
&lt;br /&gt;
* Introducing more test cases: In order to improve the overall test coverage and include these uncovered code sections, additional test cases have been introduced. These new test cases are designed to specifically target the areas of the code that were identified as lacking coverage in the coverage report. By adding more test cases, the goal is to thoroughly exercise the codebase and ensure that all sections of the code are tested, thereby improving the reliability and quality of the testing process.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. Additional test coverage is yet to be done, so the code snippets and the results will be added as the future work.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149722</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149722"/>
		<updated>2023-04-13T03:39:25Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here is a code sample of a function that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_gists(mocker):&lt;br /&gt;
      contribution_type = 'gists'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_issues(mocker):&lt;br /&gt;
      contribution_type = 'issues'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
In the above code, &lt;br /&gt;
&lt;br /&gt;
test_end_cursor_gists: This is a test case that is testing a function called user_contribution_type_history_page with the contribution type set to 'gists'. It uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
test_end_cursor_issues: This is another test case that is similar to the previous one, but it tests the user_contribution_type_history_page function with the contribution type set to 'issues'. It also uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
* Generating a coverage report: The pytest-cov package has been used to generate a coverage report, which provides information about the percentage of code that is covered by the current test cases. This report can help identify sections of the code that are not being exercised during testing, indicating potential gaps in test coverage.&lt;br /&gt;
&lt;br /&gt;
* Identifying uncovered code sections: The coverage report generated by pytest-cov has been used to pinpoint sections of the code that are not being covered by the existing test cases. These uncovered code sections are areas of the codebase that are not executed during the current test suite, and may represent potential vulnerabilities or untested functionality.&lt;br /&gt;
&lt;br /&gt;
* Introducing more test cases: In order to improve the overall test coverage and include these uncovered code sections, additional test cases have been introduced. These new test cases are designed to specifically target the areas of the code that were identified as lacking coverage in the coverage report. By adding more test cases, the goal is to thoroughly exercise the codebase and ensure that all sections of the code are tested, thereby improving the reliability and quality of the testing process.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project.&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149720</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149720"/>
		<updated>2023-04-13T03:39:02Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here is a code sample of a function that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_gists(mocker):&lt;br /&gt;
      contribution_type = 'gists'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   def test_end_cursor_issues(mocker):&lt;br /&gt;
      contribution_type = 'issues'&lt;br /&gt;
      init_query = {'user': {contribution_type: {'pageInfo': {'endCursor': 'mock_end_cursor'}}}}&lt;br /&gt;
      mocker.patch('my_package.gist_issue_project_pr.get_data', return_value=init_query)&lt;br /&gt;
      dic = gist_issue_project_pr.user_contribution_type_history_page('JialinC', contribution_type, 'mock_end_cursor')&lt;br /&gt;
      assert list(dic['user'].keys())[1] == contribution_type&lt;br /&gt;
&lt;br /&gt;
In the above code, &lt;br /&gt;
&lt;br /&gt;
test_end_cursor_gists: This is a test case that is testing a function called user_contribution_type_history_page with the contribution type set to 'gists'. It uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
test_end_cursor_issues: This is another test case that is similar to the previous one, but it tests the user_contribution_type_history_page function with the contribution type set to 'issues'. It also uses the mocker fixture to mock the my_package.gist_issue_project_pr.get_data function and return a specific query result (init_query). Then, it calls the user_contribution_type_history_page function with mocked data and asserts that the contribution type in the returned dictionary (dic) matches the expected value.&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
* Generating a coverage report: The pytest-cov package has been used to generate a coverage report, which provides information about the percentage of code that is covered by the current test cases. This report can help identify sections of the code that are not being exercised during testing, indicating potential gaps in test coverage.&lt;br /&gt;
&lt;br /&gt;
* Identifying uncovered code sections: The coverage report generated by pytest-cov has been used to pinpoint sections of the code that are not being covered by the existing test cases. These uncovered code sections are areas of the codebase that are not executed during the current test suite, and may represent potential vulnerabilities or untested functionality.&lt;br /&gt;
&lt;br /&gt;
* Introducing more test cases: In order to improve the overall test coverage and include these uncovered code sections, additional test cases have been introduced. These new test cases are designed to specifically target the areas of the code that were identified as lacking coverage in the coverage report. By adding more test cases, the goal is to thoroughly exercise the codebase and ensure that all sections of the code are tested, thereby improving the reliability and quality of the testing process.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project.&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149718</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149718"/>
		<updated>2023-04-13T03:35:45Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
* Generating a coverage report: The pytest-cov package has been used to generate a coverage report, which provides information about the percentage of code that is covered by the current test cases. This report can help identify sections of the code that are not being exercised during testing, indicating potential gaps in test coverage.&lt;br /&gt;
&lt;br /&gt;
* Identifying uncovered code sections: The coverage report generated by pytest-cov has been used to pinpoint sections of the code that are not being covered by the existing test cases. These uncovered code sections are areas of the codebase that are not executed during the current test suite, and may represent potential vulnerabilities or untested functionality.&lt;br /&gt;
&lt;br /&gt;
* Introducing more test cases: In order to improve the overall test coverage and include these uncovered code sections, additional test cases have been introduced. These new test cases are designed to specifically target the areas of the code that were identified as lacking coverage in the coverage report. By adding more test cases, the goal is to thoroughly exercise the codebase and ensure that all sections of the code are tested, thereby improving the reliability and quality of the testing process.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project.&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149717</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149717"/>
		<updated>2023-04-13T03:34:06Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project.&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149716</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149716"/>
		<updated>2023-04-13T03:25:49Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
* Refactoring of code: The code in the test_suit.py file has been refactored, which means it has been modified to improve its structure, readability, or performance. This could involve changes such as reorganizing code blocks, simplifying complex logic, removing redundant or obsolete code, or improving variable names.&lt;br /&gt;
&lt;br /&gt;
* Mocking API calls: In order to obtain the desired output from methods that were originally making API calls, the real API method calls have been replaced with mocked versions. Mocking is a technique used in testing to replace actual dependencies (such as external APIs) with simulated versions that allow controlled and predictable behavior during testing. This allows the tests to be executed in isolation without relying on external services, improving test reliability and performance.&lt;br /&gt;
&lt;br /&gt;
* Modification of test method names: The names of the test methods in the test_suit.py file have been modified to reflect the functionality being tested by those methods. This could involve updating the method names to accurately describe the purpose or behavior being tested, making it easier to understand the purpose of each test case. Descriptive test method names can also serve as documentation, providing insights into the expected behavior of the code being tested.&lt;br /&gt;
&lt;br /&gt;
Overall, these changes indicate that the test_suit.py file has been updated to improve the structure and reliability of the tests, by mocking API calls and using descriptive test method names to clearly indicate the functionality being tested.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149715</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149715"/>
		<updated>2023-04-13T03:20:12Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
3. Changes in the env file :&lt;br /&gt;
&lt;br /&gt;
Updating the env file is essential for providing the required environment variables and configurations for successful test execution. This includes sensitive information like API keys, access tokens, or other values that need to be set as environment variables in the env file. Additionally, the env file may contain other necessary configuration settings, such as base URLs or timeouts, specific to the testing environment. By updating the env file, you ensure that the tests can access the necessary configurations during runtime, resulting in accurate test results.&lt;br /&gt;
&lt;br /&gt;
In our project, we have configured the GitHub access token. Including the GitHub token in the env file involves adding a configuration entry that specifies the token value as the corresponding environment variable. This entry typically follows a key-value format, where the key represents the name of the environment variable and the value represents the GitHub token.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149704</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149704"/>
		<updated>2023-04-13T02:27:48Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mocking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149703</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149703"/>
		<updated>2023-04-13T02:26:55Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149702</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149702"/>
		<updated>2023-04-13T02:26:40Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
    pip freeze &amp;gt; requirements.txt&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149693</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149693"/>
		<updated>2023-04-13T02:07:40Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* UML Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
This image illustrates the concept of mocking GitHub's GraphQL API using a GraphQL API mocking tool. (Please click on the image for a bigger view)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
pip freeze &amp;gt; requirements.txt&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149691</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149691"/>
		<updated>2023-04-13T01:58:34Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* UML Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjectUmlG2334.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
pip freeze &amp;gt; requirements.txt&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjectUmlG2334.png&amp;diff=149690</id>
		<title>File:FinalProjectUmlG2334.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjectUmlG2334.png&amp;diff=149690"/>
		<updated>2023-04-13T01:57:19Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjUml.png&amp;diff=149689</id>
		<title>File:FinalProjUml.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjUml.png&amp;diff=149689"/>
		<updated>2023-04-13T01:56:34Z</updated>

		<summary type="html">&lt;p&gt;Psangan: Psangan uploaded a new version of File:FinalProjUml.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;uml for final project design document.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149688</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149688"/>
		<updated>2023-04-13T01:56:04Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* UML Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:FinalProjUml.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
pip freeze &amp;gt; requirements.txt&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149687</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149687"/>
		<updated>2023-04-13T01:55:41Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* UML Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:uml.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
pip freeze &amp;gt; requirements.txt&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjUml.png&amp;diff=149686</id>
		<title>File:FinalProjUml.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalProjUml.png&amp;diff=149686"/>
		<updated>2023-04-13T01:54:47Z</updated>

		<summary type="html">&lt;p&gt;Psangan: Psangan uploaded a new version of File:FinalProjUml.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;uml for final project design document.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149681</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149681"/>
		<updated>2023-04-13T01:43:19Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:uml.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
And made the following changes in the requirements.txt file to incorporate the required modules for the project :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
pip freeze &amp;gt; requirements.txt&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149516</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149516"/>
		<updated>2023-04-12T21:47:23Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We have implemented API mockingin a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149515</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149515"/>
		<updated>2023-04-12T21:46:45Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Work Strategy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
We implemented API mimicking in a large number of methods and functions. Here are some code samples of the functions that used direct API calls and were adjusted by employing API mocking, as it is very difficult for us to list all the methods we have implemented:&lt;br /&gt;
&lt;br /&gt;
Code snippet :&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149505</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149505"/>
		<updated>2023-04-12T21:34:22Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Tasks and Goals to be accomplished : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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 major goal is to implement the refactored existing code in the files already available in a newly cloned repository.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Update the env file for the github token.&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149504</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149504"/>
		<updated>2023-04-12T21:29:53Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Work Strategy ==&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149502</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149502"/>
		<updated>2023-04-12T21:27:54Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== Plan of Work ===&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149498</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149498"/>
		<updated>2023-04-12T20:44:19Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
The current Python project 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
=== Feature explanation - GitHub GraphQL API queries ===&lt;br /&gt;
&lt;br /&gt;
GraphQL is a modern and flexible API query language that provides a more efficient and developer-friendly way to request and manipulate data from APIs compared to traditional REST APIs. This project makes use of the requests library to send requests to the GitHub GraphQL API to access user public data.  We have used the pytest testing framework and the pytest-mock plugin to create tests for methods that submit requests to an API using the requests library. &lt;br /&gt;
&lt;br /&gt;
=== Tasks and Goals to be accomplished : ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== Plan of Work ===&lt;br /&gt;
&lt;br /&gt;
To achieve the objectives, we conducted the following steps :&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response. Please refer the below code snippet for a better understanding of the statment.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149483</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149483"/>
		<updated>2023-04-12T20:05:40Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Description and Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
According to the instructions, we are 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
This is a Python project 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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149429</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149429"/>
		<updated>2023-04-12T02:34:39Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
According to the instructions, we are 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
This is a Python project 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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149428</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149428"/>
		<updated>2023-04-12T02:34:06Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Description and Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
According to the instructions, we are 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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149405</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149405"/>
		<updated>2023-04-11T19:37:30Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Description and Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Need of API Mocking :&lt;br /&gt;
&lt;br /&gt;
API mocking empowers developers to exercise complete control over the behavior of the mocked API, encompassing responses, errors, and delays. This level of control facilitates precise testing scenarios, such as evaluating error handling, edge cases, or desired responses from the API. Furthermore, it enables the replication of specific scenarios during testing, simplifying the identification and resolution of issues.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149290</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149290"/>
		<updated>2023-04-08T03:39:44Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
This will execute each test case and produce a report on the project's overall coverage. This report helped us identify parts of the code that the current test cases don't cover. We have developed new test cases to cover these regions once you have pointed them out. To imitate the intended behavior of external API calls and to account for both positive and negative eventualities, we used mocking.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149253</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149253"/>
		<updated>2023-04-08T01:40:35Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once()&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149252</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149252"/>
		<updated>2023-04-08T01:37:22Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149238</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149238"/>
		<updated>2023-04-08T01:15:25Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149235</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149235"/>
		<updated>2023-04-08T01:13:26Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
2. All test cases that use function B, which makes a genuine API call, have been refactored so that mocking is used in place of calling. Create a mock version of function B using the mocker.patch function offered by pytest-mock, and set the mock function's return value to the expected API response.&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
   &lt;br /&gt;
   def function_b(): &lt;br /&gt;
    response = requests.get('https://api.example.com/data') &lt;br /&gt;
    return response.json() &lt;br /&gt;
   def function_a(): &lt;br /&gt;
    data = function_b() &lt;br /&gt;
    # do something with the data &lt;br /&gt;
    return data &lt;br /&gt;
   def test_function_a(mocker): &lt;br /&gt;
    mock_function_b = mocker.patch('_main_.function_b') &lt;br /&gt;
    mock_function_b.return_value = {'foo': 'bar'} &lt;br /&gt;
    result = function_a() &lt;br /&gt;
    assert result == {'foo': 'bar'} &lt;br /&gt;
    mock_function_b.assert_called_once() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
&lt;br /&gt;
We divided the work among the teammates and started working on different parts of the project. To generate a coverage report, run the following command :&lt;br /&gt;
  pytest --cov&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
&lt;br /&gt;
The code in the test suit.py file has been refactored. In order to get the desired output from the methods that were using API calls, we mocked the real API method calls that were made internally. We also modified the names of all the test methods to match the functionality carried out by the methods.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149205</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149205"/>
		<updated>2023-04-08T00:31:19Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The pytest-cov package has been used to generate a coverage report and to pinpoint sections of the code that are not being covered by the current test cases. Next, in order to better the overall test coverage and include these areas, we introduced more test cases.&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149189</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149189"/>
		<updated>2023-04-08T00:07:09Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
    pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149188</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149188"/>
		<updated>2023-04-08T00:05:40Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the test_suit.py and implement them in a newly forked repository.&lt;br /&gt;
&lt;br /&gt;
We took the next actions to accomplish this:&lt;br /&gt;
1. Use the command below to install the packages pytest-cov and pytest-mock:&lt;br /&gt;
&lt;br /&gt;
Code Snippet :&lt;br /&gt;
&lt;br /&gt;
pip install pytest-cov pytest-mock&lt;br /&gt;
&lt;br /&gt;
This will set up the packages your project needs for code coverage and mocking.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149187</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149187"/>
		<updated>2023-04-07T23:58:14Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo (awaoo)&lt;br /&gt;
* Girish Wangikar (gwangik)&lt;br /&gt;
* Pranavi Sharma Sanganabhatla (psangan)&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Tasks to be accomplished :&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* Change the requirements.txt file to reflect the newly installed packages (pytest-cov and pytest-mock).&lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149182</id>
		<title>CSC/ECE 517 Spring 2023 - G2334 Develop and refactor test suite for GraphQL Query</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_G2334_Develop_and_refactor_test_suite_for_GraphQL_Query&amp;diff=149182"/>
		<updated>2023-04-07T23:43:08Z</updated>

		<summary type="html">&lt;p&gt;Psangan: Created page with &amp;quot;== Team== === Mentor ===  * Jialin Cui  === Team Members ===  * Aman Waoo * Girish Wangikar * Pranavi Sharma Sanganabhatla  == Description and Testing == Our project deals wit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the test_suit file. The code is responsible for doing the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* &lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2333._Generalize_review_versioning&amp;diff=149181</id>
		<title>CSC/ECE 517 Spring 2023 - E2333. Generalize review versioning</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2333._Generalize_review_versioning&amp;diff=149181"/>
		<updated>2023-04-07T23:41:35Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the test_suit file. The code is responsible for doing the following tasks:&lt;br /&gt;
&lt;br /&gt;
* Test functions should have names that are both descriptive and explicit so that it is evident what part of the system they are testing.&lt;br /&gt;
* Several tests in the current codebase make actual API calls as opposed to using mock calls. Make mock test calls from these tests.&lt;br /&gt;
* &lt;br /&gt;
* Get the code fully tested.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* test_suit.py&lt;br /&gt;
* requirements.txt&lt;br /&gt;
* env file&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2333._Generalize_review_versioning&amp;diff=149179</id>
		<title>CSC/ECE 517 Spring 2023 - E2333. Generalize review versioning</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2333._Generalize_review_versioning&amp;diff=149179"/>
		<updated>2023-04-07T23:28:17Z</updated>

		<summary type="html">&lt;p&gt;Psangan: Created page with &amp;quot;== Team== === Mentor ===  * Jialin Cui  === Team Members ===  * Aman Waoo * Girish Wangikar * Pranavi Sharma Sanganabhatla  == Description and Testing == Our project deals wit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148231</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148231"/>
		<updated>2023-03-23T03:10:42Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148228</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148228"/>
		<updated>2023-03-23T03:10:11Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148224</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148224"/>
		<updated>2023-03-23T03:09:26Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
  require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148218</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148218"/>
		<updated>2023-03-23T03:07:43Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148215</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148215"/>
		<updated>2023-03-23T03:06:27Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148214</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148214"/>
		<updated>2023-03-23T03:05:25Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
       joins(response: {map: :reviewer})&lt;br /&gt;
       .joins(:question)&lt;br /&gt;
       .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
               review_maps.reviewee_id = ? AND&lt;br /&gt;
               answers.question_id = ? AND&lt;br /&gt;
               responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
       .select(:answer, :comments)&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  1. This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  3. It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
    scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
        joins(response: {map: :reviewer})&lt;br /&gt;
        .joins(:question)&lt;br /&gt;
        .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
        .select(:answer, :comments)&lt;br /&gt;
        .distinct&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
  RSpec.describe Answer, type: :model do&lt;br /&gt;
    describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
      let(:assignment) { create(:assignment) }&lt;br /&gt;
      let(:reviewer) { create(:user) }&lt;br /&gt;
      let(:reviewee) { create(:user) }&lt;br /&gt;
      let(:round) { 1 }&lt;br /&gt;
      let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
      let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
      let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
      let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
      it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
        expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
          .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148209</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148209"/>
		<updated>2023-03-23T03:02:07Z</updated>

		<summary type="html">&lt;p&gt;Psangan: /* Files Involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              review_maps.reviewee_id = ? AND&lt;br /&gt;
              answers.question_id = ? AND&lt;br /&gt;
              responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Answer, type: :model do&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:round) { 1 }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148160</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148160"/>
		<updated>2023-03-23T02:18:31Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              review_maps.reviewee_id = ? AND&lt;br /&gt;
              answers.question_id = ? AND&lt;br /&gt;
              responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Answer, type: :model do&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:round) { 1 }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148159</id>
		<title>CSC/ECE 517 Spring 2023 E2310</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_E2310&amp;diff=148159"/>
		<updated>2023-03-23T02:10:29Z</updated>

		<summary type="html">&lt;p&gt;Psangan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment/project management portal that can be used by both instructors and students for collaborative learning and feedback. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Team==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Jialin Cui&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Aman Waoo&lt;br /&gt;
* Girish Wangikar&lt;br /&gt;
* Pranavi Sharma Sanganabhatla&lt;br /&gt;
&lt;br /&gt;
== Description and Testing ==&lt;br /&gt;
Our project deals with refactoring the answer.rb file. The code is responsible for doing the following tasks:&lt;br /&gt;
* To design and implement an answsers_by_response method that returns answers in each response.&lt;br /&gt;
* Get the answer model fully tested.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* answer.rb&lt;br /&gt;
* answer_spec&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
To successfully run answer_spec on the local machine, please run the below rspec command. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec spec/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
The objective of the project is to refactor the following Ruby on Rails model classes in the existing project:- Answer Model on Expertiza.The model is designed to represent answers to questions in Expertiza.  So, whenever anyone fills out a rubric, each “question” that is answered creates a new Answer object.&lt;br /&gt;
&lt;br /&gt;
The task is to refactor the existing code present in the model file and implement them in a new repository. Since the project is implemented from scratch, there are various aspects of the project that have to be implemented and therefore unit test cases are implemented to test the implementation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question_for_reviewee_in_round:&lt;br /&gt;
  1. This method joins the responses, answers, response_maps, and questions table. &lt;br /&gt;
  2. Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id, q_id, and round parameters. &lt;br /&gt;
  3. It retrieves answers and comments columns from the combined table. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question_for_reviewee_in_round, -&amp;gt; (assignment_id, reviewee_id, q_id, round) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              review_maps.reviewee_id = ? AND&lt;br /&gt;
              answers.question_id = ? AND&lt;br /&gt;
              responses.round = ?&amp;quot;, assignment_id, reviewee_id, q_id, round)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the questions, answers, responses, and response_maps table. &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given q_id and assignment_id. &lt;br /&gt;
  It retrieves the distinct answers and comments columns from the combined table. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* answers_by_question:&lt;br /&gt;
  This method joins the responses, answers, response_maps, and questions table.  &lt;br /&gt;
  Then it applies a where clause to filter the results based on the given assignment_id, reviewee_id and q_id.  &lt;br /&gt;
  It retrieves answers and comments columns from the combined table.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
scope :by_question, -&amp;gt; (assignment_id, q_id) do&lt;br /&gt;
    joins(response: {map: :reviewer})&lt;br /&gt;
      .joins(:question)&lt;br /&gt;
      .where(&amp;quot;review_maps.reviewed_object_id = ? AND&lt;br /&gt;
              answers.question_id = ?&amp;quot;, assignment_id, q_id)&lt;br /&gt;
      .select(:answer, :comments)&lt;br /&gt;
      .distinct&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
We have implemented test cases using RSpec for different validation checks for answer.rb.&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/rails_helper.rb'&lt;br /&gt;
require '/Users/aw/Documents/Course Study Material/OODD/Program 3/spec/spec_helper.rb'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Answer, type: :model do&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee_in_round&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:round) { 1 }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map, round: round) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, assignment, and round&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee_in_round(assignment.id, reviewee.id, question.id, round))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question(assignment.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet:&lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_question_for_reviewee&amp;quot; do&lt;br /&gt;
    let(:assignment) { create(:assignment) }&lt;br /&gt;
    let(:reviewer) { create(:user) }&lt;br /&gt;
    let(:reviewee) { create(:user) }&lt;br /&gt;
    let(:question) { create(:question, assignment: assignment) }&lt;br /&gt;
    let(:response_map) { create(:review_map, reviewed_object: assignment, reviewer: reviewer, reviewee: reviewee) }&lt;br /&gt;
    let(:response) { create(:response, map: response_map) }&lt;br /&gt;
    let!(:answer) { create(:answer, question: question, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer and comments for the specified question, reviewee, and assignment&amp;quot; do&lt;br /&gt;
      expect(Answer.by_question_for_reviewee(assignment.id, reviewee.id, question.id))&lt;br /&gt;
        .to match_array([{answer: answer.answer, comments: answer.comments}])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Code Snippet: &lt;br /&gt;
&lt;br /&gt;
  describe &amp;quot;.by_response&amp;quot; do&lt;br /&gt;
    let(:response) { create(:response) }&lt;br /&gt;
    let!(:answer) { create(:answer, response: response) }&lt;br /&gt;
&lt;br /&gt;
    it &amp;quot;returns the answer for the specified response&amp;quot; do&lt;br /&gt;
      expect(Answer.by_response(response.id)).to eq([answer.answer])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
=== Test Execution ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
***Not Sure***&lt;br /&gt;
&lt;br /&gt;
=== Test Coverage ===&lt;br /&gt;
The summary helper spec file is newly created. This project increased testing coverage by 72.86% according to simplecov test. &lt;br /&gt;
[[File:test_coverage.png]]&lt;br /&gt;
&lt;br /&gt;
***Not Sure***&lt;br /&gt;
&lt;br /&gt;
***Not Sure***&lt;br /&gt;
== Future Plan ==&lt;br /&gt;
&lt;br /&gt;
The future scope of this project is to implement waitlist.rb model class that handles the functions related to adding/removing sign up teams to the waitlist for each topic. There are other instance methods in both sign_up_team.rb and sign_up_topic.rb that requires implementation. But, since they are dependent on other model classes, we have added them to our TODO list to implement them in the future.&lt;br /&gt;
&lt;br /&gt;
***Not Sure***&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
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 test cases in the submission.&lt;/div&gt;</summary>
		<author><name>Psangan</name></author>
	</entry>
</feed>