An affidavit is an official form that someone has designed, so you need to locate it, complete it, and sign it in front of a notary public or somone else appointed to witness signatures.
The only affidavit I've had to sign was the declaration of eligibility to mary, which had to be signed in front of a Canadian consul. If this is your case, make sure you sign in front of the correct consul. In China, each consulate serves specific areas of China, and China won't accept an affidavit witnessed by the "wrong" consulate, even if it is in China.
Isn't bureaucracy wonderful!!??