It's All Writing.

Writing makes you happy.

How to test multiple language test at Apex ( How to change using language dynamically in the test code )


  • Apex


In the present, we must change test user language at m17n testing ( like label which have to change by using language ) because the method like getLabel('key', 'language') doesn't exist in Apex.
So, dynamically changing test user language is one of solutions.


System.runAs(User) method changes the test user in the following block.