You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+22-20Lines changed: 22 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,28 +8,19 @@ If you'd like to contribute to the MiMa project, please sign the [contributor's
8
8
9
9
MiMa is split into several modules:
10
10
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
13
13
14
-
## Building
14
+
## Functional Tests
15
15
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
17
18
18
-
$ sbt compile
19
+
testFunctional
19
20
20
-
[sbt]: http://www.scala-sbt.org/
21
+
within sbt.
21
22
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:
33
24
34
25
functional-tests
35
26
|
@@ -44,7 +35,18 @@ After doing that, `reload` if you are in an `sbt` shell session (if that makes n
44
35
45
36
Tests within the `functional-tests` folder should always pass.
46
37
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`
48
50
49
51
## Other tests
50
52
@@ -56,8 +58,8 @@ There are also a few other test types:
56
58
57
59
Unit tests should be favoured to verify specific MiMa APIs. Functional tests should be favoured to verify
58
60
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.
0 commit comments