how can i generate stepdefintion file from feature file in protractor (looking for something like specflow) - protractor

Have tried "cucumber gherkin full support" extension, but it gives option to navigate to a step not to generate step". Is there any way i can generate step definition from feature file directly?
enter image description here
strong textenter image description here

If you have not implemented your step definitions, Cucumber will warn you asking to create them with the template.
You can copy paste them and implement your logic inside it.

To generate the steps instead of running it through protractor you can add another command to in your scripts like
"cuke-test": "cucumber-js -r outputjs/pathtoyourstepdeffolder/*.js", and give it a dry run. It should give you the snippets for the unimplemented steps. The tidy gherkin extension in chrome is quite good too.

Related

How do I test a YAML form for problem reporting on a GitHub project page before I install it?

I'm a Git/GitHub beginner and don't know YAML (yet).
I found this about making an issue reporting form, but I'm sure I won't get it right the first try, so I need a way to run it as a test without inflicting it on the live project.
I searched briefly and didn't see any application that would open and render YAML the way I would use a browser for HTML.
What's the best way to approach this?
I'd normally create a new project or repo to test on and when happy, simply copy paste the final result to the project you want to have these enabled for real.

How to write multiple feature file and step definition file into Calabash project directory?

To write multiple feature files(.feature) and respective step definition(.rb) files for my current Calabash project directory. Here, My doubt is that
a. Do I need to create feature file manually by using text editor after default single feature file creation based on calabash cmd 'calabash-android gen'?
b. Should I use my IDE to add multiple feature file and step definition files into Project skeleton?(I'm using Visual Studio Code IDE)
a. For your first feature you can reuse the file that is created if you want to. After that you should create a new file for each feature you want to test.
When you execute the tests you will often only execute 1 feature test at a time while developing and perhaps only from a certain line number. So having the tests split in multiple fetaures works well.
You have probably read it but if not please take a look at the Github page.
b. You can create the files any way you want to. I normally copy an existing feature file through IDE and clean it. Personally I find JetBrains Rubymine to be a really good IDE for working with Calabash.

How to access the editor in vscode tests

I am creating a extension for VSCode that reformats part of the editor text.
How can I make a test for this.
I can't figure how to create a TextEditor inside the test to simulate a opened file.
The basic procedure for creating a TextEditor from within a VSCode test is to create a file, open it as a document, and show it. The act of showing yields a TextEditor that you can then manipulate within your test.
API references:
workspace.openTextDocument: Uri → TextDocument
window.showTextDocument: TextDocument → TextEditor
A good example to look at is the test in the VSCode sources for text editing: https://github.com/microsoft/vscode/blob/master/extensions/vscode-api-tests/src/singlefolder-tests/editor.test.ts
Note that that test imports module "utils", which imports "memfs", both in the parent directory. These provide (among other things) "createRandomFile", which is a randomly-named file in an in-memory virtual file system, thereby avoiding disturbing the actual file system.
The above is describing VSCode 1.37.1.
You should be able to open VS Code for your test file.
See this document: https://code.visualstudio.com/Docs/extensions/testing-extensions
Not sure if you can test against what you are looking for exactly though. You might just be able to check for errors, rather than test "is this UI element here?"

Mwe2 Workflow - modify variables at runtime

I'm trying to make a tool in which the users can choose a model for the mwe2 file and then the generated file to be placed where the user wanted (directory etc..)
My question is if the following can be done:
to dynamically change the model path and the output outlet path (at
runtime)
to run the mwe2 file at runtime (to don't need to go to press right
click and run as ..stuff)
Thanks in advance!
In the end I found that this cannot be done, but is another way to achieve the same result.
Found the solution here: create context-menu generator

How to apply an external formatting script to files in eclipse?

I'd like to run an external beautifier over my code that's open and replace the contents of the document with the output. Is there a plugin or something I can exploit to do this? I thought it would be a no-brainer under the formatter preferences, but it looks like you can only use internal templates.
One solution is the following:
Create an ant builder on your project. See this article about how to do that. The important things you should know after you read the article:
Add a new ant builder by right click on project and properties. See the implicit variables your ant script will have. The variables will contain one or more resource name and path. So be prepared for collections.
Filter the resouces in the "Build
options" tab. This is important,
since launching a JVM (or a new task
inside IDE JVM) for the change of
every file (filetype) is not so
fast. So filter resources to be
processed like this:
The third thing is to ask eclipse to refresh the resource after the script is run. Like this:
Set the target of the ant script to be run as automatic build (third option). You can set all the four anyway it will be ok:
Write your script. You will find the log of the ant script in console, and you may redirect the log into a file as well. You can see the option on the second picture. Start your script with an echoproperties tag to see what your script gets from eclipse.
I used such builders a lot, it works like it should. I like them. Good luck. Consider accepting your answers, 42 % is not too much :D