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
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,15 +59,20 @@ is specific enough.
59
59
* `find*()` when searching for multiple objects (collection of objects, never return `null`)
60
60
* `list*()` when listing whole or paged collection of objects (return collection or collection wrapped by DTO)
61
61
* `remove*()` (i.e. `remove(Project project)`) instead od `delete*()`
62
-
* Write **integration tests** for services using _[Jadler](https://github.com/jadler-mocking/jadler/wiki)_.
63
-
* If it is possible write **acceptance tests** to be run with the real backend.
62
+
* In addition to unit tests, write also **integration tests** and **acceptance tests** if possible. See "What to test where" in "Best practices" below.
64
63
* Update [documentation](https://github.com/gooddata/gooddata-java/wiki/Code-Examples) with usage examples.
65
64
66
65
## Best practices
67
-
* **Test class naming**:
68
-
* `*Test` unit tests, but avoid service tests using mocked `RestTemplate` - use integration test
69
-
* `*IT` integration tests (see [`AbstractGoodDataIT`](src/test/java/com/gooddata/AbstractGoodDataIT.java))
70
-
* `*AT` acceptance tests
66
+
* **What to test where**:
67
+
* `*Test` = unit tests
68
+
* focus on verifying bussiness logic, corner cases, various input combinations, etc.
69
+
* avoid service tests using mocked `RestTemplate` - use integration tests with mocked API responses instead
70
+
* `*IT` = integration tests
71
+
* focus on verifying all possible outcomes of API calls
72
+
* see common ancestor [`AbstractGoodDataIT`](src/test/java/com/gooddata/AbstractGoodDataIT.java) setting up [Jadler](https://github.com/jadler-mocking/jadler/wiki) for API mocking
73
+
* `*AT` = acceptance tests
74
+
* focus on verifying the happy path against the real backend (so we're sure mocks in ITs are correct)
75
+
* see common ancestor [`AbstractGoodDataAT`](src/test/java/com/gooddata/AbstractGoodDataAT.java) setting up GoodData endpoint based on passed environment variables
71
76
*Everythingpublic should be **documented** using _javadoc_.
72
77
*When you need some **utility code**, look for handy utilities in used libraries first (e.g. _Spring_ has
73
78
its `StreamUtils`, `FileCopyUtils`, ...).When you decide to create new utility class,
0 commit comments