Is there tool avaialble to check code quality for gherkin language? - behat

I am using behat testing framework to test my website.
In that I need to write .features file in gherkin language.
So I would like to know If there is any tool available that will -
1.Validate correctness of .features files
Or/And
2.Perform static code analysis on .features files
Or/And
3.Perform code quaility check on .features files
For example sonarqube can perform static code analysis on C,Java,PHP language.

You can try using Online Gherkin Formatter and Validator
This tool allows you to check syntax and reindent/format feature files.

There is a tool called CukeTest on Windows used mainly to author gherkin files and cucumber.js projects, which you can also to author or validate gherkin (*.feature) files.
Take a look at the following image:
Steps:
Open a folder (a.k.a. project) that contains the *.feature
Click "Validate Project" button.
CukeTest can either be downloaded directly or installed from Windows Store.

Related

Exploring options to deliver Selenium test to non-tech business team who wish to run the test on their own

Our non-technical business team need to run only 1 automation test script which will be fetching data from several hundreds rows of Excel file. I've created automation that script using a Maven project (with POM framework and Extent Report), using Selenium WebDriver, Java, TestNG, and Eclipse but not sure how to deliver the test/script to the business team. Would appreciate if you guys can suggest a few options to deliver this script to the business team so that they can change few parameters in Excel file and run the script on their own. I'm getting Extent report at the end of the test, would be best if they can get the Extent report as well.
Note: Since they are non-technical, it is preferable to avoid installing and configuring Java, Eclipse, etc tools on their machine but that's not mandatory so I'm open to check several options.
I would like to suggest few options here :
Jenkins - Install it on Any server and share login and url with them. They can execute build and no technical knowledge required.
Executable JAR - Export your project as executable JAR and deliver that JAR file. All they have to do it , Double click on JAR file OR execute via batch file and it should run that script and get done the job. Make sure all data related file should be there with JAR. i.e excel file
Note : They always need JAVA in the machine regardless of what they prefer from above to use.
Usually i used to give as batch file script, if you have jenkins, integrate your bat file in it. other wise share the batch file as it is.
Create a package JAR,
Create .bat file to execute the JAR.

Cucumber with IntelliJ not finding step definitions

I encountered the following issue. I have four Cucumber feature files in IntelliJ. I added the Cucumber support via the IntelliJ plugin. After creating my features I edited my configuration like followed so i can execute the feature files.
Glue should be the name of the package the step definitions reside in. In my case the package is called stepdefinitions.
The following image shows what my project structure looks like. The feature files reside in /src/test/resource/features while the stepdefinitions are stored in /src/test/java/stepdefinitions.
Sadly when I try to run the cucumber features with the step definitions I get prompted "You can implement missing steps with the snippets below:" But I already did this. I already copied those snippets to the step definition files. When I hover a scenario IntelliJ tells me *Unimplemented Substep Definition".
Those two things lead me to the conclusion that IntelliJ does not find my step definitions. Maybe one of you knows what I am doing wrong.
I finally found the solution to my question. The error was caused by a plugin called Substep IntelliJ Plugin. You need to search for it in the IntelliJ Plugin Section and disable or deinstall it.
Try 'Invalidate cache and restart'. It worked for me - something the plugin gets stuck.
Disable the Cucumber plugin to avoid collisions over feature file association, install the Substeps plugin. See http://substeps.github.io/ for more docs on how to use the Substeps BDD framework alongside downloading a sample starter project from here: https://github.com/Substeps/substeps-example/archive/1.1.zip

Jade Agent using command lines

I am new to Java Agent DEvelopment Framework for developing Agents.
I used to work with Jade using Eclipse, I've created some agents I converted my file to .jar format. But now I want to test my .jar file by creating multiple agents.
How can I create one or multiple Jade agents using a command line ?
Please check the tutorials before asking such questions. Visit the Help Center and read about how to ask good questions.
But nevertheless,To create an agent using command the command line use:
java -cp lib\jade.jar;classes jade.Boot -gui -agents ping1:examples.PingAgent.PingAgent
java jade.Boot -agents "a:agents.AgentClass;b:agents.AgentClass".
Note that the classpath includes JADE classes (lib\jade.jar) and the previously compiled classes of the examples (classes). Note also that the value of the -agents option takes the form:
<agent-local-name>:<fully-qualified-agent-class>
Using JADE terminology, this is called an "Agent Specifier". More than one agent can be started by just typing several agent specifiers separated by a semicolon (';') as in the example below:
java -cp lib\jade.jar;classes jade.Boot -gui -agents ping1:examples.PingAgent.PingAgent;ping2:examples.PingAgent.PingAgent
From the perspective of your personal workflow it is probably not very comfortable to build the jar file each time you want to test your agents. The better way for debugging is to use the eclipse debug capabilities.
For this, place the jade.jar (and other required libraries) in your eclipse project. Further, configure the Java project to include these libraries in your project. After this you should be able to configure a debug configuration, where jade.Boot should be the main class, while the further Jade options (for agents or services) can be placed in the start argument tab (hope this rough description is enough).

Contents of .feature file isn't recognized in intelliJ

I wrote feature files in a project in IntelliJ according to the cucumber syntax. This files worked in another computer. I added the cucumber-java jar files and also installed the Gherkin and cucumber plugins, but still feature files aren't recognized as they should be.
What could be the problem?
So i use IntelliJ 2018
1) go to Preference
2)in open tab search "File Types" and search for text
3) in Text inside "Registred Patterns" delete "*.feature"
4) then search Cucumber Scenario and add "*.feature"
Steps I took to get .feature files recognized. I know that you've probably done this already, but it might help checking the steps again. If all fails, you could try to reinstall the plugins.
Created a new Java project
Created a new file with the .feature extension. Because the plugins were not installed, got the message "Plugins supporting *.feature files found." with the option to install the plugins
I didn't use this option because the suggested plugins were not what I wanted (check below image):
Instead, I've opened Settings > Plugins > Browse Repositories and searched for Cucumber for Java
When trying to install this plugin you will be required to accept the installation of Gherkin as well. Make sure that after accepting, both plugins are selected.
Restart IntelliJ and you should see the feature files recognized:
Hope it helps!
After installing plugin if you till face problem as i did, my feature files are not getting recognized because of groovy
therefore I manually set
File>>Settings>>Editor>>File Types
click "cucumber Scenario" and Click + to add .Feature in Recognize Patterns.
First make sure you have cucumber for java installed, if it is installed follow the below stpes,
1) Create a new feature file, like <test.feature> , after file creation a dialog box pops up
2) Select cucumber scenario in form the list and click Ok, there you GO.
Essentially two things are required to get cucumber feature recognized as expected type.
After adding cucumber-java dependency in pom.xml
You have to add Cucumber plugin also from >
Settings>Plugin>MarketPlace>Search for cucumber for Java and install it
This will also ask you to install Gherkin as a Dependency
Select Yes>> Restart ide
Now you have to change file type from settings >> to cucumber scenario.
Note: you wont be getting Cucumber scenario as recognized type until done above installation.
Select cucumber scenario and Add + wildcard for it as-*.feature

Is it possible to configure file types mapping in Idea via gradle 'idea' plugin

A little intro:
I work on a project with legacy codebase witch uses internal xml based descriptors with specific file extensions (about may be 10 extensions).
Let it be *.desc, *.check etc.
To have code highlighting for such a files I can configure Idea to consider these types of files as XML.
It's available through:
Preferences / Editor / File types
And then add all custom extensions to 'Recognized file types': 'XML'
Our project uses gradle as build tool
and my question is:
Is it possible to make same configuration via dsl of gadle 'idea' plugin?
The short answer is: No.
One could create a custom Gradle task that will modify IDE file type preferences XML file in the config directory. While it's possible to run such task automatically on the project refresh in IntelliJ IDEA, it will most likely not work since you can't modify IDE configuration when IDE is running (the changes will be reverted). So, you will have to run it from the command line, outside of IntelliJ IDEA when IDE is not running.
It's probably not what you want, but if documented, can be used by the team as the manual step to make this configuration change easier.
Using gradle idea is not recommended anyway.
A better way might be to provide your own IDE plug-in that will associate these file extensions with XML file type and instruct the team to install this plug-in.