James 5:12

But above all things, my brethren, swear not, neither by heaven, neither by the earth, neither by any other oath: but let your yea be yea; and your nay, nay; lest ye fall into condemnation.

Swearing oaths is forbidden. Solemnly calling God to witness that testimony is true remains permitted to God's children. That permission applies when giving lawful testimony upon genuine necessity and call to do so. The oath allowed is therefore not casual swearing but a reverent appeal to God to confirm the truth of what is testified.