How to make cuke4duke find step definitions - maven

I have configured cuke4duke and Cucumber with maven and written feature and step definition files.
My feature file is located at [ProjectDir]\features\example2.feature
Feature: Example of a feature file
As some aspiring cuke4duke user
I want an example of how it works
So that I can easily setup my project to use it
# This should pass
Scenario: A simple passing scenario
Given the letter 'A'
When I check the letter
Then the letter should be 'A'
My step definitions are located at [ProjectDir]\src\test\java\Example2Steps.java
package test.java;
import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;
public class Example2Steps {
private char theLetter;
#Given("^the letter 'A'$")
public void gimmeALetter(final char theLetter) {
this.theLetter = theLetter;
}
#When("^I check the letter$")
public void checkThem() {
// just a stub
}
#Then("^the letter should be 'A'$")
public void checkTheLetter(final char aLetter) {
assertThat(theLetter, is(aLetter));
}
}
When I run "mvn integration-test" at project dir in Windows command prompt it builds fine, but tells me that the scenario and steps are undefined.
Output:
[INFO] [cuke4duke:cucumber {execution: run-features}]
[INFO] Feature: Example of a feature file
[INFO] As some aspiring cuke4duke user
[INFO] I want an example of how it works
[INFO] So that I can easily setup my project to use it
[INFO]
[INFO] # This should pass
[INFO] Scenario: A simple passing scenario # features\example2.feature:7
[INFO] Given the letter 'A' # features\example2.feature:8
[INFO] When I check the letter # features\example2.feature:9
[INFO] Then the letter should be 'A' # features\example2.feature:10
[INFO]
[INFO] 1 scenario (1 undefined)
[INFO] 3 steps (3 undefined)
[INFO] 0m0.053s
[INFO]
[INFO] You can implement step definitions for undefined steps with these snippets:
[INFO]
[INFO] Given /^the letter 'A'$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] When /^I check the letter$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] Then /^the letter should be 'A'$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] If you want snippets in a different programming language, just make sure a file
[INFO] with the appropriate file extension exists where cucumber looks for step definitions.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
As far as I can read anywhere, cuke4duke looks for step definitions at [ProjectDir]\src\test\java\, why can't it find my definitions?

In the end it was wrong case in some of my Maven pom tags that caused the error.
I cross-checked my pom and other project files with the following
example project, and now it all works!
https://github.com/jamesladd/maven-cuke4duke-jump-start

Related

unable to build app on appcelerator studio

I am not able to build android app project on appcelerator studio.
I am using Titanium sdk 5.1.1.GA the console just stops after extracting module resources, see below:
[INFO] : Encrypting JavaScript files: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\titanium_prep.win32.exe "com.test7" "C:\Users\Fatimah\Documents\Appcelerator_Studio_Workspace\test7\build\android\assets" "app.js" "iphone/ui/ApplicationWindowPlatform.js" "iphone/ui/Drawer.js" "ui/ApplicationWindow.js" "ui/Drawer.js" "ui/ApplicationWindowPlatform.js" "_app_props_.json"
[INFO] : Writing C:\Users\Fatimah\Documents\Appcelerator_Studio_Workspace\test7\build\android\bin\assets\app.json
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-analytics.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-android.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-app.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-filesystem.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-media.res.zip
I'm not sure why the build would get stuck extracting the modules. Try cleaning your project, then building again. You might get lucky.
It could also be your Node.js version. We use a pretty old Node module called "adm-zip" for extracting zip files, so it's possible it's being finicky. Try using Node.js 4.x or 0.12.

Setting encoding for SCM Activity plugin for sonar-maven-plugin?

I use SonarQube 4.2 with SCM Activity [scmactivity] 1.7 with sonar-maven-plugin 4.2.
Upon executing mvn sonar:sonar I'm seeing the following:
[INFO] --- sonar-maven-plugin:4.2:sonar (default-cli) # ... ---
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: ...\target\sonar
INFO: SonarQube Server 4.2
...
[INFO] [15:43:51.829] Source encoding: UTF-8, default locale: en_US
...
[INFO] [15:43:59.169] Sensor ScmActivitySensor...
[INFO] [15:43:59.169] Trying to guess scm provider from project layout...
[INFO] [15:43:59.170] Found SCM type: svn
[INFO] [15:43:59.170] Retrieve SCM blame information with encoding windows-1250...
[INFO] [15:43:59.343] Retrieve SCM blame information with encoding windows-1250 done: 173 ms
[INFO] [15:43:59.345] Sensor ScmActivitySensor done: 176 ms
How can the encoding be set up to another one, say UTF-8?
Try adding these to the properties section of the POM:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Currently you can't. This is the line responsible for printing the encoding:
TimeProfiler profiler = new TimeProfiler().start("Retrieve SCM blame information with encoding " + Charset.defaultCharset());
However, this is somewhat misleading, because author names are always normalized and stripped of all non ascii characters:
authors.add(lineNumber, normalizeString(line.getAuthor()));
...
private String normalizeString(String inputString) {
String lowerCasedString = inputString.toLowerCase();
String stringWithoutAccents = removeAccents(lowerCasedString);
return removeNonAsciiCharacters(stringWithoutAccents);
So actually, the encoding has no impact.

Maven build with SASS does not work in Jenkins

I have a project, which builds fine locally. When I run mvm clean deploy it builds fine and the sass-maven plugin gives me the following output:
[INFO] --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[INFO] Compiling SASS Templates
[INFO] Queing SASS Template for compile: /Users/750250/Projects/myapp/webapp/src/main/webapp => /Users/750250/Projects/myapp/webapp/src/main/webapp
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7669.abTest.boldKeywords.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7669.abTest.boldKeywords.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.common.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.common.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.noDescription.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.noDescription.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/coolSearchResults/css/coolSearchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/coolSearchResults/css/coolSearchResults.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/hotSearchResults/css/hotSearchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/hotSearchResults/css/hotSearchResults.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/homeStatic.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/homeStatic.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/merchant.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/merchant.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/offer.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/offer.css
[INFO] >> /Users/750250/Projects/bizratmyappe-eu-webapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/product.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/product.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/searchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/searchResu
Indicating that it works. However, when the same thing is run from Jenkins, I get the following output from the plugin
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[pool-1-thread-1] INFO org.jasig.maven.plugin.sass.UpdateStylesheetsMojo - Compiling SASS Templates
[pool-1-thread-1] INFO org.jasig.maven.plugin.sass.UpdateStylesheetsMojo - Queing SASS Template for compile: /home/sitebuild/jenkins/workspace/{myapp}-myapp-webapp-{S7515}/webapp/src/main/webapp => /home/sitebuild/jenkins/workspace/{myapp}-myapp-webapp-{S7515}/webapp/src/main/webapp
It appears that it is just ignoring or not picking up the contents of that directory.
What would cause this behaviour when running the sass-maven-plugin within jenkins?
I have replicated your issue and it appears to be a bug in the SASS plugin - the good news is there is a workaround.
The absolute path your Jenkins server is passing to the plugin contains curly braces. This is a common source of bugs in Ruby programs, which the Maven SASS plugin is. Doing this locally replicated your problem exactly - the plugin starts, then simply does not compile anything.
When I built a POM that used relative paths instead of absolute paths (src/main/sass vs ${project.dir}/src/main/sass)), it was possible to build in a directory whose path contained curly braces.
It would be good if the plugin reported that the path it is trying to compile from seems problematic though.

using Typesafe Activator on Windows

I tried to run the hello-slick template from inside Typesafe Activator.
When it recompiled it produced:
Refreshing list of source files to watch for changes...
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins\project
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins
[info] Loading project definition from C:\Users\Edward G Prentice\hello-slick\project
[info] Set current project to hello-slick (in build file:/C:/Users/Edward%20G%20Prentice/hello-slick/)
[error] Expected '"'
[error] apply -cp "C:/Users/Edward
[error] ^
Failed to reload source file list: sbt process never got in touch, so unable to handle request WatchTransitiveSourcesRequest(true)
so clearly it is not expecting spaces in that portion of the classpath. I understand what's failing but not how to fix it.
...and what is the best channel to resolve problems with Typesafe Activator?

Error Compiling Netty latest (Master) version

I would like to test some of the latest features locate in netty Master branch at github.
(git://github.com/netty/netty.git)
I'm doing the following steps:
Open new empty directory on my local machine
Type git init
Type git pull git://github.com/netty/netty.git
Compile pom.xml using maven as follow: mvn clean package
I now get the following compliation error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.855s
[INFO] Finished at: Sun Jan 08 12:14:21 IST 2012
[INFO] Final Memory: 16M/176M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project netty: Compilation failure: Compilation
failure:
[ERROR] \tradair\tools\netty\src\main\java\io\netty\util\internal\LegacyLinkedTransferQueue.java:[655,61] type parameters of <E>E cannot be determined; no uniqu
e maximal instance exists for type variable E with upper bounds E,java.lang.Object
[ERROR] \tradair\tools\netty\src\main\java\io\netty\util\internal\LegacyLinkedTransferQueue.java:[739,53] type parameters of <E>E cannot be determined; no uniqu
e maximal instance exists for type variable E with upper bounds E,java.lang.Object
[ERROR] \tradair\tools\netty\src\main\java\io\netty\util\internal\LegacyLinkedTransferQueue.java:[827,57] type parameters of <E>E cannot be determined; no uniqu
e maximal instance exists for type variable E with upper bounds E,java.lang.Object
[ERROR] \tradair\tools\netty\src\main\java\io\netty\util\internal\LegacyLinkedTransferQueue.java:[880,65] type parameters of <E>E cannot be determined; no uniqu
e maximal instance exists for type variable E with upper bounds E,java.lang.Object
Can you please advise what I'm doing wrong.
LinkedTransferQueue back-porting was done recently in master, so you better try with latest version of JDK 6, (>= 1.6.0_25, a compiler bug?)
That's a java bug (I hit it before also). Upgrade to latest jdk and it will work. I don't recall what exactly version of java was giving the problems

Resources