Let G be a group generated by k elements, G=〈g1,…,gk〉, with group operations (multiplication, inversion and comparison with identity) performed by a black box. We prove that one can test whether the group G is abelian at a cost of O(k) group operations. On the other hand, we show that a deterministic approach requires Ω(k2) group operations.