The Messenger of Allah ﷺ said, "Count for me everyone who has professed Islam."We said, "Messenger of Allah, do you fear for us when we are between six hundred and seven hundred in number?"The Messenger of Allah ﷺ replied, "You do not know, perhaps you will be tested."He said, And indeed we were tested, until a man among us could not pray except in secret.
حدثنا محمد بن عبد الله بن نمير وعلي بن محمد قالا حدثنا أبو معاوية عن الأعمش عن شقيق
قال رسول الله ﷺ أحصوا لي كل من تلفظ بالإسلام قلنا يا رسول الله أتخاف علينا ونحن ما بين الست مائة إلى السبع مائة فقال رسول الله ﷺ إنكم لا تدرون لعلكم أن تبتلوا قال فابتلينا حتى جعل الرجل منا ما يصلي إلا سرا
Bukhari narrated it in jihad and expeditions, chapter on the imam registering the people, hadith 3060, from the hadith of Abu Muawiya, with this wording, as a suspended narration, and Muslim narrated it in faith, chapter on the permissibility of concealing one's faith when in fear, hadith 149, from Ibn Numayr, with this wording.