Что работает:
Запуск банки из основной папки проекта работает отлично: < /p>
Код: Выделить всё
java -jar build/libs/test-1.0.0-SNAPSHOT-test-runner.jar
< /code>
Это вывод журнала, прежде чем запустить тесты. Docker начинается, GradleAppmodel работает, и тесты работают идеально. < /P>
Running Cucumber tests with HTTP server disabled...
Using profile: stg
Features location: classpath:features
💚 Thanks for using JUnit! Support its development at https://junit.org/sponsoring
Jun 27, 2025 7:28:50 PM io.quarkus.bootstrap.utils.BuildToolHelper enableGradleAppModel
INFO: Loading Quarkus Gradle application model for /MRepos/build-verification-test
2025-06-27 19:30:26 INFO [or.te.DockerClientFactory] (build-84) Testcontainers version: 1.20.2
2025-06-27 19:30:27 INFO [or.te.do.DockerClientProviderStrategy] (build-84) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2025-06-27 19:30:28 INFO [or.te.do.DockerClientProviderStrategy] (build-84) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
2025-06-27 19:30:28 INFO [or.te.DockerClientFactory] (build-84) Docker host IP address is localhost
2025-06-27 19:30:28 INFO [or.te.DockerClientFactory] (build-84) Connected to docker:
Server Version: 27.5.1
API Version: 1.47
Operating System: Docker Desktop
Total Memory: 7836 MB
Labels:
2025-06-27 19:30:28 INFO [or.te.im.PullPolicy] (build-84) Image pull policy will be performed by: DefaultPullPolicy()
2025-06-27 19:30:28 INFO [or.te.ut.ImageNameSubstitutor] (build-84) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2025-06-27 19:30:29 INFO [tc.lo.7.2] (build-84) LOCALSTACK_HOST environment variable set to localstack-d4udd (to match last network alias on container with non-default network)
2025-06-27 19:30:29 INFO [tc.lo.7.2] (build-84) Creating container for image: localstack/localstack:3.7.2
2025-06-27 19:30:30 INFO [or.te.ut.RegistryAuthLocator] (build-84) Credential helper/store (docker-credential-desktop) does not have credentials for https://index.docker.io/v1/
2025-06-27 19:30:30 INFO [tc.te.9.0] (build-84) Creating container for image: testcontainers/ryuk:0.9.0
Jun 27, 2025 7:30:30 PM io.quarkus.deployment.steps.ClassTransformingBuildStep handleClassTransformation
WARN: Cannot transform java.lang.String as its containing application archive could not be found.
2025-06-27 19:30:34 INFO [tc.te.9.0] (build-84) Container testcontainers/ryuk:0.9.0 is starting: 03aa4b2d2895d81d2966c00de87bbb2bd4cc2045dd2ee74bfb3753d142a7bd3c
2025-06-27 19:30:35 INFO [tc.te.9.0] (build-84) Container testcontainers/ryuk:0.9.0 started in PT5.309733S
2025-06-27 19:30:36 INFO [tc.lo.7.2] (build-84) Container localstack/localstack:3.7.2 is starting: 29eb386e7b7880028f3412e39c45ebb9388829d7242359248c2f89cba471236e
2025-06-27 19:30:40 INFO [tc.lo.7.2] (build-84) Container localstack/localstack:3.7.2 started in PT11.100043S
Jun 27, 2025 7:30:40 PM io.quarkus.amazon.common.deployment.DevServicesLocalStackProcessor lambda$startLocalStack$28
INFO: Amazon Dev Services for localstack (dynamodb) started. Other Quarkus applications in dev mode will find the LocalStack automatically.
Jun 27, 2025 7:30:41 PM io.quarkus.runtime.configuration.ConfigDiagnostic unknown
INFO: Profile stg activated.
Jun 27, 2025 7:30:42 PM io.quarkus.bootstrap.runner.Timing printStartupTime
INFO: Installed features: [amazon-dynamodb, amazon-dynamodb-enhanced, cdi, config-yaml, cucumber, rest, rest-client, rest-client-jackson, smallrye-context-propagation, vertx]
< /code>
Что не удается:
Запуск одной и той же JAR из любого другого каталога сбой: например, если я перейду в папку загрузки или перемещаю свой терминал в другую папку, отличную от основного корня моего проекта, и я запускаю точно ту же команду, что у меня есть ошибка. Это ошибки журнала: < /p>
Running Cucumber tests with HTTP server disabled...
Using profile: stg
Features location: classpath:features
Jun 27, 2025 7:32:38 PM org.jboss.logmanager.JBossLoggerFinder getLogger
ERROR: The LogManager accessed before the "java.util.logging.manager" system property was set to "org.jboss.logmanager.LogManager". Results may be unexpected.
💚 Thanks for using JUnit! Support its development at https://junit.org/sponsoring
BasicLoggingEnabler failed to enable basic logging: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Jun 27, 2025 7:32:39 PM io.quarkus.bootstrap.utils.BuildToolHelper findBuildTool
WARN: Unable to find a build tool in /Users/user/Downloads or in any parent.
Jun 27, 2025 7:32:39 PM io.quarkus.bootstrap.BootstrapAppModelFactory resolveAppModel
WARN: Unable to locate the maven project on the filesystem
╷
└─ JUnit Jupiter ✔
└─ Test ✔
└─ getTests() ✘ java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Failures (1):
JUnit Jupiter:Test:getTests()
MethodSource [className = 'com.Test', methodName = 'getTests', methodParameterTypes = '']
=> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
io.quarkus.test.junit.IntegrationTestUtil.activateLogging(IntegrationTestUtil.java:347)
Caused by: java.lang.reflect.InvocationTargetException
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: SRCFG00013: No Converter registered for class java.nio.charset.Charset
io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:57)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: SRCFG00013: No Converter registered for class java.nio.charset.Charset
io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:139)
Caused by: java.lang.IllegalArgumentException: SRCFG00013: No Converter registered for class java.nio.charset.Charset
io.smallrye.config.SmallRyeConfig.requireConverter(SmallRyeConfig.java:717)
io.quarkus.runtime.configuration.ConfigInstantiator.getConverterFor(ConfigInstantiator.java:203)
io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:124)
< /code>
Вот как выглядят мои классы:
[b] class < /strong>, чтобы создать изолированную JAR и запустить мои тесты без запуска сервера Quarkus: < /p>
public class CucumberTestRunner {
public static void main(String[] args) {
// Set system properties to disable HTTP server
System.setProperty("quarkus.http.port", "-1");
System.setProperty("quarkus.http.ssl-port", "-1");
System.setProperty("quarkus.http.test-port", "-1");
System.setProperty("quarkus.http.host", "localhost");
// Set the profile to staging
System.setProperty("quarkus.profile", "stg");
// Set the correct features location for JAR execution
System.setProperty("cucumber.features", "classpath:features");
// Run the existing Test main method which already has all the right setup
Test.main(args);
}
}
Код: Выделить всё
task testShadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier = 'test-runner'
from sourceSets.main.output
from sourceSets.main.resources
// Include all runtime dependencies
configurations = [project.configurations.runtimeClasspath]
manifest {
attributes 'Main-Class': 'com.CucumberTestRunner'
}
}
package com.test;
import com.profile.CustomTestProfile;
import io.quarkiverse.cucumber.CucumberQuarkusTest;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
@QuarkusTest
@TestProfile(CustomTestProfile.class)
public class MainTest extends CucumberQuarkusTest {
public static void main(String[] args) {
String featuresLocation = System.getProperty("cucumber.features", "features");
System.setProperty("cucumber.features", featuresLocation);
System.setProperty("cucumber.glue", "com.test");
runMain(MainTest.class, args);
}
}
< /code>
Что я пробовал: < /p>
Различные свойства системы для отключения Discovery Project < /li>
Создание минимальной структуры проекта в контейнере < /li>
упорно) Есть ли способ упаковать все необходимые метаданные проекта в банку, или я должен использовать другой подход для переносного выполнения теста?
Подробнее здесь: https://stackoverflow.com/questions/796 ... -directory