Trying to use groovy.text.XmlTemplateEngine in the Groovy based unit tests of my Maven based project with gmaven plugin configured as following
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-3</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
</dependency>
</dependencies>
</plugin>
My command line build mvn clean install fails not being able to compile my simple Groovy unit test file with an error message
[ERROR]
file:/Users/../my-service/src/test/groovy/myapp/MyApplicationTest.groovy:
84: unable to resolve class groovy.text.XmlTemplateEngine [ERROR] #
line 84, column 30. [ERROR] XmlTemplateEngine engine = new
groovy.text.XmlTemplateEngine() [ERROR] ^
And in the file I'm only doing a simple command
import groovy.text.XmlTemplateEngine
...
XmlTemplateEngine engine = new groovy.text.XmlTemplateEngine()
Both lines fail with the same error message.
The version of Groovy installed in my OSX command line is 2.4.12.
I have analyzed the output of the
mvn -e -X test
command and didn't find the groovy-all.jar on the classpath during the test compilation phase. Only groovy.jar was present and it doesn't contain groovy.text.XmlTemplateEngine class.
So, I added an additional test dependency:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
<scope>test</scope>
</dependency>
And it compiles my tests well now.
Related
I want to get an example of liquibase, Spring and MongoDB all together. In order to do so, I created a Spring project using Spring Initializr with Spring Data MongoDB as dependency. The project already connects to the database and now I would like to use liquibase. I followed the instructions from liquibase using the maven approach but if I run the maven command mvn liquibase:status I will get the following error:
Unexpected error running Liquibase: Cannot find database driver: com.mongodb.client.MongoClients.<init>()
It looks like this problem has been already reported to liquibase but if there is a solution it hasn't been posted in the issue.
I tried as well to use the CLI option by adding the jars to the lib folder of the liquibase installation. I got the same error if I run liquibase status
I have created a repo in GitHub to show the problem. Here there is some relevant configuration of the code:
pom.xml
<project>
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<properties>
<liquibase-mongo-ext.version>4.14.0</liquibase-mongo-ext.version>
<liquibase-maven-plugin.version>4.2.0</liquibase-maven-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-mongodb</artifactId>
<version>${liquibase-mongo-ext.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase-maven-plugin.version}</version>
<configuration>
<propertyFile>liquibase.properties</propertyFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-mongodb</artifactId>
<version>${liquibase-mongo-ext.version}</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.6.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
liquibase.properties
changeLogFile=./mongo/changelog/changelog.sql
url=jdbc:mongodb://127.0.0.1:27017/local
driver=com.mongodb.client.MongoClients
How can I get liquibase running with maven? Any suggestions?
EDIT 1:
As Andrey suggested:
Driver was updated to: driver=liquibase.ext.mongodb.database.MongoClientDriver
Url was updated to:
url=mongodb://127.0.0.1:27017/local
plugin from liquibase was updated with new dependency
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.9.1</version>
</dependency>
mvn liquibase:update now trhows the following error. Since the other error seems to be unrelated to this one. I'll solve this answer and create a new thread.
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.0:update (default-cli) on project mongo: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:4.2.0:update failed: A required class was missing while executing org.liquibase:liquibase-maven-plugin:4.2.0:update: liquibase/configuration/HubConfiguration
EDIT 2:
As mentioned in the answer, there was a mismatch between the version from Spring and the version of the plugin, which failed to find the class because HubConfiguration class is now under liquibase.hub.HubConfiguration This set up could have led to a CastException as well. So I updated the version liquibase-maven-plugin to 4.9.1
Also the use of the local database is not compatible with validators. The URI was updated to url=mongodb://127.0.0.1:27017/test in the liquibase.properties file.
Now it works like a charm! :D
I have found following mistakes in your configuration:
1.
changeLogFile=./mongo/changelog/changelog.sql
url=jdbc:mongodb://127.0.0.1:27017/local
driver=com.mongodb.client.MongoClients
while liquibase-mongodb expects something like (no jdbc prefix, another driver class):
changeLogFile=./mongo/changelog/changelog.sql
url=mongodb://127.0.0.1:27017/local
driver=liquibase.ext.mongodb.database.MongoClientDriver
liquibase version:
<liquibase-maven-plugin.version>4.2.0</liquibase-maven-plugin.version>
4.2.0 liquibase version seems to be incompatible with NoSQL DB extensions
spring boot 2.7.3 uses liquibase 4.9.1 - you need somehow choose the correct liquibase version
Finally I get the following on liquibase:update:
[ERROR] Failed to execute goal
org.liquibase:liquibase-maven-plugin:4.14.0:update (default-cli) on
project mongo: [ERROR] Error setting up or running Liquibase: [ERROR]
liquibase.exception.DatabaseException: Could not execute: Command
failed with error 72 (InvalidOptions): 'Document validators are not
allowed on collection local.DATABASECHANGELOGLOCK with UUID
31bd40b8-3e1c-45c8-9d03-77b91c67a1a9 in the local internal database'
on server 127.0.0.1:27017. The full response is {"ok": 0.0, "errmsg":
"Document validators are not allowed on collection
local.DATABASECHANGELOGLOCK with UUID
31bd40b8-3e1c-45c8-9d03-77b91c67a1a9 in the local internal database",
"code": 72, "codeName": "InvalidOptions"}
no idea what does it mean - something related to mongodb and extension I believe
UPD.
The root cause of last error is described in documentation:
Restrictions
You cannot specify a validator for collections in the admin, local, and config databases.
You cannot specify a validator for system.* collections.
So, url (jdbc:mongodb://127.0.0.1:27017/local) should point to another db.
Compilation of project was successful but in a runtime this error appeared:
java.lang.NoClassDefFoundError: com/microsoft/graph/httpcore/ICoreAuthenticationProvider
Implementation of ClientCredentialProvider
Class ClientCredentialProvider needed ICoreAuthenticationProvider interface which is in artifact microsoft-graph-core.
Just add this dependency to maven:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>2.0.0</version>
</dependency>
This is my first selenium script using TestNG and Maven.
Created a simple "Hello World" code and a selenium test code which just checks the title of google page.
Selenium Code Below with TestNG:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class HelloTest {
#Test
public void testOne() {
//WebDriver d=new FirefoxDriver();
System.setProperty("webdriver.gecko.driver","D:\\Firefox Driver\\geckodriver-v0.17.0-win64\\geckodriver.exe");
WebDriver d=new FirefoxDriver();
d.get("https://www.google.com");
System.out.println("This is first TestNG");
}
}
This is working absolutely fine when run through eclipse - Run As - Test NG test.
But when ran through Maven - mvn clean install from cmd prompt, i am getting below error
T E S T S
-------------------------------------------------------
Running HelloTest
Configuring TestNG with: TestNG652Configurator
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.94 sec <<< FAILURE! - in HelloTest
testOne(HelloTest) Time elapsed: 0.032 sec <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at HelloTest.testOne(HelloTest.java:11)
It is showing error at WebDriver d=new FirefoxDriver();. Not sure where the issue is. Added all jar files , checked the build path and all the jar were there. Below is my POM file.
<?xml version="1.0"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.micky</groupId>
<artifactId>MavenDemoTwo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
<type>jar</type>
<version>15.0</version>
</dependency>
</dependencies>
</project>
Any help is deeply appreciated.
What is NoClassDefFoundError
NoClassDefFoundError in Java occurs when JVM is not able to find a particular class at runtime which was available at compile time. For example, if we have resolved a method call from a Class or accessing any static member of a Class and that Class is not available during runtime then JVM will throw NoClassDefFoundError.
The error you are seeing is :
java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver
This clearly indicates that Selenium is trying to resolve the particular FirefoxDriver Class at runtime from org/openqa/selenium/firefox/FirefoxDriver which is not available.
What went wrong :
This situation occurs if there are presence of multiple sources to resolve the Classes and Methods through JDK/Maven/Gradle.
From the pom.xml it is pretty clear that you have added multiple dependencies for FirefoxDriver Class as follows:
<artifactId>selenium-java</artifactId>:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
<artifactId>selenium-firefox-driver</artifactId>:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.12.0</version>
</dependency>
<artifactId>selenium-server</artifactId>:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.12.0</version>
</dependency>
Additionally you have also added all jar files.
From all the above mentioned points it's clear that the related Class or Methods were resolved from one source at Compile Time which was not available during Run Time.
Solution :
Here are a few steps to solve NoClassDefFoundError :
While using a Build Tool e.g. Maven or Gradle, remove all the External JARs from the Java Build Path. Maven or Gradle will download all the dependencies mentioned in the configuration file (e.g. pom.xml) to resolve the Classes and Methods.
If using Selenium JARs within a Java Project add only required External JARs within the Java Build Path and remove the unused and duplicate External JARs.
If you are using FirefoxDriver use either of the <artifactId>selenium-java</artifactId> or <artifactId>selenium-server</artifactId>. Avoid using both at the same time.
Remove the unwanted and duplicated from pom.xml
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
While you execute a Maven Project always perform the folling in sequence:
maven clean
maven install
maven test
You can find related discussions in:
Exception in thread “main” java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
How to solve java.lang.NoClassDefFoundError? Selenium
java.lang.NoClassDefFoundError: com/google/common/base/Function
I was using eclipse 09-2019 which is the latest one with latest JDK installed 13, and latest selenium jar files 3.141.59, I installed other JDKs to work around to solve this issue after trying all answers on similar question. Then after 4 days trying, installed eclipse neon version(https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/3/eclipse-java-neon-3-win32-x86_64.zip&mirror_id=105) and used Selenium-Java 3.5.2 jar files (https://jar-download.com/artifacts/org.seleniumhq.selenium/selenium-java/3.5.2/source-code) and now it is working perfectly Alhamdullilah.
Also I don't know what was the errors root cause exactly or at all, but now it is solved.
Wish if that help You
I have SonarQube 5.1, JMeter plugin installed in SonarQube is 0.3.
Maven is: 3.1.0
I have a simple single level Maven project with some tests and JMeter jmx file.
I'm successfully generating the Test results (Unit tests) and JMeter result file (.jtl file in XML format instead of default CSV format). Refer: Sonarqube + Jmeter error in jtl file
Project's pom.xml looks like:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.csa.reference</groupId>
<artifactId>csa-reference-app</artifactId>
<version>0.0.17-SNAPSHOT</version>
</parent>
<properties>
<sonar.host.url>http://sandboxserver12.tsh.thomson.com:9000</sonar.host.url>
<sonar.jdbc.url>jdbc:h2:tcp://sandboxserver12.tsh.thomson.com:9092/sonar</sonar.jdbc.url>
<sonar.jdbc.driverClassName>org.h2.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>target/surefire-reports</sonar.surefire.reportsPath>
<sonar.java.junit.reportsPath>target/surefire-reports</sonar.java.junit.reportsPath>
<sonar.java.surefire.reportsPath>target/surefire-reports</sonar.java.surefire.reportsPath>
<sonar.groovy.junit.reportsPath>target/surefire-reports</sonar.groovy.junit.reportsPath>
<sonar.groovy.surefire.reportsPath>target/surefire-reports</sonar.groovy.surefire.reportsPath>
<sonar.language>java</sonar.language>
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.binaries>target/classes</sonar.binaries>
<sonar.java.binaries>target/classes</sonar.java.binaries>
<sonar.groovy.binaries>target/classes</sonar.groovy.binaries>
</properties>
<artifactId>a_test_app</artifactId>
<packaging>war</packaging>
<name>a_test_app Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>a_test_app</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
</plugins>
</build>
</project>
When I run mvn sonar:sonar, it works successfully but shows the following lines:
[INFO] [02:35:54.784] Sensor JMeterSensor
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
..
..
[DEBUG] [02:35:57.410] Post-jobs : org.sonar.plugins.jmeter.JMeterPostJob#79854a9e -> org.sonar.plugins.issueassign.notification.SendIssueNotificationsPostJob#3c848bb2 -> org.sonar.plugins.buildbreaker.AlertBreaker#55faaed1 -> org.sonar.plugins.buildbreaker.ForbiddenConfigurationBreaker#295790db
[INFO] [02:35:57.410] Executing post-job class org.sonar.plugins.jmeter.JMeterPostJob
[DEBUG] [02:35:57.411] START JMeterPostJob
[INFO] [02:35:57.411] Getting JMeter results from /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.420] getInputStreamByTestConfig for config 'a_test_app Maven Webapp'
[DEBUG] [02:35:57.420] JTL path: /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.423] Creating JtlAbstractSampleReader ...
[INFO] [02:35:57.636] Starting global summary report for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.055] JtlAbstractSampleReader read 240 nodes
[INFO] [02:35:58.055] Global summary report successful finished for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.062] JMeter GlobalSummary:
mostUnstableTransBytesOkAvgDevPercent=0.0
mostUnstableTransName=null
mostUnstableTransResponseTimeOkAvgDevPercent=0.0
requestsBytesOkAvg=17003.4375
requestsBytesOkAvgDev=41125.73795246031
requestsBytesOkAvgDevPercent=241.86719863239603
requestsErrorPercent=0.0
requestsErrorTotal=0
requestsOkPerMinute=2452.7337761880426
requestsOkPerMinuteAndUser=122.63668880940213
requestsOkTotal=160
requestsResponseTimeOkAvg=48.5
requestsResponseTimeOkAvgDev=152.453354037334
requestsResponseTimeOkAvgDevPercent=314.33681244811135
requestsTotal=160
slowestTransBytesOkAvgDevPercent=0.0
slowestTransName=null
...
......
..........
transMapResponseTimeOkAvgDevPercent={Transaction_Welcome=57.41068190712635, Transaction_Snoop=56.1112617700907, Transaction_Healthcheck=139.89028322965896, Transaction_Logout=50.02351333561716}
transOkPerMinute=1226.3668880940213
transOkPerMinuteAndUser=61.318344404701065
transOkTotal=80
transOrder=[Transaction_Healthcheck, Transaction_Snoop, Transaction_Welcome, Transaction_Logout]
transResponseTimeOkAvg=97.0
transResponseTimeOkAvgDev=210.29557258321267
transResponseTimeOkAvgDevPercent=216.79955936413677
transTotal=80
usersLogged=20
[DEBUG] [02:35:58.066] END JMeterPostJob
Everything looks good but I'm wondering why it shows the following line even though the .jtl file I have is valid and the Jenkins Performance plugin reports shows valid data/graphs. Why Sonar is ignoring it. I have tried putting the JMeter result .jtl file under both target/jmeter/results and target/jmeter-reports folder but JMeter widget in SonarQube (on the project's dashboard) does NOT show any data like shown below.
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
Is this due to the fact that now JMeter plugin is deprecated http://docs.sonarqube.org/display/PLUG/Deprecated+Plugins?
I don't see the setting anymore in JMeter Plugin section in SonarQube where you can specify your LOCAL jtl file in my SonarQube version.
If I see this matrix, it shows version 0.3 of JMeter plugin in SonarQube is compatible with all available SonarQube versions. See here for JMeter compatibility: http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix
Also sonar-plugin in GitHub is 0.5 version https://github.com/SonarCommunity/sonar-jmeter (but not listed in SonarQube Docs site as per their compatibility matrix).
Not sure what I'm missing at this point.
Did you configure the JMeter property on the Sonar project?
Make sure that you installed the Jmeter plugin for SonarQube.
Configure your project
Give the path to your .jtl files.
Project > Settings > General Settings > JMeter > Local jtl file
Then in the Project Overview tab, go to Configure widgets > Search:, search for JMeter > Add widget.
Run your Sonar again to see the new result.
We're using Maven 3.0.3 and are using JUnit 4.8.1 ...
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
We have this test file ...
./src/test/java/com/myco/clearing/common/xml/TextNodeTest.java
How can I run this individual test? When I try
mvn -Dtest=TextNodeTest test
I get an error saying no tests were run. I get the same error if I specify the entire package name to my test. ...
mvn clean -Dtest=com.myco.clearing.common.xml.TextNodeTest test
which produces the error message ...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project myco-productplus-web: No tests were executed!
(Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Here is the surefire configuration I'm using
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skip>false</skip>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
</additionalClasspathElements>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out "${webappDirectory}"</value>
</property>
</systemProperties>
<systemPropertyVariables>
<tomcat.port>${tomcat.servlet.port}</tomcat.port>
<project.artifactId>${project.artifactId}</project.artifactId>
</systemPropertyVariables>
</configuration>
</plugin>
The way to run a single test (method) in surefire is to do:
mvn test -Dtest=uk.co.farwell.AppTest#testSlow
Note the # instead of the space between the class name and the method name.
However, as #Andrew says, there is a bug in 2.12 (SUREFIRE-827: Surefire 2.12 cannot run a single test, regression from 2.11), but it works in 2.11.
The above bug is still open (as of 24.02.2012), but actually works for me using 2.13-SNAPSHOT.
EDIT: This is now marked as fixed in 2.12.1.
Looks like it's a bug in 2.12 version - SUREFIRE-827. Try downgrading to 2.11.
Like the others say, it's a bug in Surefire and it's fixed since version 2.11.1.