The testis is a highly specialized tissue that plays a vital role in ensuring fertility by producing spermatozoa, which are transferred to the female during mating. Spermatogenesis is a complex process, resulting in the production of mature sperm, and involves significant structural and biochemical changes in the seminiferous epithelium of the adult testis. The identification of genes involved in spermatogenesis of Bactrocera dorsalis (Hendel) is critical for a better understanding of its reproductive development. In this study, we constructed a cDNA library of testes from male B. dorsalis adults at different ages, and performed de novo transcriptome sequencing to produce a comprehensive transcript data set, using Illumina sequencing technology. The analysis yielded 52 016 732 clean reads, including a total of 4.65 Gb of nucleotides. These reads were assembled into 47 677 contigs (average 443 bp) and then clustered into 30 516 unigenes (average 756 bp). Based on BLAST hits with known proteins in different databases, 20 921 unigenes were annotated with a cut-off E-value of 10(-5). The transcriptome sequences were further annotated using the Clusters of Orthologous Groups, Gene Orthology and the Kyoto Encyclopedia of Genes and Genomes databases. Functional genes involved in spermatogenesis were analysed, including cell cycle proteins, metalloproteins, actin, and ubiquitin and antihyperthermia proteins. Several testis-specific genes were also identified. The transcripts database will help us to understand the molecular mechanisms underlying spermatogenesis in B. dorsalis. Furthermore, 2913 simple sequence repeats and 151 431 single nucleotide polymorphisms were identified, which will be useful for investigating the genetic diversity of B. dorsalis in the future.