File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,33 @@ Use the following steps to install GDS as a standalone project and run the tests
8
8
password
9
9
2 . Run ` ./gradlew -i mlDeploy loadTestData test `
10
10
11
+ ## Inspecting logging of HTTP requests and responses
12
+
13
+ If you wish to see the HTTP request/response that each test sends/receives, set the following value in your
14
+ ` gradle-local.properties ` file:
15
+
16
+ logRequestAndResponse=true
17
+
18
+ Or include it on the command line when running tests:
19
+
20
+ ./gradlew -i test -PlogRequestAndResponse=true
21
+
22
+ This is often helpful when running a single test so that you can see what the input and output is for a particular
23
+ scenario. To run a single test, such as ` PointQueries ` , run the following (this adds the property to the command
24
+ line, but you can also just add it to your ` gradle-local.properties ` file so you don't need to remember to add it
25
+ each time):
26
+
27
+ ./gradlew -i test --tests PointQueries -PlogRequestAndResponse=true
28
+
29
+ To run an individual test method, add a period and the method name to the test class name:
30
+
31
+ ./gradlew -i test --tests PointQueries.testPointIntersects1 -PlogRequestAndResponse=true
32
+
33
+ To force tests to be run, include ` cleanTest ` , which will prevent Gradle from not running a test due to it not
34
+ having changed:
35
+
36
+ ./gradlew -i cleanTest test --tests PointQueries.testPointIntersects1 -PlogRequestAndResponse=true
37
+
11
38
# Manual testing
12
39
13
40
You can perform manual testing by following the instructions in the ` examples/sample-project/README.md ` file for
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ dependencies {
36
36
}
37
37
38
38
test {
39
- systemProperty " sonar.projectVersion" , project. version
39
+ systemProperty " sonar.projectVersion" , project. version
40
+ systemProperty " logRequestAndResponse" , logRequestAndResponse
40
41
}
41
42
42
43
task loadTestData (dependsOn : [
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ mlContentDatabaseName=geo-data-services-test-content
27
27
mlSchemasDatabaseName =geo-data-services-test-schemas
28
28
mlContentForestsPerHost =1
29
29
30
+ # Set to true for each test to log the HTTP request it sends and the HTTP response it receives.
31
+ logRequestAndResponse =false
32
+
30
33
# Sonar settings
31
34
systemProp.sonar.login =set this in gradle-local.properties
32
35
systemProp.sonar.host.url =set this in gradle-local.properties
Original file line number Diff line number Diff line change 1
1
import com .marklogic .gds .GeoQueryRequest ;
2
2
import io .restassured .RestAssured ;
3
3
import io .restassured .filter .log .LogDetail ;
4
+ import io .restassured .filter .log .RequestLoggingFilter ;
5
+ import io .restassured .filter .log .ResponseLoggingFilter ;
4
6
import io .restassured .http .ContentType ;
5
7
import io .restassured .path .json .JsonPath ;
6
8
import io .restassured .path .json .config .JsonPathConfig ;
@@ -20,6 +22,10 @@ public void setup() {
20
22
RestAssured .port = 8096 ;
21
23
RestAssured .authentication = basic ("test-geo-data-services-writer" , "test-geo-data-services-writer" );
22
24
25
+ if ("true" .equals (System .getProperty ("logRequestAndResponse" ))) {
26
+ RestAssured .filters (new RequestLoggingFilter (), new ResponseLoggingFilter ());
27
+ }
28
+
23
29
RestAssured .enableLoggingOfRequestAndResponseIfValidationFails (LogDetail .ALL );
24
30
}
25
31
You can’t perform that action at this time.
0 commit comments