Automating unit tests (junit) for Eclipse Plugin development

后端 未结 7 1131
野趣味
野趣味 2020-12-07 23:31

I am developing Eclipse plugins, and I need to be able to automate the building and execution of the test suite for each plugin. (Using Junit)

Test are working with

7条回答
  •  一生所求
    2020-12-08 00:13

    I have just got JUnit testing working as part of the headless build for our RCP application.

    I found this article - Automating Eclipse PDE Unit Tests using Ant incredibly helpful. It provides code and approach to get you started. However, a number of things that I discovered:

    About the article's code

    • there was only one bundle under tests (we have separated out our build process from the code, using Buckminster)
    • there was only one test class.
    • these were both effectively hardcoded into the build script

    About Eclipse PDE

    • the uitestapplication requires another testApplication. Using coretestapplication does not.
    • as these applications are both in bundles that have dependencies on SWT. This is a deal killer in most circumstances, though not if your build machine is a Windows box. I would love to see these split into non-UI bundles.

    I found that the code provided was a good starting point, but had a number of the above assumptions implicit in their implementation.

    Having discovered these assumptions, doing the work was relatively straight forward.

    Our new and shiny setup

    • buckminster builds the bundles.
    • target copies the bundles from the target platform, the org.eclipse.pde.runtime and org.eclipse.jdt.junit into a "tester-eclipse-install". This should take care of your Java Result 13 problem.
    • find the test fragments from looking at the workspace
    • find the fragment host from looking at the manifest
    • find the test classes from looking at the project in the workspace.
    • register a PDETestListener modified to handle multiple test classes
    • invoke the tester-eclipse-install with the multiple test classes.

    I also read Build and Test Automation for plug-ins and features but we are not using PDE-Build directly.

提交回复
热议问题