r/javahelp • • Apr 19 '21

Need advice on how to debug more efficiently

Hi I'm a QA and often when I find a bug I get the stack trace and try to find exactly where is the issue and are there other places that this bug impacts and I didn't find them when I test manually.

The issue is that the system is very large and it cant be tested well if i run it all on my machine so the test env runs on the cloud.

Most if the time i get the log to see there is the error and start to imagine in my head from where the data passed how was transformed what was the input and output. If the bug is obvious and easy its not issue for me but when it something hard i cant do it. I have extensive knowledge of all the databases that we use and the interaction with the app but i want to better myself so when i report a bug to be clear when how and what happened. I'm not a fan of the "Click here then error " type of bug reporting

So is there any method that i can apply when i try to find the issue only reading the code with no debugger?

Thanks

21 Upvotes

12 comments sorted by

•

u/AutoModerator Apr 19 '21

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions

  • You include any and all error messages in full

  • You ask clear questions

  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/elk-content-share Apr 19 '21

Why not using some techniques of observabilty within your development process like collecting traces and doing profiling with an APM tool? The Elastic Stack offers this for free.

1

u/LuboMh Apr 19 '21

Hi we will have this in a month or so so i hope it will help me

0

u/elk-content-share Apr 19 '21

Thats one of the reasons why it exists

2

u/HecknChonker Extreme Brewer Apr 19 '21

We use NewRelic at my company. It's free until you are sending them more than 100GB/month.

5

u/wildjokers Apr 19 '21

Just report the bug with exact steps to recreate. The developers will be able to figure out it in short order if you tell them how to recreate it.

Honestly you are probably just going to annoy the developers by trying to figure out the bug yourself. Just tell them how to recreate it and be done with it. The more details you can provide about how to recreate it the better.

2

u/LuboMh Apr 19 '21

Actually, the developers like it when i do it this saves a lot of time in some cases

2

u/loomynartylenny half-decent at Java Apr 19 '21

You said something about being able to read the code and having a test environment, right?

Do you have any form of breakpoint tool that you have access to?

1

u/LuboMh Apr 20 '21

Unfortunately not

2

u/ratherbealurker Apr 19 '21

I would never get annoyed but i would never take your (or anyone's) word for it. It would save me time of course, but I hope they are still checking for themselves. I would assume so.

So going above and beyond is something i imagine they would be appreciative of.

Tracing things can be difficult when you move from 'what DID this do?' to 'what COULD this do?'

A simple example is that you see an error pop up in Method B and the input came from method A, so go back and find all the usages of method A and now you have 5 other areas to check.

If you find yourself going back enough you can get overwhelmed.

Tracing on paper has always helped me. It hard enough to stack everything into your head when there are only one or two paths, add a lot more and it gets confusing.

I just write out the path and draw lines all over and cross out paths as i finish them.

1

u/LuboMh Apr 20 '21

My goal is to give a pre-analysis of the issue so this can save time from what i manage to track if i do it some bugs are resolved from 30 to 70% faster. Evens some of them call me to help them with the debugging i have big domain knowledge of the system that helps every time

1

u/Pauli7 Apr 19 '21

You could do some sort of remote debugging when testing in a dev stage