You will have to inform IRCC for taking the test outside Canada.
https://www.canada.ca/en/immigration-refugees-citizenship/services/canadian-citizenship/become-canadian-citizen/citizenship-test/online.html
Please inform them. Don't take the test outside without informing them. It may lead to...