Skip to content

Commit df4b726

Browse files
committed
separated integration tests, updated CONTRIBUTING.md
1 parent 1f34cd6 commit df4b726

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,32 @@ https://maven.apache.org/install.html
1010

1111
### Oracle Maven Repository
1212
The library uses OJDBC Driver to connect to the database, it's added as a maven dependency. To be able to download the Oracle dependencies, you need to configure your access to Oracle's Maven Repository:
13+
Create file `gradle.properties` in the root directory of the repository and place OTN credentials there:
14+
```properties
15+
ORACLE_OTN_USER[email protected]
16+
ORACLE_OTN_PASSWORD=password
17+
```
1318

14-
http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010
19+
After configuring your access to Oracle's Maven repository, you will be able to successfully build this API by disabling integration tests.
1520

16-
*Sections 6.1 and 6.5 are the more important ones, and the only ones you need if you're using the latest Maven version.*
21+
```bash
22+
./gradlew build -x intTest
23+
```
1724

1825
### Local database with utPLSQL and utPLSQL-demo-project
1926

2027
To usefully contribute you'll have to setup a local database with installed [latest utPLSQL v3](https://github.com/utPLSQL/utPLSQL) and [utPLSQL-demo-project](https://github.com/utPLSQL/utPLSQL-demo-project).
2128
The demo-project will serve as your test user. See .travis.yml to see an example on how it can be installed.
29+
By default tests are executed against `app/app` user of `localhost:1521/XE database`.
2230

23-
### Maven settings for utPLSQL-local profile
24-
25-
utPLSQL-java-api comes with a preconfigured profile "utPLSQL-local". This profile uses properties to set the correct
26-
environment variables for DB_URL, DB_USER and DB_PASS which is needed to run the integration tests.
27-
You can set these properties by adding the following to your Maven settings.xml:
28-
29-
```xml
30-
<settings>
31-
<!-- ... -->
32-
<profiles>
33-
<profile>
34-
<id>utPLSQL-local</id>
35-
<properties>
36-
<dbUrl>localhost:1521/XE</dbUrl>
37-
<dbUser>app</dbUser>
38-
<dbPass>app</dbPass>
39-
</properties>
40-
</profile>
41-
</profiles>
42-
43-
<activeProfiles>
44-
<activeProfile>utPLSQL-local</activeProfile>
45-
</activeProfiles>
46-
</settings>
47-
```
48-
49-
After configuring your access to Oracle's Maven repository, you will be able to successfully build this API.
31+
If you want to run tests against another database you may set `DB_URL`, `DB_USER`, `DB_PASS` environment variables.
5032

33+
When you have local database set up you can run the complete build including integration tests by executing
5134
```bash
52-
cd utPLSQL-java-api
53-
mvn clean package install
35+
./gradlew build
5436
```
5537

5638
### Skip the local database part
5739

58-
If you want to skip the local database part, just run ``mvn clean package install -DskipTests``.
59-
You will still be able to run ``mvn test`` because integration tests are run in the ``verify``-phase.
40+
If you want to skip the local database part, just run ``./gradlew test``.
41+
You will be able to run ``./gradle test`` because integration tests are executed in the separate ``intTest`` task as part of overall ``check``.

build.gradle.kts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,37 @@ dependencies {
5353
}
5454

5555
tasks {
56-
withType<Test> {
56+
test {
57+
useJUnitPlatform()
58+
exclude("**/*IT.class")
59+
testLogging {
60+
events("passed", "skipped", "failed")
61+
exceptionFormat = TestExceptionFormat.FULL
62+
showStackTraces = true
63+
}
64+
}
65+
66+
val intTest = create<Test>("intTest") {
67+
dependsOn(test)
5768
doFirst {
5869
environment("DB_URL", System.getenv("DB_URL") ?: "localhost:1521/XE")
5970
environment("DB_USER", System.getenv("DB_USER") ?: "app")
6071
environment("DB_PASS", System.getenv("DB_PASS") ?: "app")
6172
}
6273
useJUnitPlatform()
74+
include("**/*IT.class")
6375
testLogging {
6476
events("passed", "skipped", "failed")
6577
exceptionFormat = TestExceptionFormat.FULL
6678
showStackTraces = true
6779
}
6880
}
6981

82+
named("check") {
83+
// add integration tests to the whole check
84+
dependsOn(intTest)
85+
}
86+
7087
val coverageResourcesDirectory = "${project.buildDir}/resources/main/CoverageHTMLReporter"
7188
val coverageResourcesZipDirectory = "${project.buildDir}/utPLSQL-coverage-html-$coverageResourcesVersion"
7289
val coverageResourcesZip = "$coverageResourcesZipDirectory.zip"

0 commit comments

Comments
 (0)