Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy my junit tests are skipped after deploying (git push) into openshift repository?
    text
    copied!<p>I have been developing a simple Java web application to deploy into OpenShift. Although my JUnit tests run localy on Eclipse but they are skipped after pushing into git repository. I added Jenkins but still the same. I don't know what a marker or config file should I have?</p> <p>This is my pom.xml content:</p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;kia&lt;/groupId&gt; &lt;artifactId&gt;kia&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;name&gt;kia&lt;/name&gt; &lt;repositories&gt; &lt;repository&gt; &lt;id&gt;eap&lt;/id&gt; &lt;url&gt;http://maven.repository.redhat.com/techpreview/all&lt;/url&gt; &lt;releases&gt; &lt;enabled&gt;true&lt;/enabled&gt; &lt;/releases&gt; &lt;snapshots&gt; &lt;enabled&gt;true&lt;/enabled&gt; &lt;/snapshots&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;pluginRepositories&gt; &lt;pluginRepository&gt; &lt;id&gt;eap&lt;/id&gt; &lt;url&gt;http://maven.repository.redhat.com/techpreview/all&lt;/url&gt; &lt;releases&gt; &lt;enabled&gt;true&lt;/enabled&gt; &lt;/releases&gt; &lt;snapshots&gt; &lt;enabled&gt;true&lt;/enabled&gt; &lt;/snapshots&gt; &lt;/pluginRepository&gt; &lt;/pluginRepositories&gt; &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;maven.compiler.source&gt;1.6&lt;/maven.compiler.source&gt; &lt;maven.compiler.target&gt;1.6&lt;/maven.compiler.target&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.8.2&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;mysql&lt;/groupId&gt; &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt; &lt;version&gt;5.1.25&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;servlet-api&lt;/artifactId&gt; &lt;version&gt;2.5&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;openshift&lt;/id&gt; &lt;build&gt; &lt;finalName&gt;kia&lt;/finalName&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt; &lt;version&gt;2.1.1&lt;/version&gt; &lt;configuration&gt; &lt;outputDirectory&gt;webapps&lt;/outputDirectory&gt; &lt;warName&gt;ROOT&lt;/warName&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;2.4.3&lt;/version&gt; &lt;configuration&gt; &lt;skip&gt;false&lt;/skip&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/profile&gt; &lt;/profiles&gt; &lt;/project&gt; </code></pre> <p>and this is my test class:</p> <pre><code>package info.zamanifar.mysite.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.junit.Test; import static org.junit.Assert.*; public class JDBCConnectionTest { @Test public void getConnectionTest() { try { String dbHost = System.getenv("OPENSHIFT_MYSQL_DB_HOST"); String user = System.getenv("OPENSHIFT_MYSQL_DB_USERNAME"); String password = System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD"); StringBuilder dbURL = new StringBuilder("jdbc:mysql://"); dbURL.append(dbHost).append("/").append("kia"); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(dbURL.toString(),user,password); assertNotNull("Failed to create JDBC connection!", con); con.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } } </code></pre> <p>and console output from Jenkins:</p> <pre><code>[INFO] [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ kia --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ kia --- [INFO] Packaging webapp </code></pre>
 

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