Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,19 @@ These include commented code, highlighting key features and concepts, and exampl
## Feedback
We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill out [our feedback form](https://forms.gle/A4EERrR6CWgKWe5r9) to share your thoughts, suggestions or ideas.

## Integration testing

External integration tests are opt-in and use Maven Failsafe profiles. Run the automated suite
with:

```bash
mvn verify -Pintegration-tests -Dgpg.skip=true
```

See the [integration-test guide](src/integration-test/README.md) for local configuration,
class-and-method selection, manual terminal tests, TEST/LIVE safety, conventions, and
troubleshooting.

## Contributing
We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.

Expand Down
87 changes: 85 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<maven-checkstyle-plugin-version>3.6.0</maven-checkstyle-plugin-version>
<maven-bundle-plugin-version>5.1.9</maven-bundle-plugin-version>
<spotless-maven-plugin-version>3.8.0</spotless-maven-plugin-version>
<maven-surefire-plugin-version>3.5.6</maven-surefire-plugin-version>
<maven-test-plugins-version>3.5.6</maven-test-plugins-version>
<build-helper-maven-plugin-version>3.6.1</build-helper-maven-plugin-version>
<google-java-format-version>1.34.1</google-java-format-version>
<maven-enforcer-version>3.6.3</maven-enforcer-version>
</properties>
Expand All @@ -72,6 +73,48 @@
<url>git@github.com:Adyen/adyen-java-api-library.git</url>
</scm>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin-version}</version>
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
<goal>add-test-resource</goal>
</goals>
<configuration>
<sources>
<source>src/integration-test/java</source>
</sources>
<resources>
<resource>
<directory>src/integration-test/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-test-plugins-version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -222,6 +265,7 @@
<includes>
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
<include>src/integration-test/java/**/*.java</include>
</includes>
<googleJavaFormat>
<version>${google-java-format-version}</version>
Expand All @@ -238,7 +282,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
<version>${maven-test-plugins-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -290,6 +334,45 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>external</groups>
<excludedGroups>manual</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>manual-integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>manual</groups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- Compile -->
<dependency>
Expand Down
59 changes: 59 additions & 0 deletions src/integration-test/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<integration_test_guidelines>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The XML-like tags <integration_test_guidelines> at the beginning of the file and </integration_test_guidelines> at the end of the file appear to be system prompt artifacts that were accidentally committed. They should be removed to keep the markdown clean and professional.

## Scope

These instructions apply to files under `src/integration-test`.

## Before Writing a Test

- Read `src/integration-test/README.md`.
- Verify the public service method and model types in `src/main/java`.
- Do not edit generated production models or services to make an integration test pass.
- Determine whether the test is automated external coverage or requires manual infrastructure.

## Structure

- Mirror the production package under `src/integration-test/java`.
- Name integration-test classes `*IT` so Maven Failsafe discovers them.
- Extend `BaseIntegrationTest` and use its typed configuration accessors.
- Annotate external tests with `@Tag(IntegrationTestTags.EXTERNAL)`.
- Also annotate tests requiring a person, terminal, or other dedicated infrastructure with
`@Tag(IntegrationTestTags.MANUAL)`.
- Use behavior-focused names such as `shouldReturnValidationErrorWhenReferenceIsMissing`.
- Keep one observable behavior per test and use Arrange, Act, Assert sections.
- Prefer explicit imports, response types, and checked exceptions. Do not use wildcard imports,
`var`, or `throws Exception`.

## Reliability and Safety

- Generate unique references and idempotency keys for requests that create remote state.
- Do not share mutable state or depend on test execution order.
- Clean up remotely created resources when the API supports cleanup.
- For eventually consistent APIs, use bounded polling rather than fixed sleeps.
- Add a suitable timeout when an operation can otherwise wait indefinitely.
- Tests containing Adyen test cards or other TEST-only data must call `requireTestEnvironment()` in
`@BeforeEach`.
- Do not use `@Disabled` as the normal opt-in mechanism. Use the Maven profiles and JUnit tags.
- Do not run an external integration test unless the user explicitly asks for that API call.

## Assertions and Comments

- Assert stable contract fields, identifiers, statuses, and documented error codes.
- Assert exact error messages only when the wording is part of the documented contract.
- Include assertion messages that explain the violated contract.
- Extract repeated request construction and response assertions into focused helpers.
- Keep comments limited to prerequisites, non-obvious API constraints, and Arrange, Act, Assert
markers. Do not narrate straightforward Java.

## Validation

Validate generated tests without contacting Adyen:

```bash
mvn spotless:apply
mvn -Pintegration-tests -DskipTests test-compile
mvn spotless:check checkstyle:check -DskipTests
```

Use the opt-in execution commands from `src/integration-test/README.md` only when external execution
is explicitly requested.
</integration_test_guidelines>
Loading