Can a prospective employer require you to pay to take a test as part of an interview?
That is unlawful.
Section 10 of the BC Employment Standards Act prohibits a person to "request, charge or receive, directly or indirectly, from a person seeking employment a payment for (a) employing or obtaining employment for the person seeking employment". See also section 11.
A prospective employer is allowed to require proof of credentials (such as certifications or a diploma) which in turn might entail a non-reimbursable cost to the candidate. However, that is permissible because the credibility inherent to renown credentialing systems facilitates ascertaining that the prospective employer has no ulterior motive (i.e., profit) for requiring candidates to consume services from a certifying agency. In other words, the employer and the certifying agency must be two separate, totally unrelated agencies, for the former's reliance on the latter to be cognizable in a context of screening candidates.
The post on WorkplaceSE basically describes a scam. Although that post refers to the UK, it is most likely that many other jurisdictions contain a legislative provision similar to the aforementioned statute. As an example, see M[ichigan]CL 408.478.
The application of Section 10 cited by Iñaki Viggers was challenged in a 2009 case where an employment agency was charging a fee Pilipino people seeking employment as nannies in Canada: $1000 on application, $1500 on offer of employment and further $1500 after start of the employment. The Employment Standards authority found:
The Agency has misused the terms in order to obscure the following simple fact: the Agency requires individuals who are seeking employment to pay a fee to the Agency in order for the agency to help them obtain employment. I find the fees charged by the Agency are for Job placements, and are a contravention of Section 10 of the Act.
So, what matters here is the actual purpose of the fee. Specifically, whether it is for job placement (as opposed to, say, testing fitness for the job).
Unless the prospective employer in question only uses the declared fee purpose (to take test) as disguise to the actual purpose (job placement), there is nothing illegal for them to charge such a fee. After all, conducting tests incurs expenses, and the candidates are not yet (and most of them will not become) the employees.
It is, however, rather unusual for a company to genuinely make tests non-free for employment candidates. Normally, employers do absorb hiring costs to find a few good workers among crowds of candidates — otherwise they will miss out on those good workers who cannot (or would not) pay for the tests. Therefore, where someone says they hire for a well known company and require payment for tests, attention should be paid as to whether they are not scammers.