Note that there are some explanatory texts on larger screens.

plurals
  1. POmvn integration-test wont run my test
    primarykey
    data
    text
    <p>I'm making automated test with Selenium, TestNG and Maven. When I execute: mvn integration-test in cmd, maven wont run my test. I'm new in Maven, I read some examples but didnt find any resolution for my problem.</p> <p>Here is my pom.xml:</p> <pre><code>&lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.testng&lt;/groupId&gt; &lt;artifactId&gt;testng&lt;/artifactId&gt; &lt;classifier&gt;jdk15&lt;/classifier&gt; &lt;version&gt;5.11&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt; &lt;artifactId&gt;selenium-firefox-driver&lt;/artifactId&gt; &lt;version&gt;2.31.0&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;source&gt;1.5&lt;/source&gt; &lt;target&gt;1.5&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;selenium-maven-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;pre-integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;start-server&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;background&gt;true&lt;/background&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;stop-selenium&lt;/id&gt; &lt;phase&gt;post-integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;stop-server&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;include&gt;**/MainPage*.java &lt;/include&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;test&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;skip&gt;false&lt;/skip&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>And here is my MainPage class:</p> <pre><code>import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import static org.testng.Assert.*; public class MainPage { static WebDriver driver; @BeforeClass public void setUp() { driver = new FirefoxDriver(); } @Test public void OpenRegistrationPage(){ //GIVEN openPage(); //WHEN clickOnRegistration(); //THEN checkIfIsDirected(); } private void checkIfIsDirected() { String elementTitle = driver.findElement(By.xpath("//td[@id='center- col']/div/div/table/tbody/tr/td/div")).getText(); assertEquals(elementTitle, "Rejestracja"); } private void clickOnRegistration() { WebElement registrationLink = driver.findElement(By.cssSelector("span.icon-rejestracja")); registrationLink.click(); } private void openPage() { driver.get("https://www.x-kom.pl"); } @AfterClass public static void tearDown() { driver.close(); } } </code></pre> <p>Thanks in advance! :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload