Recently Hugo Palma had a problem with writing a unit test for his IDEA plugin. What he needed was a custom project configuration with a web module.
Actually, IDEA's OpenAPI does not allow to load project from disk (so far). But there is a way to do it using closed API. I've wrote a small example which shows how to write such a test, but remember, there is no guarantee that this code will work with future versions of IDEA.
You'll also have to add idea.jar to your classpath and use some previously described tricks to make tests runnable.
Technorati: IntelliJ IDEA Unit Test