Skip to content

Commit

Permalink
Update FAQ instruction on running test suite
Browse files Browse the repository at this point in the history
as a result of the conversation on PR eclipse-cdt#54 we identified the FAQ
on this item was out of date.

eclipse-cdt#54 (comment)
  • Loading branch information
jonahgraham committed Aug 22, 2022
1 parent 6445ec4 commit ec982a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
19 changes: 1 addition & 18 deletions FAQ/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://ci.eclipse.org/cdt/job/cdt-master/lastCompletedBuild/testReport/>](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?
Expand Down
22 changes: 22 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file added images/run_junit_tests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ec982a4

Please sign in to comment.