The statutory residence test determines an individual's residence status (resident or non-resident) for the whole tax year for the purposes of income tax, capital gains and inheritance tax. However, if part way through a tax year, an individual leaves the UK to live or work abroad or comes from abroad to live and work in the UK, and certain conditions are met, the tax year will be "split" into two parts. In one part of the tax year the individual will be treated as UK resident and in the other part the individual will be treated as non-UK resident.
The HMRC have published a guidance note on the Statutory Residence Test (SRT) which you can find HERE Please read this for additional information
PLEASE NOTE: THIS TEST IS NOT DEFINITIVE AND IS JUST A GENERALIZATION.