The Court of Appeal of Alberta has dismissed Suncor's appeal of an injunction that prevents the oilsand giant from randomly testing its employees for drugs and alcohol.

Suncor sought an end to the injunction, arguing that random testing is necessary to ensure safety at its worksites.

The company currently tests employees on suspicion of impairment and in cases of accidents or near misses.

The union that represents 2,800 of Suncor's employees, Unifor 707A, argued the random tests cause irreparable harm to workers by violating their privacy and dignity.

Court of Queen's Bench Justice Paul Belzil granted an interim injunction in December, preventing Suncor from implementing its drug-testing policy.

The injunction is in place while Unifor seeks leave to challenge Suncor's policy before the Supreme Court of Canada.

The Court of Appeal agreed with Belzil, who ruled that if the union was eventually successful, the impact of allowing random tests on the privacy rights and dignity of the employees would in the meantime be irreversible, leaving them to "suffer irreparable harm."

The court was not persuaded that Belzil made any error in his ruling.

The ongoing legal battle dates back to 2012, when Suncor first introduced the random testing policy for safety sensitive jobs.

Unifor filed a grievance, saying the policy violated workers' rights. In 2014, an arbitration tribunal ruled in favour of the union.

Suncor appealed the decision, and it was quashed in 2016 by Court of Queen's Bench Justice Blair Nixon.

Unifor appealed Nixon's ruling, but the Alberta Court of Appeal dismissed the union's challenge last September.

Unifor is now seeking leave to appeal that decision to the Supreme Court.