AI Prompts for Identifying Changes Breaking Tests

20 of the best prompts for identifying changes breaking tests, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

AI Prompts for Identifying Changes Breaking Tests

20 of the best prompts for identifying changes breaking tests, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

Scroll to explore

Getting Identifying Changes Breaking Tests right takes more than a single prompt. This 4-stage guide covers Diagnose the Wall, Isolate and Fix, Verify the Resolution, and more, breaking the whole process into focused steps where each prompt builds on the last. When code changes cause previously passing tests to fail, it disrupts the development process and delays releases. This issue often leads to confusion and wasted time trying to identify the root cause. These prompts help developers quickly diagnose, fix, and prevent such issues using GitHub Copilot. Every prompt is optimized and runs in ChatGPT, Claude, and Gemini.

Diagnose the Wall

Identify the specific code changes that caused the tests to fail.

List Recent Code Changes

Please provide a detailed list of all recent changes made to the codebase that could potentially impact the existing tests. For each change, include a brief summary that outlines what was modified, the reason for the change, and any implications it may have on test outcomes. Additionally, categorize the changes by type, such as bug fixes, feature additions, or refactoring, and indicate the date of each change. This will help in diagnosing any issues that may arise in the testing phase.

Diagnose the Wall

Identify Failing Tests

Identify all tests that are currently failing in the project. For each failing test, provide a detailed explanation of what the test is intended to validate, including the expected outcome and the actual outcome. Additionally, include any relevant error messages or logs associated with the failures, and suggest possible reasons for the failures based on the test descriptions. Format the response in a clear, organized manner, with each test listed separately.

Diagnose the Wall

Check Test Dependencies

Analyze the failing tests in the project and identify any dependencies they may have with recent code changes. Provide a detailed report that includes the specific tests that are failing, the recent code changes that may have impacted them, and any potential conflicts that could be causing the failures. Additionally, suggest possible solutions or areas to investigate further to resolve these issues. Format the findings in a clear and organized manner, making it easy to understand the relationships between the tests and the code changes.

Diagnose the Wall

Analyze Error Messages

Please analyze the error messages generated from the failing tests in my project. For each error message, provide a detailed explanation of what it indicates and potential causes for the failure. Additionally, suggest specific steps I can take to troubleshoot and resolve these issues. Include any relevant context about the tests, such as the testing framework used, the expected outcomes, and any recent changes made to the codebase that might have contributed to these errors.

Diagnose the Wall

Review Code Context

Please review the current code context surrounding the failing tests in my project. Identify and highlight any discrepancies or unexpected changes that may be contributing to the test failures. Provide a detailed analysis of the relevant sections of the code, including any recent modifications and how they relate to the tests. Additionally, suggest potential solutions or areas to investigate further to resolve the issues effectively.

Diagnose the Wall

Isolate and Fix

Focus on isolating the exact change causing the test failures and fixing it.

Pinpoint Problematic Change

Identify the specific code change that is causing the test failures in the project. Provide a detailed explanation of how this change impacts the tests, including any relevant dependencies or interactions with other parts of the codebase. Additionally, suggest potential solutions or modifications that could resolve the test failures. Format your response to clearly outline the problematic change, its effects, and the recommended fixes.

Isolate and Fix

Suggest Code Fix

Given the recent changes made in the codebase, identify the specific reasons for the test failures. Suggest a code fix that addresses these issues, ensuring that the solution aligns with best practices and maintains the integrity of the existing code. Include a code snippet that demonstrates the proposed fix, and explain how it resolves the test failures while ensuring that all relevant test cases are considered. Additionally, outline any potential implications of the fix on the overall functionality of the application.

Isolate and Fix

Recommend Test Update

Please review the existing test cases for the recent code changes in [MODULE/FEATURE NAME]. If any tests need updating, provide detailed recommendations for the necessary modifications, including which specific test cases should be altered and the rationale behind each change. Ensure that your suggestions maintain the integrity of the testing framework and cover all edge cases related to the new code implementation. Format your response in a clear, structured manner, listing each test case and the corresponding updates needed.

Isolate and Fix

Propose Refactoring

Propose a detailed refactoring plan for the existing codebase that addresses the current issues and prevents similar problems from arising in the future. Include specific examples of the code that needs to be changed and explain how each proposed change will enhance code maintainability, readability, and testability. Additionally, outline the potential impact of these changes on future development and testing processes, and provide a brief summary of the benefits that this refactoring will bring to the overall project.

Isolate and Fix

Check for Side Effects

Please examine the proposed fix for [SPECIFIC CODE OR FUNCTION] and identify any potential side effects it may have on other parts of the codebase. Conduct a thorough risk assessment that includes: a list of areas in the code that could be impacted, an evaluation of the severity of each potential side effect, and recommendations for mitigating any identified risks. Format your response as a detailed report, including examples where applicable, and highlight any critical dependencies that should be monitored.

Isolate and Fix

Verify the Resolution

Ensure that the fix resolves the test failures and does not introduce new issues.

Run Updated Tests

Please run the updated tests for the project and confirm whether the previous test failures have been resolved. Include a summary of the test results, detailing which tests passed and which, if any, still failed. Additionally, provide any relevant error messages or logs for the tests that did not pass, and suggest potential next steps for addressing any remaining issues. Format the results in a clear and organized manner for easy review.

Verify the Resolution

Check Code Integrity

Please verify the integrity of the codebase after the recent fix. Check for any stability issues or functional anomalies that may have arisen as a result of the changes. Provide a detailed report outlining any errors or unexpected behaviors, including specific areas of the code that may be affected. Additionally, suggest potential solutions or areas for further investigation if any issues are found.

Verify the Resolution

Confirm No New Failures

After applying the fix, please confirm that no new test failures have been introduced in the codebase. Conduct a thorough review of the test results and provide a detailed report. If any new issues are found, list them along with their descriptions, potential causes, and suggested resolutions. Additionally, include information on the tests that were executed and their outcomes to provide context for the findings.

Verify the Resolution

Validate Test Coverage

Please validate the test coverage for the recent code fix in [REPOSITORY NAME]. Analyze the current test suite and determine if the coverage meets the required standards for the affected areas of the code. If you find that the coverage is lacking, provide specific recommendations for additional tests that should be implemented to ensure comprehensive coverage. Include details on which functions or modules need more testing and suggest types of tests (unit, integration, etc.) that would be beneficial.

Verify the Resolution

Review Code Changes

Please review the final code changes made in the [BRANCH NAME] of the [REPOSITORY NAME]. Ensure that the code adheres to best practices in terms of readability, maintainability, and performance. Check for compliance with the project's coding standards and guidelines, and identify any potential issues or areas for improvement. Provide a summary of your findings, including specific examples of any necessary changes and recommendations for enhancing the overall quality of the code.

Verify the Resolution

Prevent Recurrence

Create safeguards to prevent similar issues from occurring in the future.

Draft CLAUDE.md Rule

Draft a new rule for CLAUDE.md aimed at preventing similar test failures based on the recent issue. The rule should clearly outline the specific conditions or practices that must be followed to avoid these failures in the future. Include examples of what constitutes a violation of this rule and suggest any necessary actions or procedures to ensure compliance. Format the rule in a clear and concise manner, suitable for inclusion in the existing documentation.

Prevent Recurrence

Add Code Comment

Please add a detailed comment to the following code snippet: [INSERT CODE SNIPPET HERE]. The comment should explain the recent changes made, the rationale behind those changes, and how they impact the existing tests. Additionally, include any relevant context that future developers might need to understand the implications of this change. Aim for clarity and thoroughness to ensure that the information is easily accessible for anyone reviewing the code in the future.

Prevent Recurrence

Create Checklist Item

Help me create a detailed checklist item to include in our coding guidelines that ensures future code changes do not break existing tests. The checklist should cover key practices such as running all tests after making changes, reviewing test coverage, and documenting any modifications made to existing code. Format the checklist item as a clear, actionable statement that can be easily understood and followed by developers. Include specific examples of what to check for and how to address potential issues before submitting code changes.

Prevent Recurrence

Define Naming Convention

Please define a comprehensive naming convention for test cases that clearly indicates what each test is validating. Include specific guidelines on how to structure the names, such as using prefixes or suffixes to denote the type of test, and suggest best practices for readability and consistency. Additionally, provide at least five examples of well-named test cases that illustrate the convention in action, ensuring that each example is accompanied by a brief explanation of what it validates.

Prevent Recurrence

Set Up Project Guard

Please propose a project guard that automatically detects potential changes in the codebase that could break existing tests. Outline the specific mechanisms it would use to analyze code changes, such as static analysis, dependency tracking, or test coverage metrics. Explain how it would integrate into the development workflow, including when and how developers would receive alerts about potential issues. Additionally, provide recommendations on how to prioritize the alerts based on severity and impact on the overall project.

Prevent Recurrence

Frequently asked questions

Why do my tests fail after code changes?+

GitHub Copilot suggests code based on the current context, which might not account for all test scenarios. Ensure that changes are compatible with existing tests.

How can I identify which change broke my tests?+

Use GitHub Copilot to list recent changes and correlate them with failing tests. It can help pinpoint the exact change causing the issue.

Can GitHub Copilot update my tests automatically?+

GitHub Copilot suggests updates but does not automatically apply them. You need to review and apply the suggested changes manually.

How do I prevent future test failures?+

Implement rules and checklists with GitHub Copilot to guide future code changes and ensure they do not break existing tests.

What if the suggested fix introduces new issues?+

Use GitHub Copilot to verify the fix and check for side effects. It can help identify and mitigate new issues before they become problematic.