There are four requirements to satisfy the bona fide residence test as an ExPat-
1. You must be a US citizen, or a resident alien living in a country that has a tax treaty with the United States.
2. Your actions must be considered resident-worthy. In other words, the IRS will determine if you are establishing a residency in a foreign country through your intentions and actions, purpose of your trip, and the nature and length of your stay abroad.
3. You must live in the foreign country for a whole tax year (most taxpayers use the calendar year as their fiscal or tax year, so January 1 thru December 31).
4. You cannot have any future plans of returning to the United States.
The fourth requirement can prove to be the most challenging. For example, if your contract is for two years, you will not qualify as a bona fide resident since you have definite plans to return to the US. However, if you take a job in France that is indefinite in term, you will qualify for the bona fide residence test after one full year.
You may still qualify under the physical presence test if you cannot satisfy the requirements of the bona fide residence test (see What is the physical presence test?)
Furthermore, do not confuse the bona fide residence test with the physical presence test- if you truly have become a resident in a foreign country, the physical presence test rules will not make you ineligible for the foreign earned income exclusion. For example, you and your family move to Ireland and later Guinness sends you to Samuel Adams for two months to learn proper beer brewing techniques of a clearly superior beer. You still maintain your Ireland residence and your bona fide resident status (you must have clear intention of returning from such trips).
The physical presence test is in contrast to the bona fide residence test since it is strictly based on days here and days there.
If you make any statements to foreign authorities that you are not a resident of that country, and those authorities either hold that you are not subject to their income tax laws or they have not made a final determination on your residency, you will not be considered a bona fide resident.
Lastly, there are some special agreements and treaties that categorically prevent you from becoming a bona fide resident, however you may still qualify under the physical presence test.