Testing LLM Coding Ability: From Code Generation to Desktop GUI Engineering Practice

    This article examines why passing coding benchmarks does not guarantee deliverable software, using a desktop GUI batch audio-extraction tool as a test case. It covers how to design requirements with conflicting constraints, translate vague expectations into verifiable prompt clauses, review generated code through static checks and dynamic stress tests, and use follow-up questions to verify context consistency. It also lists common pitfalls and engineering recommendations for turning single-machine scripts into production-ready tools.

    1. Why “Can Generate Code” Is Not “Can Deliver Software”

    Over the past year or two, code generation capabilities have improved rapidly. On public leaderboards, new open-source models are generally considered to be approaching top closed-source solutions, and official claims often cite relative metrics such as “about a 50% improvement over the previous generation.” But there is a gap between benchmark scores and real delivery: evaluation tasks are usually single-file, single-function algorithm problems with clear boundaries, while engineering delivery involves system problems with coupled constraints, uncertain runtime environments, and many error paths.

    Take a desktop GUI tool as an example. A seemingly simple “batch format conversion” requirement actually involves seven or eight layers: file system traversal, external dependency detection, task queues, progress reporting, thread safety, exception handling, and status display. Cutting corners in any layer turns “the demo runs” into “it crashes as soon as a user touches it.” So the right way to test a model’s real ability is not to ask whether it “can write Python,” but to give it a complete requirement with conflicting constraints and see whether it can satisfy both functional completeness and engineering robustness in a single generation.

    2. Test Design: Exposing Real Capability with Deliberate Complexity

    The task chosen for this practice is a desktop program that batch-extracts audio tracks from videos and exports them to common audio formats, with the tech stack limited to a general-purpose scripting language plus its built-in GUI library. The requirement list is deliberately dense and mutually constraining:

    • The input side supports common video container formats, and the output side supports two mainstream audio encodings;
    • The GUI must include a file import list, input and output format selection, and execute and exit entry points;
    • It must provide a progress bar and status bar, with exceptions shown via pop-ups or inline messages;
    • The layout must be reasonable and the interaction smooth, and long-running tasks must not freeze the interface;
    • Additional implicit requirements: directory recursion, protection against overwriting files with the same name, and early interception when external dependencies are missing.

    The last item is the “trap” of the whole test. The root cause of a frozen GUI is almost always the same: putting a time-consuming task on the main thread blocks the event loop, so the window cannot repaint and buttons cannot respond. Lazy generated solutions often satisfy “all interface elements are present” but fail completely on this point. When designing requirements, explicitly writing the most easily overlooked engineering constraints into the list distinguishes model tiers better than piling up feature points.

    3. Prompt Engineering: Turning Vague Expectations into Acceptance Criteria

    Vague prompts only produce vague code. A reusable pattern is a five-part structure: role + runtime environment + feature list + non-functional constraints + delivery format:

    1. Role: Senior desktop application engineer
    2. Environment: Scripting language + built-in GUI library, cross-platform, no heavy frameworks
    3. Features: Import files/directories, recursive scanning, format selection, batch conversion, exit
    4. Non-functional: Time-consuming tasks must be off the main thread; progress and status reported in real time;
    5. detect missing external dependencies before prompting; auto-number duplicate output names
    6. Delivery: A single directly runnable source file + dependency notes + feature list

    The key is translating “no freezing” into an executable clause — “time-consuming tasks must be off the main thread and report progress via a queue” — so the model has a clear implementation target. Likewise, “show errors” should be refined into “distinguish three error types: missing dependencies, unsupported formats, and write failures, and give actionable suggestions.” The more verifiable the constraints, the higher the first-pass success rate of the generated result.

    4. Reviewing Generated Results: A Checkable List

    Once you have the code, do not rush to run it. First do a static review against the checklist, then perform dynamic verification.

    At the static level, check four points: first, the threading model — whether time-consuming logic runs in a worker thread and the main thread only handles the event loop and UI updates; second, the progress reporting mechanism — whether the worker thread avoids directly manipulating UI controls and instead posts messages in a thread-safe way; third, resource management — whether external processes and file handles use context managers to ensure release; fourth, error layering — whether recoverable errors and terminating errors are handled differently.

    At the dynamic level, check three points: build a sample set containing non-target formats, corrupted files, and overly long paths; run in an environment missing external dependencies and confirm it intercepts early rather than crashing midway; import hundreds of files in a row and observe memory and responsiveness.

    The following is a schematic skeleton of the threading and progress reporting, with the focus on “the worker thread never touches the UI”:

    1. import threading, queue
    2. msg_q = queue.Queue()
    3. def worker(tasks, out_dir):
    4. for i, src in enumerate(tasks, 1):
    5. try:
    6. convert(src, out_dir) # Time-consuming operation, runs only in the worker thread
    7. msg_q.put(("progress", i, len(tasks)))
    8. except Exception as e:
    9. msg_q.put(("error", src, str(e)))
    10. def poll_ui():
    11. while not msg_q.empty():
    12. kind, *payload = msg_q.get()
    13. if kind == "progress":
    14. i, total = payload
    15. progress.set(i / total)
    16. status.set(f"Completed {i}/{total}")
    17. else:
    18. src, err = payload
    19. messagebox.showerror("Conversion failed", f"{src}\n{err}")
    20. root.after(100, poll_ui) # Main thread polls messages on a timer to avoid blocking

    5. Follow-Up Verification: Testing the Model’s Context Memory

    Passing on the first generation only shows the code is correct; follow-up questions show whether the model truly maintains context consistency. There are three effective types of follow-ups: default behavior confirmation, such as whether the output directory defaults to the program’s directory or the current working directory, which directly affects portability; boundary condition confirmation, such as how duplicate file names are handled and whether an empty directory produces a prompt; maintainability confirmation, such as requiring external dependency paths, supported formats, and concurrency level to be extracted into configuration items.

    If the model changes its answer during follow-ups, omits earlier constraints, or gives a description inconsistent with the code, it is doing “pattern matching” rather than “engineering reasoning.” In that case, ask it to self-check against the requirement list item by item and output a difference report. Letting the model audit itself is often faster than reading line by line manually to locate gaps.

    6. Common Pitfalls and Engineering Recommendations

    First, dependency assumptions. Generated code often assumes external command-line components are already installed. The mature approach is to detect them at startup and provide installation guidance, rather than failing midway through conversion. Second, paths and encoding. Chinese paths, paths with spaces, and overly long paths are high-frequency failure points; use the standard library’s path abstractions uniformly instead of string concatenation. Third, resource peaks for batch tasks. Reading all file metadata at once noticeably slows startup on large directories, so lazy traversal is preferable. Fourth, observability. Adding structured logging and failure retry records to the tool can significantly reduce troubleshooting costs.

    To productize this kind of tool, you can further introduce object storage as an input/output relay, a message queue for task decoupling, a container platform to freeze the runtime environment, and log services with monitoring and alerting for runtime observability, evolving a single-machine script into a manageable batch processing service.

    7. Conclusion

    Evaluating the coding ability of new-generation large models should shift from “can it generate” to “can it deliver a runnable, maintainable, and acceptable engineering artifact in one pass.” The method comes down to three points: write requirements as acceptance criteria and make the most easily overlooked non-functional constraints explicit; insist on both static review and dynamic stress testing; use follow-up questions to verify context consistency and drive model self-auditing. With this process, even for complex scenarios like GUIs that are sensitive to the threading model, you can reliably obtain a complete implementation that runs with zero errors.