Article

October 26, 2026

Evolution of LLMs in unit test generation: evaluation of GPT-5.4

Alberto da Silva Candido; Ana Beatriz Lopes Françoso

DOI: 10.22167/2675-6528-202600481

Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.

Summary

Unit test generation is a laborious task that limits its adoption, but Large Language Models (LLMs) show potential to automate it. This study evaluated the GPT-5.4 model (released in March 2026) in generating unit tests for JavaScript, employing the TestPilot tool on 25 npm packages, and compared its results with those of GPT-3.5-Turbo. Data were collected through automated execution of TestPilot, recording instruction and branch coverage, the presence of non-trivial assertions, and failure types. GPT-5.4 achieved a median of 85.3% instruction coverage and 59.5% branch coverage, outperforming GPT-3.5-Turbo (70.2% and 52.8%, respectively). The proportion of valid tests reached 64.6%, and the rate of tests with non-trivial assertions was 96.2% (median). The self-correction rate based on error messages was 18.3%. It is inferred that GPT-5.4 represents an advancement in automated test generation, although issues such as timeouts and type errors still require human supervision.

Keywords: Large Language Models; Automated Test Generation; TestPilot; Unit Tests.

1. Introduction

Unit tests are fundamental in software development, configuring an essential practice for verifying the correct behavior of functions and methods. They facilitate early detection of failures and serve as a form of executable documentation, clarifying the system’s expected behavior (Khorikov, 2020). Despite their recognized importance, manual test writing is often neglected, as it is perceived as a time-consuming and costly process. This issue has driven the development of various test automation techniques over the past decades.

With the advancement of Large Language Models (LLMs), a new opportunity has emerged to automate this task. These models, trained on vast code repositories, demonstrate the ability to understand function semantics and generate code that resembles that produced by human developers (Wang & Chen, 2023). The application of LLMs in test generation has been a subject of growing interest, as evidenced by recent systematic reviews in the field.

Studies such as Zhang et al. (2025) analyzed 115 publications and proposed a taxonomy that divides the process of test generation with LLMs into two main stages: generation itself and quality assurance. This review highlighted that the prompt engineering technique is dominant in the field, present in 89% of the studies. Complementarily, Zapkus and Slotkienė (2024) provided a historical overview of the evolution of the main LLMs applied to test generation, discussing the parameters and characteristics of models such as GPT, CodeT5, and StarCoder.

In this context of advancements, Schäfer et al. (2024) developed TestPilot, a tool designed to orchestrate LLMs in generating unit tests for JavaScript. In their evaluation, GPT-3.5-Turbo, when used with TestPilot on 25 npm packages, demonstrated a median of 70.2% instruction coverage, significantly outperforming more traditional test generation techniques such as Nessie.

Since the initial evaluation of TestPilot, the evolution of LLMs has been remarkably rapid. In March 2026, OpenAI released GPT-5.4, announcing substantial improvements in reasoning capabilities, instruction adherence, and code generation quality. This rapid technological advancement raises a crucial question about the performance of the latest models in the context of automated test generation.

Given this evolution, the central question guiding this research is whether GPT-5.4 surpasses GPT-3.5-Turbo in the automated generation of unit tests, delivering code with greater coverage and more meaningful tests. The relevance of this study lies in the continuous need to evaluate the state of the art of LLMs applied to software engineering, providing updated empirical evidence. Such evidence is crucial for guiding professionals in the adoption of these tools and assisting LLM developers in identifying areas for improvement, ensuring that technological innovations translate into practical and measurable benefits.

To address this issue and contribute to the field, this work’s main objective is to evaluate the performance of the GPT-5.4 model in the automated generation of unit tests for JavaScript, using the TestPilot tool on a set of 25 npm packages, and to compare its results with those obtained by GPT-3.5-Turbo, recording metrics of coverage, validity, and assertion quality, identifying the most common types of failures and the effectiveness of the error feedback mechanism, in addition to making all research artifacts publicly available to ensure reproducibility.

2. Material and Methods

This work carried out an applied case study, focused on the performance evaluation of a large-scale language model in the automated generation of unit tests. The empirical object of the research consisted of each API function exposed by a predefined set of 25 npm packages. The data analysis approach was predominantly quantitative, complemented by a qualitative analysis of the types of failures and the nature of the generated assertions.

For the execution of the research, the TestPilot tool was used, developed by Schäfer et al. (2024) and available in a public repository (Schäfer et al., 2025). TestPilot orchestrates the interaction with language models to generate unit tests for JavaScript. The language model used was OpenAI’s GPT-5.4, accessed via API (v1/responses route), with parameters of temperature = 0, top-p = 1, maximum limit of 100 tokens per response and up to 5 samples per prompt, kept identical to those of the original study by Schäfer et al. (2024).

The dataset for the evaluation comprised the same 25 JavaScript packages used in the study by Schäfer et al. (2024). The selection of these packages spanned different domains, such as file systems, promises, data structures, and statistics, in addition to varying in popularity levels. Five packages hosted on GitLab, not present in the GPT-3.5-Turbo training set, were included to assess generalization capability. The obtained results were compared with the values reported for GPT-3.5-Turbo in the original study.

The TestPilot operated in a four-step main workflow. First, the API Explorer dynamically identified all exported functions from the packages under test, registering their access paths and signatures. Next, the Documentation Miner extracted documentation comments (doc comments) and code snippets from Markdown files, associating them with the respective identified functions.

The Prompt Generator stage built the initial prompts for the language model, containing the function signature, its body (source code), documentation, and usage examples, when available. Subsequently, the Prompt Refiner was triggered if a generated test failed. In this case, a new prompt was created, including the failed test and the error message, allowing the model to attempt to correct the test code.

For each package, TestPilot was executed, generating tests via API and saving a file with the resulting metrics. Each generated test was syntactically validated and then executed with the Mocha framework, setting a limit of 2 seconds per test. All generated source code, prompts, and execution logs were stored and made publicly available in a GitHub repository (Candido, 2026), ensuring research transparency and reproducibility.

Statement coverage and branch coverage were measured, considering only the tests that were successfully executed. Failures were classified according to the taxonomy of Schäfer et al. (2024), which included AssertionError, TimeoutError, CorrectnessError (type errors, reference errors, syntax errors, missing `done()` call), FileSystemError, and OtherError.

The presence of non-trivial assertions was determined by static analysis: a test was classified as non-trivial if it contained at least one assertion whose value depended on the execution of a function from the package under test. The quantitative metrics analyzed included the percentage of valid tests (tests that executed without error, excluding assertion failures), instruction and branch coverage (calculated on valid tests), the percentage of non-trivial tests, and the feedback correction rate (percentage of failing tests that became valid after refinement with an error message).

3. Results and Discussion

The evaluation of the GPT-5.4 model in the automated generation of unit tests for JavaScript revealed a significant advancement compared to its predecessor, GPT-3.5-Turbo. In total, 5,519 tests were generated for the 25 npm packages analyzed, of which 3,568 were considered valid, representing a proportion of 64.65%. This initial result already demonstrates a substantial improvement in the quality of the generated code, reflecting the model’s enhanced ability to produce executable and functional tests.

The proportion of valid tests achieved by GPT-5.4, at 64.6%, represents a gain of 16.6 percentage points compared to the average of 48.0% obtained by GPT-3.5-Turbo in the previous study (Schäfer et al., 2024). This increase in test validity suggests that GPT-5.4 has a more robust understanding of JavaScript package conventions and APIs, resulting in fewer syntax and reference errors. Detailed analysis by package revealed that, although the overall average was 64.65%, packages such as `node-jsonfile` (94.12%) and `pull-stream` (84.75%) demonstrated a high proportion of valid tests, while `crawler-url-parser` (5.26%) and `spacl-core` (27.08%) showed more modest results, indicating variability in the complexity and test generation capability for different domains.

Regarding code coverage, GPT-5.4 presented a median of 85.3% for statement coverage. This value is expressively higher than the median of 70.2% achieved by GPT-3.5-Turbo, representing an increase of 15.1 percentage points. This improvement indicates that the latest model is capable of exercising a significantly larger portion of the code lines of the functions under test, contributing to a more comprehensive verification of software behavior. Packages such as `simple-statistics` (97.07%) and `delta` (92.79%) demonstrated exceptionally high statement coverages, while `node-geo-point` (1.84%) and `node-graceful-fs` (46.45%) fell below the average, highlighting specific challenges.

Branch coverage also showed a notable advancement, with a median of 59.5% for GPT-5.4, surpassing GPT-3.5-Turbo’s 52.8%, which corresponds to a gain of 6.7 percentage points. This increase is crucial, as branch coverage assesses the ability of tests to explore different conditional paths and control structures within the code. The improvement suggests that GPT-5.4 understands and generates tests that exercise more complex scenarios. However, branch coverage still remains lower than instruction coverage, indicating that generating tests for edge cases or for conditions requiring specific configurations continues to be a challenge for the model, as observed in `node-graceful-fs` (10.56%) and `crawler-url-parser` (33.75%).

One of the most impactful findings was the proportion of tests with non-trivial assertions, which reached a median of 96.2% among the packages. This result is substantially higher than the 61.4% reported for GPT-3.5-Turbo. Non-trivial tests are those that contain assertions whose value depends on the execution of a function of the package under test, conferring practical utility and relevance to the generated tests. The improvement is particularly evident in packages where GPT-3.5-Turbo showed a low non-triviality rate, such as `jsonfile`, which went from 0% with the old model to 100% with GPT-5.4. This indicates that the newer model has better internalized the need to associate assertions with the expected behavior of the tested API, making the generated tests much more useful for developers.

The analysis of failure types in invalid tests generated by GPT-5.4 revealed important patterns. Compared to GPT-3.5-Turbo, the latest model demonstrated a 31% reduction in `FileSystemError` (errors related to file not found) and an 18% decrease in `CorrectnessError` (mainly type and reference errors). This reduction suggests a better understanding of the execution context and environment dependencies by GPT-5.4. However, `TimeoutError` remained frequent, representing a significant portion of failures. Most of these timeouts were attributed to the absence of the `done()` call in asynchronous tests, a pattern that the model has not yet fully internalized in all situations.

The error feedback mechanism, named `RetryWithError`, was triggered for 1,242 failed tests. Of these, 227 tests, corresponding to 18.3%, were successfully corrected after generating a second prompt that included the original error message. This self-correction rate is higher than the 15.6% reported for GPT-3.5-Turbo (Schäfer et al., 2024), indicating that GPT-5.4 more effectively leverages error feedback to adjust and refine test code. The improvement was more significant in correcting assertion errors, where the model learned to adjust expected values, and in timeouts caused by the lack of `done()`, where the model learned to add the necessary call.

The results obtained with GPT-5.4 demonstrate a consistent and multifaceted advancement compared to GPT-3.5-Turbo across all evaluated metrics. The most significant improvements include a higher proportion of valid tests, with a gain of 16.6 percentage points, substantially reducing the need for manual debugging. There was a significant increase in instruction coverage, with the median rising from 70.2% to 85.3%, and in branch coverage, which increased from 52.8% to 59.5%. Furthermore, the rate of tests with non-trivial assertions reached a median of 96.2%, making the generated tests significantly more useful, and the self-correction capability improved from 15.6% to 18.3%, decreasing the need for human intervention.

These findings are in line with recent literature that highlights the rapid evolution of Large Language Models and the importance of prompt engineering in code generation. Studies such as Zhang et al. (2025) and Zapkus and Slotkienė (2024) already pointed to the predominance of prompt engineering and the continuous need to evaluate the performance of new models. The ability of GPT-5.4 to generate tests with greater coverage and more meaningful assertions corroborates the thesis that the choice of model version and prompt structure directly affect quality metrics, as observed in works on test generation for REST APIs (Rincon et al., 2025).

Despite the advances, some limitations persist and demand attention. Branch coverage, although improved, still indicates that many conditional paths are not exercised, suggesting that the model still struggles to generate tests for all possible execution scenarios. `TimeoutError`, which represented 19.2% of failures, and `CorrectnessError`, with 30.6%, demonstrate that the model still makes type and reference errors, especially in more complex APIs or those with intense dynamic typing. Therefore, although GPT-5.4 is a powerful tool for test automation, human supervision remains necessary, mainly for validating asynchronous tests and creating edge scenarios.

In summary, the GPT-5.4 model represents a consistent advancement in the automated generation of unit tests for JavaScript, outperforming GPT-3.5-Turbo across all evaluated metrics, including validity, code coverage, assertion quality, and self-correction capability. The results indicate that the latest Large Language Models are approaching practical and reliable automation for unit test creation, although the need for human supervision persists to handle specific complexities and ensure the robustness of the generated tests.

4. Conclusion

This study evaluated the performance of the GPT-5.4 model in the automated generation of unit tests for JavaScript, using the TestPilot tool on 25 npm packages, and compared its results with those obtained by GPT-3.5-Turbo. It was found that GPT-5.4 consistently outperformed the previous model in all analyzed metrics. A significant increase was observed in the proportion of valid tests, which reached 64.6%, and in instruction coverage, with a median of 85.3%. Branch coverage also showed improvement, reaching 59.5%. Additionally, it was identified that 96.2% of the generated tests contained non-trivial assertions, giving them greater practical utility. The model’s self-correction capability, based on error messages, also proved superior, correcting 18.3% of failed tests. These findings demonstrate a remarkable advancement in the quality and effectiveness of automated unit test generation by Large Language Models, offering updated empirical evidence that can guide professionals in adopting these tools and assist in the continuous improvement of LLMs.

Despite the advances, some limitations were identified. Branch coverage, although improved, still indicates that many conditional paths are not exercised, and issues like TimeoutError and CorrectnessError persist, especially in more complex APIs or those with dynamic typing. This suggests that human supervision remains necessary to ensure test robustness, particularly in asynchronous and edge scenarios. As a practical contribution, all research artifacts were made publicly available, ensuring the reproducibility of the study. For future work, it is suggested to evaluate GPT-5.4 in other programming languages, explore the use of smaller, specialized models for cost optimization, incorporate cost metrics per generated test, and conduct user studies to measure the readability and practical utility of the produced tests.

Bibliographic References

Candido, A.S. 2026. TestPilot Experimento com GPT-5.4. GitHub. Disponível em: https://github.com/albertoscandido/testpilot. Acesso em: 20 abr. 2026.

Khorikov, V. 2020. Unit Testing: Principles, Practices, and Patterns. Manning Publications, Shelter Island, NY, USA.

Rincon, A.M.; Vincenzi, A.M.R.; Faria, J.P. 2025. LLM Prompt Engineering for Automated White-Box Integration Test Generation in REST APIs. In: 2025 IEEE International Conference on Software Testing, Verification and Validation Workshops (ICSTW), Naples, Italy. IEEE. p. 21-28. DOI: https://doi.org/10.1109/ICSTW64639.2025.10962507

Schäfer, M.; Nadi, S.; Eghbali, A.; Tip, F. 2024. An empirical evaluation of using large language models for automated unit test generation. IEEE Transactions on Software Engineering 50(1): 85-105.

Schäfer, M.; Tip, F.; Nadi, S. 2025. TestPilot. GitHub. Disponível em: https://github.com/githubnext/testpilot. Acesso em: 20 abr. 2026.

Wang, X.; Chen, Y. 2023. A review on code generation with LLMs: application and evaluation. In: 2023 IEEE International Conference on Medical Artificial Intelligence (MedAl 2023). Shanghai: IEEE. DOI: https://doi.org/10.1109/MEDAI59581.2023.00044

Zapkus, D.M.; Slotkienė, A. 2024. Unit test generation using large language models: a systematic literature review. In: Lietuvos magistrantų informatikos ir IT tyrimai: konferencijos darbai, 2024 m. gegužės 10 d. Vilnius: Vilniaus universiteto leidykla / Vilnius University Press. p. 136-144. DOI: https://doi.org/10.15388/LMITT.2024.20

Zhang, Q.; Fang, C.; Gu, S.; Shang, Y.; Chen, Z.; Xiao, L. 2025. Large Language Models for Unit Testing: A Systematic Literature Review. arXiv preprint. DOI: https://doi.org/10.48550/arXiv.2506.15227

Article originating from the Final Course Work of the Specialization in Software Engineering of the MBA USP/Esalq

To learn more about the course, click here and access the MBX Academy platform

You may also like

Executive Mba In Leadership And Management

November 23, 2026

Improvements in the efficiency of a secondary biological sludge drying plant

The management of industrial solid waste, especially secondary biological sludge, represented an operational and strategic challenge for a company in the pulp and paper sector. A secondary biological sludge drying plant, installed to meet environmental requirements and reduce costs, operated with low efficiency and high unavailability. The objective of this study was to evaluate and propose a set of actions to increase the operational availability of the plant, ensure the integral processing of the generated sludge, and reduce treatment and transportation costs, in addition to mitigating environmental risks. To this end, an analysis of the root causes of low efficiency was carried out, using tools such as the cause-and-effect diagram (Ishikawa) and the “5 whys” analysis, and hypotheses were tested to identify the most impactful factors. Three main root causes were identified: addition of low-load effluent to the process, absence of a dedicated maintenance team, and lower consistency of dewatered sludge. The proposed countermeasures, which included stopping the addition of effluent, hiring a maintenance team, and testing polymers, had a monthly implementation cost of R$ 35,000.00. An annual reduction in operating expenses of up to R$ 1,800,000.00 and maintenance costs of R$ 600,000.00 was estimated, in addition to a 25% reduction in operational unavailability. It was concluded that the proposed measures are viable, quick to implement, and capable of ensuring the integral processing of secondary biological sludge, strengthening the company’s ESG strategy and ensuring environmental compliance.

Keywords: Operational costs; Operational efficiency; ESG; Biological sludge; Sludge drying.

Data Science And Analytics For Operations

November 19, 2026

Polyp-YOLO: an efficient, low-latency detector for polyps in colonoscopies

The early detection of colorectal polyps is crucial for the prevention of colorectal cancer, and real-time computer-aided detection (CADe) systems have shown gains in endoscopic practice. The objective was to develop and validate a lightweight colorectal polyp detector, based on the YOLO architecture, capable of operating on restricted hardware with high precision and low latency. The methodology used public datasets of endoscopic images, partitioning the Kvasir-SEG dataset for training and internal validation, and CVC-ClinicDB and ETIS-Larib Polyp DB for cross-dataset evaluation. Lightweight variants of the YOLOv8, YOLO11, and YOLO26 families with 640×640 pixel input were evaluated. A grid search tested 70 combinations of optimizers and activation functions, and identified AdaBelief and LeakyReLU as the configuration with the best generalization. The optimization pipeline applied unstructured pruning, knowledge distillation, and fine-tuning. The optimized YOLO11n-seg model outperformed the higher-capacity architecture (YOLO26m-seg) in mAP50 and showed similar performance in F1-Score, operating with approximately seven times fewer parameters. It achieved an mAP50 of 0.7929 and an F1-Score of 0.7514 on the ETIS-Larib dataset, and fast inference was demonstrated in different formats, with real-time latencies. The explainability of predictions was validated by Grad-CAM activation maps. The proposed solution demonstrated itself to be a promising experimental tool for diagnostic support, with technical feasibility for integration into environments with reduced computational power, although it requires future clinical validation.

Keywords: Computer-aided detection; Edge computing; Hyperparameter optimization; Endoscopic image segmentation; Medical computer vision.

Data Science And Analytics For Operations

November 19, 2026

Multi-touch Attribution in E-commerce: A Comparison between Markov Chains and Last-Click

The research investigated Multi-touch Attribution (MTA) Models in e-commerce, seeking to overcome the limitations of the Last-Click model, widely used in the market. The objective was to compare the performance of first-order Markov Chains with Last-Click and Position-Based approaches, identifying the value of assistance channels frequently ignored. To this end, Markov Chain algorithms were applied to a large volume of purchase journey data from the Google Merchandise Store, extracted via BigQuery. The study probabilistically mapped the purchase journey and calculated the Removal Effect to quantify channel relevance. The results demonstrated that data-driven models identified the strategic role of discovery (awareness) and assistance channels, which Last-Click neglected in 65% of complex journeys. Simulated financial analysis indicated an approximate 28% hidden efficiency in Cost Per Acquisition (CPA) for Paid Search, compared to the Last-Click model. It was concluded that Markov Chains allowed for a more accurate mapping of purchase journeys, validating the technical feasibility of the modeling and providing evidence for more efficient budget allocation in digital media, mitigating the risk of early divestment in crucial channels.

Keywords: Assistance channels; Data science; E-commerce; Digital marketing; Media optimization.

Project Management

November 19, 2026

Integrated Software for Operational Communication and Control: Practical Evidence in a Medium-Sized Company

The study analyzed the impacts of the lack of integration between commercial and operational modules of an integrated management software (ERP/CRM) in a medium-sized company in the mechanical engineering sector. The main objective was to evaluate practical evidence of communication and operational control optimization, identify bottlenecks, and formulate improvement proposals. A qualitative-quantitative approach was adopted through a single case study with documentary research, based on the extraction and filtering of historical task records from the Bitrix24 software and statistical correlation analysis between workload and allocated team. Based on the diagnosis, an action plan structured in the 5W2H tool was developed. The results revealed that 54.4% of the registered tasks consisted of duplicate, test, or practically useless records, generated by manual insertion during the scope transition between commercial CRM and engineering. It was also demonstrated that the increase in the commercial team linearly accompanied the growth of inefficient tasks, polluting the database and masking the organization’s real productive capacity. It was concluded that the automation of workflows and native integration between modules are essential to mitigate operational and financial risks, providing replicable guidelines for data governance in small and medium-sized enterprises.

Keywords: System Customization; Enterprise Resource Planning (ERP); Task Management; Management Software.

Project Management

November 19, 2026

Supervised learning in voltammetric quantification with electrochemical sensors

The application of supervised learning in the voltammetric quantification of paraquat in artificial urine was evaluated. The study aimed to quantitatively assess the predictive performance of supervised learning models compared to a univariate “baseline”, preserving independence between devices in the training and testing sets. The research was conducted as an applied case study, processing data from four physical devices, each evaluated under a blank condition and six paraquat concentration levels, totaling 28 square wave voltammetry (SWV) curves. A computational “pipeline” integrated automated file reading, organization of curves into current-potential matrices, generation of potential maps, and device-specific blank correction. Five approaches were considered: conventional univariate calibration, predictive univariate “baseline”, partial least squares (PLS) regression, support vector regression (SVR), and random forest (RF). Predictive evaluation was performed using device-grouped cross-validation. PLS showed the best predictive performance for curves from a device not used in training, with an R² of 0.7981. RF exhibited intermediate performance, while SVR and the predictive univariate “baseline” showed inferior and similar performance between themselves. It was concluded that a compact multivariate representation of the voltammetric profile was more favorable for inter-device prediction than increasing model flexibility under the studied conditions. Grouped validation preserved independence, but the limited number of devices restricts the generalization of results.

Keywords: Supervised learning; Paraquat; PLS; Electrochemical sensors; Square wave voltammetry.

Project Management

November 19, 2026

Improvement of Inventory Management via Lean Six Sigma: Study in the Paper Industry

Organizations seek methodologies to reduce waste, increase efficiency, and become more competitive, promoting sustainable improvements in their processes. In this context, the study aimed to apply the Lean Six Sigma methodology, through the DMAIC cycle, to improve inventory management in a company in the paper industry manufacturing pneumatic hoses, aiming to increase the accuracy between physical and systemic inventories and improve the visual management of parts storage. The research was developed from the collection and analysis of data extracted from the company’s ERP system. Tools such as SIPOC, Ishikawa Diagram, and 5 Whys were used to define and identify the root cause of the problem. As improvement proposals, a Digital Kanban system and an adaptation of the Two-Bin system, called the Three-Bin System, were implemented, in addition to the development of standardized operating procedures and the establishment of control mechanisms. The results demonstrated a significant improvement in inventory accuracy, raising the lowest identified index from 28% to 80%, and detected discrepancies between systemic and physical records equivalent to R$ 134,335.53. It was concluded that the application of Lean Six Sigma, combined with Project Management, represented an effective approach for conducting operational improvement projects, contributed to increased reliability of inventory information, to the improvement of material control processes, and to the strengthening of the organization’s operational management.

Keywords: Inventory accuracy; DMAIC; Visual management.

Data Science And Analytics For Operations

November 19, 2026

Predictive Analysis Methodology for Performance Optimization in E-commerce: Correlation between Public Data and Paid Media

A predictive analysis methodology was developed for e-commerce, integrating transactional data and public search trends. The objective was to develop and validate a predictive model, based on machine learning algorithms, capable of correlating organic search trends with sales performance and paid media costs in the Beauty and Health category of Brazilian e-commerce. The Brazilian E-Commerce Public Dataset by Olist and data from Google Trends were used, processed in Python with the Random Forest Regressor algorithm. A moderate inverse correlation (r = -0.43) with a seven-day lag was identified between organic search volume and purchase. Initial models, based solely on behavioral variables, presented insufficient metrics (R² = -0.47; MAE of R$ 2,120.54). The incorporation of microeconomic (average ticket and shipping) and macroeconomic (exchange rate and Ibovespa index) variables raised the R² of the final model to 0.29, with an MAE of R$ 1,489.63, representing a 24.7% reduction in error compared to the baseline. Temporal cross-validation showed that, in periods of mature operation (2018), the model achieved an R² of 0.42. It was concluded that isolated search volume explains the moment of consumer interest, but not the financial magnitude of sales, making the fusion with transactional and economic data mandatory for predictive viability.

Keywords: Beauty and Health; Consumer Behavior; Google Trends; Machine Learning; Time Series.