NxtUnit: Automated Unit Test Generation for GoIndustry Experience Report
Automated unit test generation has been extensively studied, with prior research mostly focusing on dynamically compiled or dynamically typed programming languages like Java and Python. However, Go, a popular statically compiled and typed programming language used extensively in server application development, has received limited support from existing tools. To address this gap, we present NxtUnit, an automatic unit test generation tool for Go that uses random testing and is well-suited for microservice architecture. NxtUnit employs a random approach to generate unit tests quickly, making it ideal for smoke testing and providing quick quality feedback. It comes with three types of interfaces: an integrated development environment (IDE) plugin, a command-line interface (CLI) tool, and a browser-based platform. The plugin and CLI tool allow engineers to write unit tests more efficiently, while the platform provides unit test visualization and asynchronous unit test generation. We evaluated NxtUnit by generating unit tests for 13 public open-source repositories and 500 ByteDance in-house repositories, resulting in a code coverage of 20.74% for in-house repositories. We conducted a survey among Bytedance engineers and found that NxtUnit can save them 48% of the time they previously spent on writing unit tests. We have made the tool available at https://github.com/bytedance/nxt_unit.