Download and compile Dovecot CE sources. Use the most recent version possible (current main branch is the best).
ImapTest uses Dovecot's library functions.
Dovecot doesn't have any external dependencies.
./configure && make
Download and compile ImapTest.
./configure --with-dovecot=../dovecot-nightly-compile-directory && make
You may want to modify the default configuration from #defines in src/settings.h.
This isn't required, but if you run imaptest often, this way you don't have to give the same parameters every time.