diff --git a/FAQ/README.md b/FAQ/README.md index 9727240d8b5..0a2619f398a 100644 --- a/FAQ/README.md +++ b/FAQ/README.md @@ -2545,24 +2545,7 @@ still pass. Add a test case for your changes. #### How do I run CDT JUnit test suite? -There are special Java packages to test CDT itself. Their names end with -suffix ".tests". They are normally run during the build of CDT for -example you can see results for Hudson builds here: -[](https://hudson.eclipse.org/hudson/job/cdt-nightly/lastCompletedBuild/testReport/). - -You can run JUnit tests in UI this way: - -1. Select test CDT package (ends with ".tests", for example -org.eclipse.cdt.core.tests). -2. Locate the main test suite in the package (i.e. -suite/org.eclipse.cdt.core.suite/AutomatedIntegrationSuite.java) -3. Right-click on the suite java file in Package Explorer and -select Run As-\>JUnit Plugin Test. - -You can run individual tests this way as well. - -Note that there could be intermittent failures in random tests, if you -are getting those, try to rerun the tests. +Please see instructions in the testing readme section [How do I run CDT JUnit test suite?](../TESTING.md#how-do-i-run-cdt-junit-test-suite) #### How do I submit a fix for a bug? diff --git a/TESTING.md b/TESTING.md index 632f1036ac0..d0559773598 100644 --- a/TESTING.md +++ b/TESTING.md @@ -6,6 +6,28 @@ This document is a collection of various notes on testing and writing JUnit test Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for contributing information, including setting up a development environment. +### How do I run CDT JUnit test suite? + +There are special Java packages to test CDT itself. +Their names generally end with suffix ".tests". +They are normally run during the build of CDT for example you can see results for Jenkins builds [here](https://ci.eclipse.org/cdt/job/cdt/job/main/lastCompletedBuild/testReport). + +You can run JUnit tests in UI this way: + +1. Select test CDT package (ends with ".tests", for example org.eclipse.cdt.core.tests). +2. Right-click on the class, suite, package, source folder or project you want to run in Package Explorer and select Run As-\>JUnit Plugin Test. + +The build machine generally use the standard [Tycho Surefire](https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/plugin-info.html) class name patterns for [includes](https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/integration-test-mojo.html#includes) and [excludes](https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/integration-test-mojo.html#excludes) to identify tests during automated builds. + +![run_junit_tests.png](images/run_junit_tests.png "screenshot of how to run junit plug-in tests") + + +Some sets of tests are grouped in "suites", these can be used to run subsets of tests that may exist across numerous packages. +An example is the CDT core's [AutomatedIntegrationSuite](https://github.com/eclipse-cdt/cdt/blob/main/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java). + +Note that there could be intermittent failures in random tests, if you are getting those, try to rerun the tests. +Tests can be marked as flaky, see the subsequent section for more details. + ### Marking tests as Slow or Flaky Tests in CDT can be marked as Slow or Flaky to prevent them running as part of the standard test suites. See excludedGroups to skip slow or flaky tests sections above. diff --git a/images/run_junit_tests.png b/images/run_junit_tests.png new file mode 100644 index 00000000000..a56fd1955c1 Binary files /dev/null and b/images/run_junit_tests.png differ