all. I'm using Intellij IDEA with Selenium, TestNG and Gradle. After I had added a Gradle to the project my tests running in strange priority. So, I have a XML file for run with TestNG:
<suite name="Mobile. Firefox. 320x480">
<parameter name="browserType" value="firefox" />
<parameter name="resolution" value="320x480"/>
<listeners>
<listener class-name="Listeners.Listeners"/>
</listeners>
<test name="320x480">
<classes>
<class name="TestsPerPage.TopMenu.TopMenuTests"/>
<class name="TestsPerPage.TopMenu.EstimateProjectTests"/>
</classes>
</test>
Test classes looks like:
TopMenuTests.class:
public class TopMenuTests extends SetupDriver {
@BeforeClass
public void initClasses(){
System.out.println("Before Class TM");
}
@Test(groups = {"mobile"}, priority = 3)
public void mobilePortfolioOpen() {
System.out.println("Test TM, priority = 3");
}
@Test(groups = {"mobile"}, priority = 4)
public void mobileHomePageOpen() {
System.out.println("Test TM, priority = 4");
}
@Test(groups = {"mobile"}, priority = 5)
public void mobileCompanyPageOpen() {
System.out.println("Test TM, priority = 5");
}
EstimateProjectTests.class:
public class EstimateProjectTests extends SetupDriver {
@BeforeClass(groups = "mobile")
public void initMobileClasses() {
System.out.println("Before Class EP");
}
@Test
public void estimatePageOpen(){
System.out.println("Test EP, priority = 0");
}
@Test(priority = 1)
public void mandatoryFieldsCheck(){
System.out.println("Test EP, priority = 1");
}
@Test(priority = 1)
public void labelsCheck(){
System.out.println("Test EP, priority = 1");
}
So, at the end, after running an XML file it should: Run TopMenuTests.class -> run BeforeClass -> All tests by priority Run EstimateProjectTests.clall -> run BeforeClass -> All tests by priority Output shold be:
Before Class Tm
Test TM, priority = 3
Test TM, priority = 4
Test TM, priority = 5
Before Class EP
Test EP, priority = 0
Test EP, priority = 1
Test EP, priority = 1
But after I'd connected Gradle to the project I have this output:
Before Class Tm
Before Class EP
Test EP, priority = 0
Test EP, priority = 1
Test EP, priority = 1
Test TM, priority = 3
Test TM, priority = 4
Test TM, priority = 5
So, firstly had run all @BeforeClass and then all tests by, some kind of, "global" priority.
Have anyone faces the same issue?
My Gradle code:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.qameta.allure:allure-gradle:2.3"
}
}
plugins {
id "io.qameta.allure" version "2.5"
}
group 'com.indeema.web-site-automation'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: "io.qameta.allure"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
allure {
version = "2.2.1"
autoconfigure = true
aspectjweaver = true
allureJavaVersion = "2.0-BETA18"
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.8.8'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.8.1'
}
test {
useTestNG()
}
P.S. Sorry for such big amount of the text, don't know how to explain it in a shorter way.
Aucun commentaire:
Enregistrer un commentaire