Splitting PHPUnit tests for a Laravel app

Trying to get tests running in parallel. so far i have tests running in 2 containers. However, it’s only running a few tests in each container. i’ve got ~390 tests but seeing only ~65 actually being ran.

Double checked I was getting the correct files with the circleci tests glob. Just ran the following locally to assert i had the files and found the expected 99 files.

circleci tests glob ./tests/**/*.php | wc -l

Here’s the what i’ve got so far.

TESTFILES=$(circleci tests glob ./tests/**/*.php | circlec tests split) 

for x in ${TESTFILES};do cp --parents $x ./temp; done

./vendor/bin/phpunit ./temp 

If i up the parallelism to 3 or more i get a few more tests to run but it appears i’d have to add more than the 8 containers i have to accomplish running all the tests.

Am i just missing something here?

I got this working.

was simply an issue with the glob in ci vs locally. :man_facepalming:

I’d be interested to know how this works. Is circleci a command available remotely in the build machines?

1 Like

Yes it is. You can find more about it here https://circleci.com/docs/2.0/parallelism-faster-jobs/#using-the-circleci-cli-to-split-tests

It’s the CLI, which is documented here https://circleci.com/docs/2.0/local-cli/

I guess a plain Docker image is spun up, and then the executable is docker cped into /bin/, something like that? I always thought this was local only, since it isn’t available on images (except circleci ones, of course).

I’m pretty sure it’s injected into all images. Do you not see it there when you try to run it? We may need to update our docs to be clearer.

I’ve not tried it, in fact - probably because I thought it was local only. I will give it a go some time!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.