From 7e252747473e02463be21e11c75b36b048fd4690 Mon Sep 17 00:00:00 2001 From: MOHIT GUPTA <76530270+MohitGupta121@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:39:19 +0530 Subject: [PATCH] Fix #1820 : How to approach Bugs? - Documentation (#4957) ## Explanation Fix #1820 : How to approach Bugs? - Documentation ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing --- wiki/Debugging.md | 12 ++++++++++++ wiki/_Sidebar.md | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 wiki/Debugging.md diff --git a/wiki/Debugging.md b/wiki/Debugging.md new file mode 100644 index 00000000000..09a91fa6857 --- /dev/null +++ b/wiki/Debugging.md @@ -0,0 +1,12 @@ +We do a lot of debugging at Oppia-Android, whether because tests are failing on a PR or because of a tricky bug that was found during release testing. This guide will help you get started with debugging and offer useful tips: + +## How do I find the root cause of a bug? + +Generally, finding the root cause of a bug is a question of strategically checking various things so that you can narrow down the "search space" of its possible causes. Here is an approach that you can use to get started: + +1. First, try to reproduce the bug. If you can, that's great; that means you have a way to check whether your fix works. Otherwise, see if you can figure out what circumstances cause the bug to appear (is it on a particular device, does it happen only on either the prod or dev build, etc.). This is important because you will need to find a way to reliably reproduce the bug, in order to test whether your fix worked. +2. If this issue arose in your PR, then check whether the bug appears in develop. If so, then you know that it's not due to changes in your PR, and can do further investigation directly on develop. Otherwise, you can narrow down the cause to a change in your PR. +3. Based on the environment you've identified in steps 1 + 2, write a test case which the bug causes to fail (if one doesn't already exist). This gives you an automatic way to check whether or not the bug is fixed. +4. Then, work towards the solution, until the test case you wrote in step 3 passes. + +Unless the bug you are trying to fix is trivial, we strongly recommend creating a debugging doc to organize your work. You can use this debugging doc to write down any pertinent information about the issue and to organize your debugging process, and it will make it much easier to ask for help from others since all the necessary information is there. You can find more guidance [here](https://github.com/oppia/oppia-android/wiki/Get-Help#before-you-ask-a-general-question) on how to write a debugging doc. \ No newline at end of file diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md index a3f7c429b7b..a5bfa0aaf0e 100644 --- a/wiki/_Sidebar.md +++ b/wiki/_Sidebar.md @@ -35,6 +35,8 @@ * [Ktlint Guide](https://github.com/oppia/oppia-android/wiki/Ktlint-Guide) * [Static Analysis Checks](https://github.com/oppia/oppia-android/wiki/Static-Analysis-Checks) * [Accessibility Guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide) + * [Debugging](https://github.com/oppia/oppia-android/wiki/Debugging) + * [How do I find the root cause of a bug?](https://github.com/oppia/oppia-android/wiki/Debugging#How-do-I-find-the-root-cause-of-a-bug) * [Background Processing](https://github.com/oppia/oppia-android/wiki/Background-Processing) * [Kotlin Coroutines](https://github.com/oppia/oppia-android/wiki/Kotlin-Coroutines) * [DataProvider & LiveData](https://github.com/oppia/oppia-android/wiki/DataProvider-&-LiveData)