This post is in addition query to Is it possible to migrate from cucumber-jvm to QAF? Could you please help me know the approach to execute as testNG? For now I've configured the example from below link
https://github.com/qmetry/qaf/releases/download/2.1.9-RC2/QAFGherkin.zip
however when I try to execute the CucumberRunner.java It doesn't find any feature
log4j:WARN No such property [follow] in org.apache.log4j.FileAppender.
[ConfigurationManager] - ISFW build info: {qaf-Type=core, qaf-Revision=9-RC1, qaf-Version=2.1, qaf-Build-Time=23-Sep-2016 12:16:17}
[ConfigurationManager] - Resource dir: C:\Users\Kalyankar\Downloads\qaf-blank-project-maven-masterDec\qaf-blank-project-maven-master\resources. Found property files to load: 6
[ConfigurationManager] - Resource dir: C:\Users\Kalyankar\Downloads\qaf-blank-project-maven-masterDec\qaf-blank-project-maven-master\resources. Found property files to load: 0
[TestNG] Running:
C:\Users\Kalyankar\AppData\Local\Temp\testng-eclipse-1055468291\testng-customsuite.xml
No features found at [classpath:com/qmetry/qaf/examples/cucumber/runners]
0 Scenarios
0 Steps
0m0.000s
PASSED: run_cukes
Runs Cucumber Features
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter#6e1567f1: 18 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2#72d818d1: 18 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 30 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter#31a5c39e: 35 ms
[TestNG] Time taken by org.testng.reporters.jq.Main#59ec2012: 224 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter#42dafa95: 131 ms
I've ensured that application.properties values are also set as step.provider.pkg=com.qmetry.qaf.examples.steps.cucumber then later, I moved a feature file to com.qmetry.qaf.examples.cucumber.runners package & executed it. No luck. Any help would be much appreciated.
Thanks in advance
Please refer migration steps. Will you please share your project structure after migration and config file you are using?
Use QAF latest version and don't run with cucumber runner, instead run using QAF. Below is sample configuration file:
<test name="Gherkin-QAF-Test">
<parameter name="step.provider.pkg" value="your.steps.pkg" />
<parameter name="scenario.file.loc" value="your features file relative path" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
You can run as TestNG test.
Default directory for .bdd or .feature file is <project_home>/scenarios directory. If it is not under /scenarios you need to set using scenario.file.loc.
Related
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.
I have a Jenkins that run several task, included my tests with phpunit. Everything is working, the test are running but when a test fail the build is set like Succesfull and I don't get my notifications. I wanna that when a test fail, the build fail to notificate github and the developer too.
The notification system works OK when a build fail because I have migrations too that are working ok.
My phpunit.xml file look like this:
<phpunit
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="bootstrap.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
processIsolation="false"
stopOnError="true"
stopOnFailure="true"
stopOnIncomplete="true"
stopOnSkipped="true"
stopOnRisky="true"
strict="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="true"
And this is one of the outputs of Jenkins.
There was 1 error:
Undefined index: payroll
/tmp/app/test/unit/payroll/PayrollTest.php:24
FAILURES!
Tests: 311, Assertions: 392, Errors: 1.
BUILD FINISHED
Total time: 2 minutes 17.89 seconds
[INFO] HipChat notification sent to the following rooms: app
Finished: SUCCESS
Hints ? Best regards.
I'm having issue with play framework and JUnit test with play 2.3
When running: "activator test" then it runs fine, but...
[info] Loading project definition from /.../test/toto/project
[info] Set current project to toto (in build file:/home/jenkins/.../)
[info] Compiling 6 Java sources to /home/jenkins/automated_tests/.../toto/target/scala-2.11/test-classes...
[warn] application - do execute tests in class utils.UtilsTest
[warn] application - do execute tests in class test_marketcity.BasicTest
[info] Passed: Total 14, Failed 0, Errors 0, Passed 14
[success] Total time: 29 s, completed Feb 12, 2015 9:48:51 AM
There's nothing about the test which have been run, only the full total of test (14 here). With play 2.2 I had a more detailled log containing also each test:
[info] x firstTest (x means here it failed)
[info] + secondTest (+ means here it succeeded)
Should I have to put a specific option here to get more details ?
Thx
It is a common issue with tests on activator. I usually run activator clean before tests to get the output. Sometimes running tests from sbt helps.
I use selenium web driver with junit in Eclipse. Advice me please how can I report test results?
I try make it in such way:
http://testerinyou.blogspot.com/2011/03/how-to-create-reports-using-junit.html?showComment=1342535781861#c6211334222001490686
But get errors during gereration:
Buildfile: E:\eclipse\WebDriver\build.xml
build-subprojects:
init:
build-project:
[echo] WebDriver: E:\eclipse\WebDriver\build.xml
[javac] E:\eclipse\WebDriver\build.xml:43: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build:
Sector:
[mkdir] Created dir: E:\eclipse\WebDriver\junit
[junit] Running Sector
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test Sector FAILED
junitreport:
[junitreport] Processing E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml to E:\DOCUME~1\CONSUL~1\LOCALS~1\Temp\null255203125
[junitreport] Loading stylesheet jar:file:/E:/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs /optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml
BUILD FAILED
E:\eclipse\WebDriver\build.xml:135: Errors while applying transformations: Fatal error during transformation
Total time: 4 seconds
There are different possibilities to create reports for Selenium WebDriver.
A user developed a small library to create a html report with screenshots and so on.
For further information look here: https://github.com/vorburger/webdriver-reporting
Furthermore you could use another framework based on Selenium called Thucydides. It generates really nice looking html-reports and improves Selenium WebDriver. You can visit the official website for more information (www.thucydides.info)
You could use Ant oder TestNG to create a report for your tests.
Look here for more information: http://selftechy.com/2011/06/29/selenium-use-ant-to-generate-html-reports
I like UnitTH to generate test reports.
You can start it via ant or maven
Further questions?
I have a maven project in Eclipse, a web-project using Seam. Now I wanted to use Seam Test for unit test. I dit not use SeamGen to create the project.
I followed this guide, but when I run my test I get this error. I get a feeling the wrong sax parser is being used. Does anyone recognize it?
[Parser] Running: :\Documents and Settings\PEJA715\Local Settings\Temp\testng-eclipse\testng-customsuite.xml
FAILED CONFIGURATION: #BeforeSuite startSeam
java.lang.RuntimeException: Unable to bootstrap:
at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:147)
at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)
at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)
at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11)
at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1024)
at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:915)
at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:85)
at org.jboss.embedded.Bootstrap.deployBaseBootstrapUrl(Bootstrap.java:130)
at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:142)
... 21 more
Caused by: org.jboss.xb.binding.JBossXBException: Failed to create a new SAX parser
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.(SaxJBossXBParser.java:97)
at org.jboss.xb.binding.UnmarshallerImpl.(UnmarshallerImpl.java:55)
at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:96)
... 24 more
Caused by: javax.xml.parsers.ParserConfigurationException: Feature 'http://apache.org/xml/features/xinclude' is not recognized.
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.(SaxJBossXBParser.java:92)
... 26 more
... Removed 15 stack frames
SKIPPED CONFIGURATION: #BeforeClass setupClass
SKIPPED CONFIGURATION: #BeforeMethod begin
SKIPPED CONFIGURATION: #AfterMethod end
SKIPPED CONFIGURATION: #AfterClass cleanupClass
SKIPPED: testRegister
===============================================
TestOfTest
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 4
===============================================
===============================================
effsort-web
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 5
===============================================
[org.testng.internal.PoolService] Shutting down poolservice org.testng.internal.PoolService#1117a20 terminated:false
Hard to say from the stacktrace (showing your dependencies might help) but double check that you use the SAX parser used by JBoss 5.0.1.GA (and not xml-apis that you might get transitively).