Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use a custom application.properties per test scenario #281

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

Sgitario
Copy link
Contributor

@Sgitario Sgitario commented Sep 28, 2021

By default, the test framework will use the application.properties file at src/main/resources folder. The service interface provides multiple methods to add properties in the scenario:

  • service.withProperties(path)
  • service.withProperty(key, value)

If you want to use a different application properties file for all the tests, you can add the application.properties file at src/test/resources and the test framework will use this instead.

Moreover, if you want to select a concrete application properties file for a single test scenario, then you can configure your Quarkus application using:

@QuarkusScenario
public class PingPongResourceIT {

    @QuarkusApplication(properties = "my-custom-properties.properties")
    static final RestService pingpong = new RestService();
}

This option is available also for Dev Mode, Remote Dev mode and remote git applications, and works for JVM, Native, OpenShift and Kubernetes.

| Note that the test framework does not support the usage of YAML files yet #240

@Sgitario Sgitario requested a review from pjgg September 28, 2021 05:24
@Sgitario
Copy link
Contributor Author

run tests

Copy link
Contributor

@pjgg pjgg left a comment

Choose a reason for hiding this comment

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

Over all looks good to me , just some cosmetic changes

By default, the test framework will use the `application.properties` file at `src/main/resources` folder. The service interface provides multiple methods to add properties at test scope only:
- `service.withProperties(path)`
- `service.withProperty(key, value)`

If you want to use a different application properties file for all the tests, you can add the `application.properties` file at `src/test/resources` and the test framework will use this instead.

Moreover, if you want to select a concrete application properties file for a single test scenario, then you can configure your Quarkus application using:

```java
@QuarkusScenario
public class PingPongResourceIT {

    @QuarkusApplication(properties = "my-custom-properties.properties")
    static final RestService pingpong = new RestService();
}
```

This option is available also for Dev Mode, Remote Dev mode and remote git applications, and works for JVM, Native, OpenShift and Kubernetes. 

| Note that the test framework does not support the usage of YAML files yet [quarkus-qe#240](quarkus-qe#240)
@Sgitario Sgitario force-pushed the overwrite_application_properties branch from ee20f43 to cea57d9 Compare September 28, 2021 07:56
@Sgitario Sgitario requested a review from pjgg September 28, 2021 07:56
@pjgg pjgg merged commit 4c5b31a into quarkus-qe:main Sep 28, 2021
@Sgitario Sgitario deleted the overwrite_application_properties branch September 28, 2021 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants