I understand that it is not possible to get data from the resources. Permission in services for interacting with the desktop in services is given.
simple tests pass:
enter image description here
enter image description here
enter image description here
enter image description here
In Jenkins I crawl the parameterized assembly line:
-Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment} clean test
error code
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
... Removed 32 stack frames
class for reading keys
public class TestDataReader {
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle(System.getProperty("environment"));
public static String getTestData(String key) {
return resourceBundle.getString(key);
}
}
service class
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));
}
}
test
public class GoogleCloudTest extends 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>
CodePudding user response:
From the screenshots above, you need to correct the following:
'Trigger/call builds on other projects' section
- File Name in Child Projects section you have
mvn test -P -Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment} clean test
- remove this, as this section is to declare files within sub-projects of your main project "frameworklasttask", not the maven command
Now on the next section, where you have declared the maven version '3.8.1'
- Update
clean test
toclean test -Dbrowser=${browser} -Dsurefire.suiteXmlFiles=${surefire.suiteXmlFiles} -Denvironment=${environment}.properties
For the moment, I have discarded the -P part of the maven command as a tag is missing from the configuration you have provided so far.
CodePudding user response:
I only found a solution like this. Nothing else in this project build configuration works !!! Proven by 4 days of searching!