Skip to content

Commit a5ed18e

Browse files
authored
Merge pull request #462 from dwijnand/why-App.scala
CONTRIBUTING: Add docs on 'app' in functional tests
2 parents bf742f6 + 428f0cc commit a5ed18e

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,19 @@ If you'd like to contribute to the MiMa project, please sign the [contributor's
88

99
MiMa is split into several modules:
1010

11-
- mima-core: classes that are used for detection and reporting
12-
- sbt-mima-plugin: the sbt plugin to run MiMa within an sbt build
11+
- `mima-core`: classes that are used for detection and reporting
12+
- `sbt-mima-plugin`: the sbt plugin to integrate MiMa into sbt builds
1313

14-
## Building
14+
## Functional Tests
1515

16-
Using [sbt][sbt]:
16+
The directory 'functional-tests' contains tests to verify MiMa's behaviour (blackbox testing). These may be run
17+
by executing
1718

18-
$ sbt compile
19+
testFunctional
1920

20-
[sbt]: http://www.scala-sbt.org/
21+
within sbt.
2122

22-
This will recompile all MiMa's modules.
23-
24-
## Functional tests
25-
26-
The directory 'functional-tests' contains several functional tests exercising MiMa. All tests are executed as part of the build, therefore when running
27-
28-
$ sbt testFunctional
29-
30-
if one (or more) test fails, the build is stopped and no jar will be produced.
31-
32-
To add a new functional test to the suite, create a new folder within the 'functional-tests' directory with the following structure:
23+
To add a new functional test to the suite, create a new directory within the 'functional-tests' directory with the following structure:
3324

3425
functional-tests
3526
|
@@ -44,7 +35,18 @@ After doing that, `reload` if you are in an `sbt` shell session (if that makes n
4435

4536
Tests within the `functional-tests` folder should always pass.
4637

47-
Note: The `problems.txt` is the test oracle. Expected errors are declared using the MiMa's reporting output (i.e., the output of the tool and the expected errors should match perfectly). Admittedly, this coupling is an issue since the testing framework is highly coupled with the tool output used to report errors to the user. We should improve this and make the two independent. Until then, mind that by changing the output of the tool you will likely have to update some of the test oracles (i.e., problems.txt file). When running tests against Scala 2.12 or higher, `problems-2.12.txt` is preferred over `problems.txt` if the former exists.
38+
Note: The `problems.txt` is the test oracle. Expected errors are declared using the MiMa's reporting output (i.e., the output of the tool and the expected errors should match perfectly). Admittedly, this coupling is an issue since the testing framework is highly coupled with the tool output used to report errors to the user. We should improve this and make the two independent. Until then, mind that by changing the output of the tool you will likely have to update some of the test oracles (i.e., problems.txt file). If the problems reported are different in Scala 2.11 or 2.12, compared to Scala 2.13, then you may use a `problems-2.11.txt` or `problems-2.12.txt` file.
39+
40+
The functional tests also include `app` sources (typically an `app/App.scala`) which exercises the library code.
41+
In more detail, it confirms that if no problems are expected (`problem.txt` is empty, after removing comments)
42+
that running the app doesn't throw any error at runtime. It also asserts the reverse: if the test asserts that
43+
there are problems (i.e. `problem.txt` is non-empty, after removing comments) that running the app _does_ throw
44+
an error at runtime (i.e. MiMa isn't reporting false positives). Broken down into steps, it does the following:
45+
46+
1. compile `v1`
47+
2. compile `app`, against the classfiles of `v1`
48+
3. compile `v2`
49+
4. run the `app`, with a classpath that contains `v2` and not `v1`
4850

4951
## Other tests
5052

@@ -56,8 +58,8 @@ There are also a few other test types:
5658

5759
Unit tests should be favoured to verify specific MiMa APIs. Functional tests should be favoured to verify
5860
MiMa's behaviour (in a blackbox fashion). Scripted tests should be favoured to verify behaviour when it also
59-
concerns its integration in sbt and/or user's tweaking in sbt. (It's unclear when integration tests should be
60-
favoured.)
61+
concerns its integration in sbt and/or user's tweaking in sbt. Integration tests are used when there's an
62+
external dependency, such as depending on resolving external dependencies, and should only be a last resort.
6163

6264
## General Workflow
6365

0 commit comments

Comments
 (0)