GherkinScenarioFactory not execute any test case - cucumber-jvm

I use cucumber testNG for my project and and already added some configuration based on Configuring BDD for execution and QAF Cucumber but when i run it, GherkinScenarioFactory not run any test.
[main] ERROR com.qmetry.qaf.automation.util.PropertyUtil - resources\application.properties (The system cannot find the path specified)
[main] INFO com.qmetry.qaf.automation.core.ConfigurationManager - ISFW build info: {qaf-Type=core, qaf-Revision=15, qaf-Version=2.1, qaf-Build-Time=20-N
ov-2019 22:28:06}
[main] ERROR com.qmetry.qaf.automation.core.ConfigurationManager - D:\Automation\resources not exist!
include groups []
exclude groups: [] Scanarios location: resources/features
[main] INFO com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory - scenario.file.loc[Ljava.lang.String;#400cff1a
[main] INFO com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory - total test found: 0
I've added the dependency qaf and also qaf-cucumber with version 2.1.15. I've also added the #QAFTestStepProvider annotation in the step file. Here's my testng.xml file :
<suite name="MyTest">
<test name="ComparationTest" >
<parameter name="step.provider.pkg" value="com.example.steps" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
in the feature file I added : Examples: {'datafile': 'resources/data/data.xls'}
and last in cucumber runner I added plugin "com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin"
I'm still learing, can somebody tell me what did i miss?

It looks that you are pointing to wrong location for resources and feature file/directory. You need to provide relative path to project root directory for resources and scenarios directory. If you observe the log also complains that fie/folder not exist.
[main] ERROR com.qmetry.qaf.automation.util.PropertyUtil - resources\application.properties (The system cannot find the path specified)
[main] INFO com.qmetry.qaf.automation.core.ConfigurationManager - ISFW build info: {qaf-Type=core, qaf-Revision=15, qaf-Version=2.1, qaf-Build-Time=20-N
ov-2019 22:28:06}
[main] ERROR com.qmetry.qaf.automation.core.ConfigurationManager - D:\Automation\resources not exist!
Make sure that you have resources directory under project root.
Regarding feature files, according to your current configuration
scenario.file.loc is resources/features. In that case make sure that <project-root>/resources/features is exist. For example your project root is D:/Automation then resources/features points to D:/Automation//resources/features
If not then provide correct relative path to project root.
For example resources/features expects <project-root>/resources/features if it is not there provide correct location.
Same is applied for other resources including properties file and test data files.
For application.properties it is expected under <project_root>\resources\application.properties if it is not there you can provide location by using system property application.properties=<relateive_path_to_project> or alternately place under default location <project_root>\resources.
As a side note,
instead of GherkinScenarioFactory recommended is BDD2 factory com.qmetry.qaf.automation.step.client.text.BDDTestFactory2
Latest version of qaf as of today is 3.1.0-RC1 the version you are using 2.1.15 is quite old.

Related

SonarQube: errors in analysing C# and VB projects

I am trying to follow the instructions here to try SonarQube for MSBuild:
http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild, but I got the following errors for C# and VB samples. I can't find any message in the sonar.log so don't know how to proceed.
C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>where msbuild
C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: Duplicate project GUID: "12add147-fbaf-46aa-b8a4-f708d4d0f295". Check that the project is only being built for a single platform/co
nfiguration and that that the project guid is unique. The project will not be analyzed by SonarQube. Project file: C:\Tools\SonarQube\sonar-
examples-master\projects\languages\csharp\ConsoleApplication1\ConsoleApplication1.csproj
C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\huj\AppData\Local\Temp\.NETFr
amework,Version=v4.5.AssemblyAttributes.vb, project: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1\C
onsoleApplication1.vbproj
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_60 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..\conf\s
onar-runner.properties
INFO: Project configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar
INFO: SonarQube Server 5.2
15:43:49.634 INFO - Load global repositories
15:43:49.815 INFO - Load global repositories (done) | time=180ms
15:43:49.830 INFO - User cache: C:\Users\huj\.sonar\cache
15:43:50.224 INFO - Load plugins index
15:43:50.227 INFO - Load plugins index (done) | time=3ms
15:43:50.458 INFO - Process project properties
15:43:50.728 INFO - Load project repositories
15:43:50.741 INFO - Load project repositories (done) | time=13ms
15:43:50.747 INFO - Apply project exclusions
15:43:50.871 INFO - Load quality profiles
15:43:50.919 INFO - Load quality profiles (done) | time=48ms
15:43:50.924 INFO - Load active rules
15:43:51.344 INFO - Load active rules (done) | time=420ms
15:43:51.362 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to def
ine SCM of your project.
15:43:51.362 INFO - Publish mode
15:43:51.363 INFO - ------------- Scan ConsoleApplication1
15:43:51.459 INFO - Load server rules
15:43:51.629 INFO - Load server rules (done) | time=170ms
15:43:51.684 INFO - Base dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1
15:43:51.684 INFO - Working dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar\vbnet_vbnet_65E63A
B4-1055-4104-B233-A9F7CF2233DA
15:43:51.685 INFO - Source paths: Module1.vb, My Project/AssemblyInfo.vb, My Project/Resources.resx, My Project/Application.myapp, My Proje
ct/Settings.settings, App.config
15:43:51.685 INFO - Source encoding: UTF-8, default locale: en_US
15:43:51.686 INFO - Index files
15:43:51.709 INFO - 2 files indexed
15:43:51.711 INFO - Quality profile for vbnet: Sonar way
15:43:51.885 INFO - All FxCop rules are disabled, skipping its execution.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 3.142s
Final Memory: 11M/308M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
Your C# project isn't being analysed because of the WARNING: Duplicate project GUID.... Check that your project guids are unique. You will also get this error if you run the begin step then call MSBuild multiple times for the same project before calling end. Try running begin, MSBuild .... end to see if that fixes the C# project issue. For the VB issue, please include more of the call stack from the Java error.

Trying to Use MSBuild SonarQube and unable to make it work

I have been using SonarQube for code analyzing at a basic level however now I would like to measure the code against FX-COP rules. Hence I am attempting to use MSBuild SonarQube scanner. I read the documentation thoroughly and have setup my project likewise however when I execute it gives me error.
Below is the extract from the log:
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\....\1c36691bf5270463\SonarQube.Analysis.xml
Loading analysis properties from C:\....\1c36691bf5270463\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
Loading analysis properties from C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Updating build integration targets...
Fetching analysis configuration settings...
Generating rulesets...
Pre-processing succeeded.
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 11/20/2015 1:46:41 PM.
Project "C:\Project1.sln" on node 1 (rebuild target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Build succeeded.
9 Warning(s)
0 Error(s)
Time Elapsed 00:01:07.86
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Loading analysis properties from C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Post-processing started.
MSBuild SonarQube Runner Post-processor 1.0.2.0 gives several warnings similar to one below:
WARNING: File is not under the project directory and cannot currently be analysed
by SonarQube.
File: C:\Users\...\AppData\Local\Temp\2\.NETFramework,Version=v4.0.AssemblyAttributes.cs,
project: C:\...\1c36691bf5270463\SOURCE\x\y.csproj**
Calling the sonar-runner:
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
C:\...\1c36691bf5270463\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_51 Oracle Corporation (64-bit)
Windows Server 2008 R2 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\...\1c36691bf5270463\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: C:\TeamCity\buildAgent\work\1c36691bf5270463\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\...\1c36691bf5270463\.sonarqube\out\.sonar
INFO: SonarQube Server 5.1.1
13:47:51.150 INFO - Load global repositories
13:47:51.743 INFO - Load global repositories (done) | time=593ms
13:47:51.758 INFO - Server id: 20151120125423
13:47:51.758 INFO - User cache: C:\...\cache
13:47:51.758 INFO - Install plugins
13:47:51.836 INFO - Install JDBC driver
.
.
.
13:47:55.518 INFO - ------------- Scan file1
13:47:55.534 INFO - Load module settings
13:47:55.658 INFO - Load rules
13:47:56.017 INFO - Base dir: C:\...\1c36691bf5270463\SOURCE\xxx
13:47:56.017 INFO - Working dir: C:\...\1c36691bf5270463\.sonarqube\out\.sonar\AC1_AC1_497EBFF2-C710-4843-8263-F534AF803D3E
13:47:56.017 INFO - Source encoding: UTF-8, default locale: en_US
13:47:56.532 INFO - Quality profile for cs: Sonar way
13:48:00.635 INFO - Sensor org.sonar.plugins.csharp.CSharpFxCopProvider$CSharpFxCopSensor#73c82ec1
INFO: -----------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: -----------------------------------------------------------------
Total time: 10.156s
Final Memory: 16M/306M
INFO: -----------------------------------------------------------------
13:48:00.791 Creating a summary markdown file...
Press any key to continue . . .
You need to run all your commands in a Developer Command Prompt for Visual Studio 2013 or higher and:
use at least MSBuild 12.0
have .NET 4.5.2+ installed
You have this error because the FxCop Results are not generated.
Do you see in the MSBuild's logs, execution of FxCop? This is visible inside the RunCodeAnalysis section of MSBuild's logs.
You need to run this from command line and use the "-X" flag on your command, this will give you verbose debugging, I would highly reccomend doing the following for troubleshooting.
sonar-runner.exe <arg> <arg> -X > sonar-runnerLog.txt
Then read or dump that log back here. either way you'll know a lot more about what the actual problem is.
You can get Visual Studio Express 2013 (or 15) for free and both of those come with their respective developer command prompts.

Why is the XUnit plugin not working with Jenkins?

I launched the tests IDE (selenium) from jenkins and I uploaded the XUNIT plugin for having a nice report of test but at the end I obtained this message of ERROR :
Tests failed, see result file for details:
D:\FTP\stm_atos_automatisation\rapports\ff39\rapport_ff39.html ERROR: Build step failed with exception java.lang.NullPointerException: The types section is required.
at org.jenkinsci.plugins.xunit.XUnitProcessor.<init>(XUnitProcessor.java:65)
at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:111)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381) Build step 'Publish xUnit test result report' marked build as failure Finished: FAILURE
Is there any way to solve this problem?
I was getting this error too when I first enabled the XUnit plugin.
I hadn't realized (or had forgotten) that I needed to add a report type to the XUnit build step configuration. To do so, click Add and then select the type of report you want parsed (for me it was PHPUnit-3.x). See this screenshot. You'll also have to specify the path to the XML report files that you want parsed. (I'm using Codeception, so it was tests/_log/*.xml.)

Sonar for Eclipse: unable to run local analysis

I have successfully installed sonar plug-in for eclipse, however when I try to 'Run Local Analysis' for sonar, eclipse gives an error saying:
An internal error occurred during: "Sonar Analysis".
Unable to create markers
and console for Sonar has following info printed:
Usage: javaw [-options] class [args...]
(to execute a class)
or javaw [-jar] [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath
set search path for application classes and resources
-D=
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-version:
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-agentlib:[=]
load native agent library , e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:[=]
load native agent library by full pathname
-javaagent:[=]
load Java programming language agent, see java.lang.instrument
-? -help print this help message
-X print help on non-standard options
-splash: show splash screen with specified image
-ea[:...|:]
-enableassertions[:...|:]
enable assertions
-da[:...|:]
-disableassertions[:...|:]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
Plz help with how to proceed for Local analysis in eclipse.
[Update: Version Details]
Eclipse: Indigo (3.7.1)
Sonar Plug-in: 3.0.0
Sonar(Server): 3.4.1
Sonar Web Service Client: 3.4.0
Java: 1.4.1 ('Java EE IDE' property in Eclipse Features)
Local Java Installation: 1.6

openJPA on Java SE

I try to develop JPA project on ibm RAD. And i can run it on Webpshere successfully,
but the problem is my machine is quite old. So deploying in Java EE container isn't
reasonable.And i want to run it on JSE.But it gives following error:
94 test INFO [main] openjpa.Runtime - Starting OpenJPA 1.2.1-SNAPSHOT
235 test INFO [main] openjpa.jdbc.JDBC - Using dictionary class "com.ibm.ws.persistence.jdbc.sql.DB2Dictionary".
1797 test WARN [main] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class Customer]".
Exception in thread "main" <openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class Customer" has not been enhanced.
at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1650)
at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1624)
at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717)
at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:616)
at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1114)
at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
at deneme.main(deneme.java:21)
What i'm missing?
By the my persistent.xml is:
**<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>
com.ibm.websphere.persistence.PersistenceProviderImpl
</provider>
<class>Customer</class>
<properties>
<property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver"/>
<property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:50000/PARUD:retrieveMessagesFromServerOnGetMessage=true;"/>
<property name="openjpa.ConnectionUserName" value="db2admin"/>
<property name="openjpa.ConnectionPassword" value="xxxxx"/>
<property name="openjpa.jdbc.Schema" value="POOL"/>
</properties>
</persistence-unit>
</persistence>**
Just a pointer:
You need to enhance your classes e.g. at runtime via -javaagent:yourlib.jar
or even while compiling. You could learn more on this topic here:
"The second and recommended way get runtime enhancement is to provide a javaagent when launching the JVM that OpenJPA is going run in."
I just went through the exercise of getting OpenJPA 2.1.0 to run on Tomcat 7.0. I was simply unable to get run-time enhancement to work under Tomcat so I gave up and decided to use build-time enhancement. I am developing my code under Eclipse so I followed the instructions here:
http://openjpa.apache.org/enhancement-with-eclipse.html
Note however that the instructions on this page are for generic java projects. If you are working with Dynamic Web Projects, be sure to specify the build directory argument correctly. I used -Dbuild.dir=build/classes which is the typical location for the compiled code.
One more annoying quirk you have to live with. You must manually invoke the builder using the "Project > Build Project" menu item. When the enhancer runs, it modifies the previously built classes. Consequently, you need to hit F5 or Refresh for the project before you publish to Tomcat.