The process will see staff and pupils who come into contact with an infected person asked to take a Covid-19 test every day for 10 days or self-isolate.
Those who test negative at the start of the school day will be able to continue attending in person, while those who test positive will need to self-isolate and book another test confirming their result.
Lateral flow tests, which detect the presence of the Covid-19 viral antigen from a swab sample, will be used as they can produce results within 30 minutes.
Schools and colleges will be offered support, equipment and training, the government said.
Staff working in special schools will also be offered weekly testing under the new plans.
Education minister Kirsty Williams said:
“We recognise that it has not been easy for pupils and staff who have been required to self-isolate as a result of having been identified as a ‘close contact’ and we recognise the impact it has had on face-to-face teaching.
“Earlier this month, we announced the reduction in the period of time for which a person needs to self-isolate from 14 days to 10 days.
“Following discussions with Public Health Wales and the Children and Schools Technical Advisory Cell, we are pleased to confirm that we will introduce a serial testing programme in schools and further education settings in the new year.”
The Welsh Government said it intends to roll out testing to all schools and further education settings, including primary and childcare staff.
However, the rollout will be phased based on the level of risk to ensure the model is safe, starting with secondary schools and further education settings.
Minister for health and social services Vaughan Gething said: “The lessons we have learnt from using lateral flow tests in pilots in higher education institutions across Wales and secondary schools in Merthyr Tydfil and Rhondda Cynon Taf will help inform how we can successfully deliver lateral flow testing in schools and other education settings in the future.
“It is vital everyone understands that testing alone cannot eradicate the risks associated with contracting and transmitting Covid-19.
“Testing helps to mitigate the risk but it needs to be taken alongside other infection prevention control measures, including appropriate social distancing and hand hygiene measures.”