Objective: To compare the characteristics of MSM with different types of primary sexual partners and to analyze the factors associated with MSM not being tested for HIV in the last six months. Methods: MSM were recruited in nine cities of Shandong Province from April to July 2021, and face-to-face questionnaires were conducted to collect information on sociodemographic characteristics, high-risk behaviors, and HIV testing of MSM. Blood samples were taken for serological tests of HIV and syphilis antibodies. Results: A total of 3 008 men who had anal sex with men in the last six months were divided into three groups according to the type of primary sexual partner in the last six months: the fixed sexual partner group (36.83%, 1 108/3 008), the commercial sexual partner group (3.06%, 92/3 008), and casual sexual partner group (60.11%, 1 808/3 008). There were statistically significant differences in the distribution of age, local residence time, education level, the primary place to find male sexual partners, use of new-type drugs in the last six months, consistent condom use every time during same-sex anal sex in the last six months, group sex in the last six months, no HIV testing in the last six months, having had a sexually transmitted disease in the last year, receiving peer education in the last year, and frequency of syphilis testing in the last year among different groups (P<0.05). Multivariable logistic regression analysis showed that related factors of not being tested for HIV in the last six months in MSM were those aged less than 30 years old (aOR=1.39, 95%CI: 1.06-1.83), married/cohabiting (aOR=1.74, 95%CI: 1.39-2.16), high school education or less (aOR=1.39, 95%CI: 1.15-1.67), had not used new-type drugs in the last six months (aOR=2.27, 95%CI: 1.89-2.71), had not received peer education in the last year (aOR=1.59, 95%CI: 1.28-1.98), had never been tested for syphilis (aOR=11.30, 95%CI: 8.15-15.66), had not been tested in the last year but had been previously tested for syphilis (aOR=5.65, 95%CI: 4.19-7.62), the type of primary sexual partner in the last six months being a commercial sexual partner (aOR=1.80, 95%CI: 1.01-3.20), and the type of primary sexual partner in the last six months being a casual sexual partner (aOR=1.50, 95%CI: 1.26-1.80). Conclusions: The characteristics of MSM with different types of primary sexual partners are different, and the proportion of HIV testing still needs to be improved. In the future, we should make full use of the Internet and peer education to expand the coverage of HIV testing for MSM, targeting the characteristics of MSM with different types of primary sexual partners.