Selenium with Maven plugin does not work the tests

Asked

Viewed 147 times

0

  • Implementation to run a Junit and testNG test suite,
  • When executed by the eclipse plugin, it works.
  • By Maven no, the behavior of testNG tests, are changed,
  • It seems that the http sessions do not end properly,
  • Creates an http session when (login logout)

The main pom lib, I tried to configure according to apache guidelines:

<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.0.0-beta2</version>
    <scope>test</scope>
    <exclusions>
    <exclusion>
        <artifactId>xml-apis</artifactId>
        <groupId>xml-apis</groupId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>4.2.4.RELEASE</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.9.10</version>
    <scope>test</scope>
</dependency>
<build>
    <finalName>${project.artifactId}</finalName>
    <pluginManagement>
        ....
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
        </plugin>
    </pluginManagement>
    </plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <properties>
                    <property>
                    <name>junit</name>
                    <value>false</value>
                    </property>
                </properties>
            <threadCount>1</threadCount>
            </configuration>
        <dependencies>
            <dependency>
                <groupId>org.apache.maven.surefire</groupId>
                <artifactId>surefire-junit47</artifactId>
                <version>2.19.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.surefire</groupId>
                <artifactId>surefire-testng</artifactId>
                <version>2.19.1</version>
            </dependency>
        </dependencies>
        </plugin>
    </plugins>
    ...

Below the test results run by the Eclipse plugin:

===============================================
Default suite
Total tests run: 11, Failures: 0, Skips: 0
===============================================
  • The problem with testing is that individual tests work,
  • Taking the testNG class(4) set hovering around the Eclipse plugin, it works,
  • Prowling the Junit test suite (44) works,
  • When you enter the two of you together with the mistake http sessions (created in NG test).

It looks like he’s trying to log in and before he even finishes logging out, he starts the other class by logging in, but he hasn’t even finished logging out.. ai from that point on error in all classes.

Summary of login logout:

@BeforeClass(alwaysRun = true)
public void setUp() throws Exception
{
    baseUrl = SysCodeTest.URL_PATH_TEST;
    this.login();

@AfterClass(alwaysRun = true)
public void tearDown() throws Exception
{
    this.logout();
}

Has anyone been through this, can you point out any configuration problems? below log error:

Failed tests: 
SysNGSeleniumDriverChromeTest.setUp:18 » Timeout timeout: cannot determine loa...
com.sys.mod.login.SysGroupControllerTest.(com.sys.mod.login.SysGroupControllerTest)
Run 1: SysGroupControllerTest.setUp:29->SysNGSeleniumDriverChrome.login:49 » NoSuchElement
Run 2: PASS

com.sys.mod.login.SysPaperControllerTest.(com.sys.mod.login.SysPaperControllerTest)
Run 1: PASS
Run 2: PASS
Run 3: SysPaperControllerTest>AbstractTestNGSpringContextTests.run:175->changePaper:101 » NoSuchElement
Run 4: SysPaperControllerTest>AbstractTestNGSpringContextTests.run:175->removePaper:130 » NoSuchElement
Run 5: SysPaperControllerTest>SysNGSeleniumDriverChrome.tearDown:86->SysNGSeleniumDriverChrome.logout:60 » NoSuchElement

com.sys.mod.login.SysUserControllerTest.(com.sys.mod.login.SysUserControllerTest)
Run 1: SysUserControllerTest.setUp:29->SysNGSeleniumDriverChrome.login:49 » NoSuchElement
Run 2: PASS
Run 3: SysUserControllerTest>SysNGSeleniumDriverChrome.tearDown:86->SysNGSeleniumDriverChrome.logout:60 » NoSuchElement
  • NoSuchElement happens when Selenium does not find the component based on the given id. Make sure that the component is with correct id?

  • Which probably occurs within the logout()...

  • Yes I do, because if I run, class by class, it works, but if I run all the tests, including Junit, then it gets lost

  • It does not find the id, because the screen that should be for the test, was changed by another agent seems.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.