简体   繁体   中英

How to unit test Eclipse plugin?

I want to improve the Builder Pattern Eclipse Plugin . I want to change the code generated to support generics class and include the class name in the builder class name.

I located where I must add my changes. I want to use TDD but I'm stuck as I don't know how to create an ICompilationUnit type. I want to create an ICompilationUnit from test file and then compare the result to what I expect. I know I can mock it but I don't know well the interface and what each method should do.

I didn't find resources to solve my problem. The resources I found are about GUI testing.

Sadly, the ICompilationUnit defined by JDT is not a simple class, so if you want to unit test it, either you have to mock it (and thus understand what is expected), or you have to use JDT to parse it. For basics, you can use the vogella.com JDT tutorial .

Furthermore, I would look into the test suite of JDT itself , as there were similar issues solved already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM