我了解無法從資源中獲取資料。授予與服務中的桌面互動的服務許可。
簡單測驗通過:
在此處輸入圖片說明
在此處輸入圖片說明
在此處輸入圖片說明
在此處輸入圖片說明
在此處輸入圖片說明
在此處輸入圖片說明
在此處輸入圖片說明
在詹金斯我爬引數化流水線:
-Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment} clean test
錯誤代碼
java.lang.ExceptionInInitializerError
at service.InstanceCreator.getDataEstimateForm(InstanceCreator.java:24)
at test.GoogleCloudTest.checkEmailEstimateCost(GoogleCloudTest.java:17)
at java.util.ArrayList.forEach(ArrayList.java:1259)
Caused by: java.lang.NullPointerException
at java.util.ResourceBundle$CacheKey.calculateHashCode(ResourceBundle.java:654)
at java.util.ResourceBundle$CacheKey.<init>(ResourceBundle.java:584)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1333)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:782)
at service.TestDataReader.<clinit>(TestDataReader.java:6)
... 35 more
... 洗掉了 32 個堆疊幀
讀取鍵的類
public class TestDataReader {
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle(System.getProperty("environment"));
public static String getTestData(String key) {
return resourceBundle.getString(key);
}
}
服務等級
public class InstanceCreator {
private static final String NUMBER_OF_INSTANCES = "testdata.instanceCreator.number";
private static final String OPERATION_SYSTEM = "testdata.instanceCreator.os";
private static final String MACHINE_CLASS = "testdata.instanceCreator.machine-class";
private static final String SERIES_ID = "testdata.instanceCreator.series-id";
private static final String MACHINE_TYPE = "testdata.instanceCreator.machine-type";
private static final String NUMBER_OF_GPUS = "testdata.instanceCreator.number-of-gpus";
private static final String TYPE_GPU = "testdata.instanceCreator.type-gpu";
private static final String LOCAL_SSD = "testdata.instanceCreator.local-ssd";
private static final String DATA_CENTER_LOCATION = "testdata.instanceCreator.datacenter";
private static final String COMMITTED_USAGE = "testdata.instanceCreator.committed-sage";
public static InstanceForm getDataEstimateForm() {
return new InstanceForm(
TestDataReader.getTestData(NUMBER_OF_INSTANCES),
TestDataReader.getTestData(OPERATION_SYSTEM),
TestDataReader.getTestData(MACHINE_CLASS),
TestDataReader.getTestData(SERIES_ID),
TestDataReader.getTestData(MACHINE_TYPE),
TestDataReader.getTestData(NUMBER_OF_GPUS),
TestDataReader.getTestData(TYPE_GPU),
TestDataReader.getTestData(LOCAL_SSD),
TestDataReader.getTestData(DATA_CENTER_LOCATION),
TestDataReader.getTestData(COMMITTED_USAGE));
}
}
測驗
公共類 GoogleCloudTest 擴展了 CommonConditions {
@Test(description = "get a letter with the results of processing the request")
public void checkEmailEstimateCost() {
new InstanceCreator();
InstanceForm instanceForm = InstanceCreator.getDataEstimateForm();
String verificationCalculationResultsReceivedEmail = new GoogleCloudHomePage(driver)
.openPage()
.fillSearchInput()
.openCalculator()
.activationComputeEngine()
.fillComputeEngineForm(instanceForm)
.pressAddToEstimate()
.saveResultEstimate()
.pressButtonEmailEstimate()
.openNewTab()
.openPage()
.copyEmailAddress()
.comeBackToCalculator()
.enterEmail()
.pressButtonSendEmail()
.returnToPageEmail()
.pressCheckMailButton()
.thisComparisonResultsReceivedEmailWithDataSite();
Assert.assertEquals(verificationCalculationResultsReceivedEmail, ProcessData.getCurrentPriceInCalculator()
, "the data received by mail does not coincide with the data received in the calculator");
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>org.example</groupId>
<artifactId>frameworklasttask</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M5</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
uj5u.com熱心網友回復:
從上面的螢屏截圖中,您需要更正以下內容:
'在其他專案上觸發/呼叫構建'部分
- 您擁有的子專案部分中的檔案名
mvn test -P -Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment} clean test- 洗掉它,因為此部分是在主專案“frameworklasttask”的子專案中宣告檔案,而不是 maven 命令
現在在下一節中,您已在其中宣告了 Maven 版本“3.8.1”
- 更新
clean test到clean test -Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment}.properties
目前,我已經放棄了 maven 命令的 -P 部分,因為到目前為止您提供的配置中缺少一個標記。
uj5u.com熱心網友回復:
我只找到了這樣的解決方案。此專案構建配置中的其他任何內容都不起作用!!!經過 4 天的搜索證明!
在此處輸入圖片說明
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/355611.html
