cucumber - "Test ignored" error while running Runner in IntelliJ - intellij-idea

I am trying to run a simple example of cucumber-Junit in Intellij, but not geting error "Test ignored". (I have installed cucumber for Java plugin)
My feature file, Runner class, Stepdefinition class and java class look as below:
I also tried to restructure the stepdefinition and feature file in multiple ways but it did not help.
1) Does the error mean, it is not finding stepdefinition file (Feature1Steps.java) ? if yes, how do I make it find it ?
2) I am not able to run feature file (Feature1.feature) either. It says : "Test Framework quit unexpectedly"
3) I have tried 1) and 2) with both the latest Cucumber for Java plugin and an older one (183.4284.148). But that did not solve the issue.
Could someone please help me here ?

Well, I did change multiple things and would like to post it here..
1) The words in scenario in feature file and step definition file are case sensitive so I corrected it. (in feature file when I write "Given that I have a Calculator", then in step definition file also I should write ( #Given("^that I have a Calculator$")). Earlier I had small c (calculator) in first step of my step definition file.
2) I just put stepdefinition file and Runnerclass files in the same package and feature file in resources folder. see screenshot below:
After having this structure I do not require to specify glue at all in Cucumber options in Runner class. I just require to specify where my feature file exists. see below:
3) now I am using cucumber version 4.2.0. But that did not make any difference I think.
I hope this helps others.

Move the .feature file to resources/com/example.
From the Cucumber docs:
"If Cucumber is telling you that your steps are undefined, when you have defined step definitions, this means that Cucumber cannot find your step definitions. You’ll need to make sure to specify the path to your step definitions (glue path) correctly.
By default Cucumber-JVM will search in the package (or sub-packages) of the runner class. You can also tell Cucumber-JVM explicitly which packages (and sub-packages) to search, with:
#CucumberOptions(glue = {"<package>", "<package>", "<etc>"})
public class RunCucumberTest{}"
"
(Sidenote: you are using a very old version of Cucumber. v5 is about to be released.)

Related

io.cucumber.junit.UndefinedStepException: The step "User is in login page" is undefined. You can implement it using the snippet(s) below:

I have the following error:
but I have implemented the steps
enter image description here
How I can do?
This means that Cucumber cannot find your step definition, because it is in a different place than Cucumber is looking for it (either by default, or where you specified it to look).
From the Cucumber FAQ:
"Cucumber says my steps are undefined, but I have implemented step definitions!
If Cucumber is telling you that your steps are undefined, when you have defined step definitions, this means that Cucumber cannot find your step definitions. You’ll need to make sure to specify the path to your step definitions (glue path) correctly.
By default Cucumber-JVM will search in the package (or sub-packages) of the runner class. You can also tell Cucumber-JVM explicitly which packages (and sub-packages) to search, with:
#CucumberOptions(glue = {"<package>", "<package>", "<etc>"})
public class RunCucumberTest{}
"

How to get resource in tests using Gradle?

I have:
--src
-----main
-----test
--------resources
-------------test.zip
In test directory I have Spock test. How can I refer the test.zip file so to pass its absolute path to the test and to check some of my methods? I tried with new File('.').absolutePath but I want to find better solution
def "check checkTypeZipMethod"() {
expect:
assert testedMethod(new File('.').absolutePath+"test/resources/test.zip")==true
}
You can either try to locate the zip file based on ClassLoader#getResource, or configure the test task to set a system property pointing to the zip file. The latter is easier to implement, but harder to make work in environments other than Gradle (e.g. when running the test inside an IDE).
PS: In a Spock expect: or then: block, you can (and should) omit the assert keyword.

Using yiidocsgenerator extension to generate documentation

I posted in the Yii forum with no luck. I am hoping someone in this community got this extension working because I really need it!
I used the yiic docs check command, and all the models seem to finally pass the check. So, I proceeded to executing this command:
yiic docs C:\path to my site\protected\models
And at first this appears onscreen:
Building.. : MyApplication Class Reference
Version... : 1.1.7
Source URL:
And then this error pops up:
Building model...
PHP Error[2]:include<GxActiveRecord.php>: failed to open stream: No such file or directory in file C:\path-to-my-app\yii\framework\YiiBase.php at line 396
Where, at that line, I have the following code:
include($className.'.php');
I don't understand why it is looking for a class I do not have!! I found it here, but I don't know in what specific folder that class should reside, or better yet why I should have to download it separately when it's not specified in the instructions. Thanks.
Looks like you've generated models from giix which have GxActiveRecord as a base class and the doc parser does not find this base class, usually you've defined this as an import in your application config, so this may be an expected behavior.
You could try importing something like 'ext.giix.components.GxActiveRecord' in every one of your model classes or copy GxActiveRecord into your models directory just for generating the docs.

Using environment vars in non-rails cucumber test

I created a simple smoketest for a portal running java/tomcat/jahia (cms) fronted by cache servers and big ip. Cucumber + Webrat + Mechanize is a good fit for a simple smoketest of this setup. (and it has been very easy to get started).
Right now I have hardcoded into /features/support/paths.rb the following lines:
module NavigationHelpers
#PATH="http://production-environment"
#PATH="http://staging-environment"
#PATH="http://test-environment"
PATH="http://localhost:8080"
#
def path_to(page_name)
case page_name
when /the homepage/
"#{PATH}/"
when [...]
...
end
end
end
World(NavigationHelpers)
Right now I manually switch the comments when I want to test different environments. The issue here is I'd love to get rid of the constant PATH and put a default value inside one of the support files. And i also want to be able to feed cucumber with this environment variable from the command line like so:
cucumber ENV=staging
How do you cope with this issue? Any suggestions? Links to code that deals with this? Snippets?
You can pass environment variables to Cucumber like you have done with ENV. Each environment vriable will then be available in Ruby's ENV constant. More details in the Wiki
(I just added this page - the feature has been around since 0.3.90 but was only ever mentioned in the History.txt file).

Issue with the karate parallel runner

I wanted to see if anyone else might have observed the same issue. I looked in the project for any open/closed issues that might be like this but did not notice any.
I noticed that when I use the Karate Parallel runner (which we have been using for a while now), that every GET, POST, DELETE request gets called 2x, observed in the karate logs which came in the console.
When I do not use the Karate Parallel runner only a single request is made.
I noticed this when performing a POST to create a data source in our application. When I went to the applications UI to verify the new data source was created, I saw 2 of them. This leads me down the path to research further what might be happening.
Using Karate v0.9.5 with Junit 5
minimalistic Example -
https://drive.google.com/file/d/1UWnNtxGO7gr-_Z80MLJbFkaAmuaVGlAD/view?usp=sharing
Steps To Run The Code -
Extract ZIP
cd GenericModel
mvn clean test -Dtest=UsersRunner
Check the console logs API scenario get executed 2X
Note - It works fine for me for karate V0.9.4 with Junit 5
You mixed up parallel runner and JUnit runner and ended up having both in one test method. Please read the documentation: https://github.com/intuit/karate#junit-5-parallel-execution
Note that you use the normal #Test annotation not the #Karate.Test one.