Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CDT/Obsolete/Testing"

< CDT‎ | Obsolete
(How to add a new test plugin)
(How to add a new test plugin)
Line 21: Line 21:
 
== How to add a new test plugin ==
 
== How to add a new test plugin ==
  
* Create a new plugin project which usually has name as component you want to test and add .tests (or .test), for example org.eclipse.cdt.core.tests
+
* Create a new plugin project which usually has name as component you want to test and add .tests (or .test), for example <tt>org.eclipse.cdt.cool.tests</tt>
* Copy "test.xml" from any other test plugin and modify ''plugin-name'' and ''classname'' properties (''classname'' would be the main suite in the project, for example org.eclipse.cdt.codan.core.test.AutomatedIntegrationSuite)
+
* Copy <tt>test.xml</tt> from any other test plugin and modify ''plugin-name'' and ''classname'' properties (''classname'' would be the main suite in the project, for example <tt>org.eclipse.cdt.cool.test.AutomatedIntegrationSuite</tt>)
* In your plugin make sure you include all test files and resources in build.properties. If test set-up to read java source to extract test cases make sure you include "src" folder
+
* Make sure you include all test files and resources in <tt>build.properties</tt> file. If test set-up to read java source to extract test cases make sure you include <tt>src</tt> folder (or corresponding source folder)
* Add you plugin in org.eclipse.cdt.testing-feature - plugin list
+
* Add you plugin in <tt>org.eclipse.cdt.testing-feature</tt> - in the main plugin list
* In dependencies of testing feature press Calculate which should update the dependencies
+
** Add dependencies. In Dependencies tab press Calculate which should update the dependencies.
* Create an ant target and call to it in org.eclipse.cdt.testing/test.xml (copy and modify one of the existing ones)
+
* Create an ant target and call to it in <tt>org.eclipse.cdt.testing/test.xml</tt> (copy and modify one of the existing ones)
* In releng/org.eclipse.cdt.master/feature.xml make sure that the feature you testing is located before org.eclipse.cdt.testing-feature (that defines build order)
+
* In <tt>releng/org.eclipse.cdt.master/feature.xml</tt> make sure that the feature you testing (i.e. <tt>org.eclipse.cdt.cool</tt>) is located before <tt>org.eclipse.cdt.testing</tt> feature (order of features defines a build order)
  
 
== How to run Junit tests from IDE ==
 
== How to run Junit tests from IDE ==

Revision as of 08:10, 13 May 2010

Junit Automated Tests

Everything starts at the test.xml file in the org.eclipse.cdt.testing plug-in, which lists the test suites that get run.

Junits run on a build machine nightly after build is created and published along with build logs for each build on CDT Nightly Builds page.

Also builds and tests are run every six hours from the CDT trunk on Hudson.

Build machine configuration:

SUSE Linux version 2.6.*-ppc64 
gcc version 4.1.2 20070115

How to add a Test

Adding JUnits is as simple as adding tests to existing suites or adding new suites. Usually each component has its own base test classes which provides common helper methods.

How to add a new test plugin

  • Create a new plugin project which usually has name as component you want to test and add .tests (or .test), for example org.eclipse.cdt.cool.tests
  • Copy test.xml from any other test plugin and modify plugin-name and classname properties (classname would be the main suite in the project, for example org.eclipse.cdt.cool.test.AutomatedIntegrationSuite)
  • Make sure you include all test files and resources in build.properties file. If test set-up to read java source to extract test cases make sure you include src folder (or corresponding source folder)
  • Add you plugin in org.eclipse.cdt.testing-feature - in the main plugin list
    • Add dependencies. In Dependencies tab press Calculate which should update the dependencies.
  • Create an ant target and call to it in org.eclipse.cdt.testing/test.xml (copy and modify one of the existing ones)
  • In releng/org.eclipse.cdt.master/feature.xml make sure that the feature you testing (i.e. org.eclipse.cdt.cool) is located before org.eclipse.cdt.testing feature (order of features defines a build order)

How to run Junit tests from IDE

If tests are written properly you should be able to right click on any java file that contains test suite and select Run As->JUnit Plug-in Test..

To find root file for project open text.xml or corresponding project, for example org.eclipse.cdt.core.tests and find property "classname" in target "suite". For project above it is org.eclipse.cdt.core.suite.AutomatedIntegrationSuite.

Back to the top