Bug reporting with Generative AI? Whoa! 🫨😵💫😮😱
Problem:
Documenting bug reports, is a drag on the tester’s time, especially with some details that are repetitive. With so much of automation going on, a part of Bug reporting can be automated with Generative AI.
In this blog we will look at how generative ai can be used by a Software tester to automate some processes like bug reporting, and why ai has become a buzzword recently.
Test automation is one thing, but automating the processes like bug reporting, with fewer biases can be a challenge.
Software Testing Strategies:
But can the use of Generative AI in bug reporting become one of your Software testing strategies? 🤔
Before we start off, we have a Linux shell script here
This script does the following:
✅Launches a screen recorder and collects system details like OS, username, hardware details etc.
✅The video at the end of screen recording can replace steps to reproduce.
It can be annotated to indicate issues
The above should be good to automate the documentation of bug reports to an extent. This can save a lot of time especially when there are too many tests (automated also).
❓Wait! This should run on a Linux and on a Mac OS but what about Win 11?
Converting the above script into Python, a more popular script can be a good idea. However…
✅What if I wanted the same script in Python 3
✅What if you do not know Python?
Can Generative AI convert the shell script into Python and help with Bug Reporting?
Let us look at some steps:
✅Open ChatGpt
✅Select ‘Apps’ on the left pane
✅Under GPTs select ‘Code’
- Write prompt in the text box
One-shot prompting or Multi-shot prompting:
Please act like a Senior Python developer who also knows Linux shell scripting. Convert the following shell script delimited by ### into a Python Script### ################ Author: Guruprasad B. Gopinath #################################!/bin/shmkdir -p testfoldercd testfolderTS=$(date)echo $TS > abc.txtTSM=$(sed 's/ /-/g' abc.txt)#echo $TSMtouch docfile$TSM.txtecho "The OS " $(lsb_release -d) > docfile$TSM.txtfirefox -v >> docfile$TSM.txtecho "The user name is: " $(whoami) >> docfile$TSM.txtecho "The kernel version is: "$(uname -a | awk '{print $3}') >> docfile$TSM.txtecho "The architecture is: "$(uname -a | awk '{print $13}') >> docfile$TSM.txt if [ $(cat /sys/block/sda/queue/rotational) -eq 1 ]; then echo "The system has an HDD" >> docfile$TSM.txt fi if [ $(cat /sys/block/sda/queue/rotational) -eq 0 ]; then echo "The system has an SSD" >> docfile$TSM.txt fi echo " Starting screen recorder.... press Ctrl+C when done" recordmydesktop --no-sound --on-the-fly-encoding ###
The output that it gave was:
#!/usr/bin/env python3"""Author: Converted from shell script by Senior Python DevDescription:- Creates a folder- Generates timestamped file- Collects system info- Detects disk type (HDD/SSD)- Starts screen recording"""import osimport subprocessfrom datetime import datetimefrom pathlib import Pathdef run_command(cmd, shell=False): """Run a shell command and return output safely.""" try: result = subprocess.run( cmd, shell=shell, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True ) return result.stdout.strip() except subprocess.CalledProcessError as e: return f"Error: {e.stderr.strip()}"def get_os_description(): return run_command(["lsb_release", "-d"])def get_firefox_version(): return run_command(["firefox", "-v"])def get_username(): return run_command(["whoami"])def get_kernel_version(): uname_output = run_command(["uname", "-a"]) parts = uname_output.split() return parts[2] if len(parts) > 2 else "Unknown"def get_architecture(): uname_output = run_command(["uname", "-a"]) parts = uname_output.split() return parts[12] if len(parts) > 12 else "Unknown"def get_disk_type(): try: with open("/sys/block/sda/queue/rotational") as f: val = f.read().strip() if val == "1": return "HDD" elif val == "0": return "SSD" except FileNotFoundError: return "Unknown" return "Unknown"def main(): # Create directory folder = Path("testfolder") folder.mkdir(parents=True, exist_ok=True) os.chdir(folder) # Timestamp handling ts = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") # Write timestamp to file (mimics abc.txt behavior) with open("abc.txt", "w") as f: f.write(ts) filename = f"docfile{ts}.txt" # Collect system info with open(filename, "w") as f: f.write(f"The OS {get_os_description()}\n") f.write(f"{get_firefox_version()}\n") f.write(f"The user name is: {get_username()}\n") f.write(f"The kernel version is: {get_kernel_version()}\n") f.write(f"The architecture is: {get_architecture()}\n") disk_type = get_disk_type() if disk_type != "Unknown": f.write(f"The system has an {disk_type}\n") print("Starting screen recorder.... press Ctrl+C when done") # Start screen recording try: subprocess.run( ["recordmydesktop", "--no-sound", "--on-the-fly-encoding"] ) except KeyboardInterrupt: print("\nRecording stopped by user.")if __name__ == "__main__": main()
Key Improvements Over Shell Script
- Safe subprocess handling instead of inline shell execution
- Structured functions for maintainability
- Error handling for missing tools/files
- Portable timestamp formatting (avoids whitespace issues from
date) - Pathlib usage for cleaner filesystem operations
- Graceful Ctrl+C handling during recording
Notes / Assumptions
lsb_release,firefox, andrecordmydesktopmust be installed- Disk detection assumes
/sys/block/sdaexists (common but not universal) - Architecture extraction mirrors your original script (index 13), though
uname -mwould be cleaner if you want a fix
If you want, I can:
- Turn this into a CLI tool (
argparse) - Add logging instead of plain text files
- Make it cross-platform (macOS/Windows compatible)
- Package it as a system utility or cron job
Neat is’nt it? Probably not. Not unless we test and run the script.
However, what I am happy about is the grunt work of translation was done by Generative AI in a under a few minutes.
Pros of Bug Reporting with Generative AI:
✌️Fast. That is the only thing that looks transformative
Challenges with Bug Reporting with Generative AI:
While the translation has been done. It cannot be trusted. It could have malicious code or code that does’nt work. This is just an output generated by training the LLM on certain contexts. You need to know Python very well. So the question is, Does it really add to your productivity, if you have these kind of risks? 🤔🤔🤔
Definitely not transformative.