I have a lot of high level test cases.
I have the same keywords implemented for:
CLI (telnet)
WEB
Is there an easy way to run those test cases by not duplicating files, just passing a command line argument or something similar - to run these test cases for both CLI and WEB?
This problem can be solved in different ways and much depends on how you want to structure your test case base and scripts.
Start application. If you have specific resource files for your Web and CLI keywords with the same keyword names for the same checks/processing then remove the unwanted files before you start Robot.
Custom Import Keyword In addition to importing a resource file in the Settings section you can also import a resource file through a keyword: Import Resource. This has the added advantage that you can use variables to create the file reference. For example if you have a global with Web/CLI and seperated the files using a directory, then this can be the folder name reference.
Test Case Tagging By duplicating your test cases you can load all the keywords for CLI and Web. Their keywords should be unique, otherwise they will conflict. By adding Test Case tags you can utilize the tag filter feature when starting Robot to run only those test cases that have and/or lack certain tags.
Given that your test cases are unique test cases in the sense that they test different UI's I'd be enclined to seperate at test case level and use tags. Though there isn't a right or wrong way if you make a conscious decision.
As this closely relates to a solution maintaining settings for different environments, please keep that in mind as well.
Related
I've a list of features files and the list of the related step definitions. Every feature file refers to some specific functionality of the website.
According to some environment variables defined in package.json and representing the theme of the website, I might need to skip entirely some of the feature files (and obviously their step definition), due to missing feature for some specific theme.
To give some code examples:
"test:cy:run:daylight": "PORT=9000 CYPRESS_THEME=daylight cypress run",
"test:cy:run:darkness": "PORT=9001 CYPRESS_THEME=darkness cypress run",
feature files list:
daylight.feature
afternoon.feature
evening.feature
night.feature
with the relative definitions:
daylight.spec.js
afternoon.spec.js
evening.spec.js
night.spec.js
So in case of CYPRESS_THEME=darkness I would like to skip entirely from my testing process the features evening.feature and night.feature
How to do that? Ideas?
This example is with fake data, my real scenarios includes many more features and themes, so unluckily splitting test in different folders or using Cypress tag is not an efficient option.
Another not efficient idea I am thinking of is to put conditionals in every step definition Given, When and Then with the help of the detection of the Cypress.env('THEME') but obviously I would prefer not to follow this approach.
Anything else? Thanks
The correct answer would be to tag the tests and run only specific tags... if such a feature existed. I believe #mosaad is wrong on his second point; the --tag command line parameter merely adds meta data to the run from what I understand. It doesn't restrict which spec files get run.
If I were you I'd just try to get creative with your folder structure. Alternatively you can implement this person's workaround, which seems a bit heavy to me but probably gets the job done.
You can split tests into 2 folders and run only the files in this folder
cypress run --spec "cypress/integration/daylight/**/*"
Or you can use tags and run tests with the correct tag
cypress run --record --tag "daylight"
I need to write a plugin that needs to create table in database and some setting from installation form. I can easily create form but I have difficulty to run the script after installation to read options and create table. Is it possible at all to run such simple script or maybe you need to create everything like for example models, vehicles and so on?
I would appreciate if anyone could give me directions how to do it. Modx documentation is not clear about this and https://github.com/splittingred/Doodles/tree/production sample repo contains multiple elements I'm not familiar with and I believe don't need at all
Typically you'd use a resolver to run code after the install.
While in the question comments the setup options are discussed, the package attributes there are actually executed to generate the setup options form, not to process the results.
The docs are a tad dated (mostly the screenshots), but Creating a 3rd party build script explains the different parts of a build script, and what they're for, with a fair bit of examples.
The piece you're looking for is this:
$vehicle->resolve('php',array(
'source' => $sources['resolvers'] . 'setupoptions.resolver.php',
));
You'll need to have a $vehicle (perhaps from a category or other object you're adding to the build) and the file in the provided location. Inside the resolver file you can use $object->xpdo as an instance of the modX class to do your thing.
I have been following the steps outlined here: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/importing-resources-with-your-themes
My custom structures and templates are being imported. The problem that I have is that I also want to define an ADT to be imported. Nothing happens when I create the directory structure outline here:https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/creating-plugins-to-share-structures-templates-and-more
Is the "templates-importer" standard deprecated? Can the "resources-importer" and "templates-importer" not be used at the same time?
I don't see any exceptions in the log and there's nothing to indicate why the ADT is not being imported. I have checked in the site template that is generated and in the global site.
Suggestions? Do I really need to create a hook to import the ADT?
You can use only one of those two, but they share common code and functionality (here are if...else statements responsible for chosing one of). If you use Resources Importer already, you can add your ADT's to resources-importer folder (in the same way it is done within templates-importer) and it will be imported as well.
I have a hook project which resources-importer which contains (among others) 4 ADTs. They are located in the following folders:
resources-importer/templates/application_display/asset_category
resources-importer/templates/application_display/asset_entry
First one is imported as ADT for Categories Navigation portlet and second for Asset Publisher portlet.
Do I have to use Given, And, Then, etc... when I am doing a step definition?
For example in my feature file I have Then I login to the app in one scenario. In another scenario I have And I login to the app.
I don't like all the Then And Given 's in step definitions. Is there a way to not have to specifically use these keywords and use some sort of wildcard? I've thought about just using When in step definitions. I just hate mixing all these keywords when they don't really matter anyway.
I wish I could define the step in my step_definition file without having to use various (meaningless) keywords in front of it.
If you want to change this in your feature file, instead of using one of the step definition keywords (Given, When, Then, And, But) you can use an asterisk (*) in your feature file as a sort of bullet point. Example
Scenario: Test Scenario
* run a sample step
* run a different sample step
This will generate
Given(/^run a sample step$/) do
pending # express the regexp above with the code you wish you had
end
Given(/^run a different sample step$/) do
pending # express the regexp above with the code you wish you had
end
Also, Gherkin supports adding languages, this uses a JSON file to define the keywords for the step. This could be used to change what keywords were used for step definitions.
You could fork Gherkin and clone it. Then edit i18n.json to add a new language which uses whatever keywords you wanted instead of these. It currently supports pirate for example. After this you would either have to submit a pull request for them to add the language definition to the project or build Gherkin yourself from the cloned fork (https://github.com/cucumber/gherkin/blob/master/README.md)
Here is the reference page for adding a language
https://github.com/cucumber/cucumber/wiki/Spoken-languages
I'm trying to automate a process for our documentation team. They have a pretty big batch of framemaker files across several books and use RoboHelp to generate EclipseHelp for two different versions of our project.
Each framemaker file has the appropriate tags set to indicate which version a particular piece of documentation applies to. Currently the writers modify the conditional build expression to specify the correct set of tags and run File->Generate->EclipseHelp each time. I can run the generation process just fine, but I can't figure out how to change which tags it's using.
I've read through RoboHelp's scripting guide and the only references I can find to Conditional Build Tags is the ability to create and delete them. I can't find any references to Conditional Build Expressions. Does anyone know any way to modify it from a script? Alternatively, if someone can suggest a different way of organizing RoboHelp/Framemaker that is more conducive, I'm all ears, though I have basically zero familiarity with either.
The Conditional Build Expression forms form of your EclipseHelp Single Source layout. As such your script needs to refer to the tags there.
I'm going to answer with what I found - even though it's only a partial answer - just in case it can help someone, or possibly give someone enough to figure out a more proper answer.
Basically I found that each Single Source Layout has a corresponding *.ssl file. If your layout is called OnlineHelp, it will be (in my experience) OnlineHelp.ssl and will be in the same directory as your .xpj file. The ssl file is just a bunch of xml and has some number of sections. One of the sections will have the same name as the content category where you would go in the UI to change the Conditional Build Expression. In that section is an element named "BuildExpression". Set that to whatever you need and reopen your RoboHelp project. It's a bit of a hack, but I set up a groovy script to do that before running my ExtendScript and it gets the job done.