Pass parameters to #Cucumber.Options dynamically - selenium-webdriver

I am using cucmber+selenium. Is there a way i can pass options to #Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature" // i want to take this feature file names from excel & put here...

One way of setting it is through the System.setProperties() method.
Say, if my resources/features folder has all the necessary features, I can simply instruct Cucumber to scan for all the features in the folder like,
String features = "/src/main/resources/features";
System.setProperty("cucumber.options", features);
Also, you can instantiate your RuntimeOptions dynamically like
new RuntimeOptions(features);

You could code something simple by passing command line parameters and retrieving them using ENV['xxx'].
Please see this post

Instead of using Junit, use TestNG to invoke feature files. The flow goes like, Read from Excel and with the data generate testng XML suite dynamically to invoke each feature file. Please find the reference below,
https://github.com/sahajamit/cucumber-jvm-testng-integration

Related

how to customize export data(listview) SuiteCRM

I am able to customize if i write create_export_query() in main modules(modules/Leads/lead.php)
but I want this should be upgrade safe code,
can we add create_export_query() method in custom path instead of in lead.php
if so in which file we can add this function other than main module location?
custom/modules/Leads/lead.php will work?
thanks
Naren
custom/modules/Leads/lead.php will not work until you change beanFile location into main bean.
There are 2 ways to do this.
1) Make an extension, custom/Extension/application/Ext/Include, make
a new file CustomLeads.php, put your custom BeanFile location here
for lead module.
2) As export is certainly an action,you may create a custom
controller,ie custom/modules/Leads/controller.php, create a new
function action_export, put your custom code there.
Overriding bean of Suite core module is not recommeneded as it may crack whole system at any point. You should go with #2.

Is it possible to create demodata for Draft.js?

We are using the draft editor and convertToRaw and convertFromRaw to save and load state from our DB.
For our testing I use factories to create demo data. And want a simple way to generate test data. Simple text is fine.
Is their a function hidden in the library that can help me out?
ideally I could call
textToRaw(`Here is some nice text`)
and that would output something like:
{\"blocks\":[{\"key\":\"4tu7v\",\"text\":\"Here is some nice text\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{}}
you only need blocks and entityMap. that is simple I think.
convertFromRow({blocks: lines.map(line=>{type:'unstyled', value:line}), entityMap:{}})

How can I download a PDF file from a form using UI designer?? Bonita

The thing is I have found how upload a document and after that downolad it. But I just want to download it. I want to do it using the UI designer but I dont know how to do it.
Thanks :)
I dont know which tool are you using to design your UI, anyway this is concerning functionality, not design. In that point, i need to know wich language do you want (or can) use. For example, in PHP, it's very simple, you can make something like:
(create php file) downloadpdf.php
1st: (if you want to generate pdf "on the fly":
<?php
function download($foo){
content headers (type, force-download, etc)
database select to get data or harcode it.
echo data
}
?>
and call this function with some id to select from database or something (ignore if you want to hardcode it)
Other option to download a file, if it's stored on server is making a link to this file (statically or dyamically). If you wanna take control to file downloads, check this post:
http://www.media-division.com/the-right-way-to-handle-file-downloads-in-php/
I don't mean that it can be done with UI designer tools, and it's not concerned if it's from a form or not.
Cheers!
You should create link and variable which type is javascript expression. On Variable value write
return "/bonita/portal/" + $data.context.mainDoc_ref.url;
On link URL write your variable and to text
Download: {{context.mainDoc_ref.fileName}}
Here you can find excellent example for this case

Close method not working in Office

Im trying to use Microsoft.Office.Interop.Word._Document.Close() in a .net 3.5 windows form app.
No matter how much I search here and on Google I cannot find the correct parameters to put in the Close method.
I am using version 14.0.0.0 of Microsoft.Office.Interop.Word and I would like to close the document without saving and ideally ensure that the application can isolate the document thread so that users can still open word documents outside the running application.
See the Close method of the Document class described in MSDN. If you need to omit the parameter and use the default value - pass the Type.Missing parameter.
Try this:
object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
object missing = System.Reflection.Missing.Value;
_Document.Close(ref doNotSaveChanges, ref missing, ref missing);
This is the source
I'm not sure if you'll need the middle line or not. It's not from the original source it's from here

Cakephp excel report using XLS helper gives an warning message in windows and displays entire xml structure in open office

I'm using cakephp XLS helper to generate Excel report in my project.
But the generated file is giving warning message in windows system as below.
Similarly the same file displays the entire xml mark-up in open-office on linux as below.
Part of the view file code is as below.
$xls->setHeader('Report_'.date('Y_m_d'));
$xls->addXmlHeader();
$xls->setWorkSheetName('Enrollment Report');
//1st row for columns name
$xls->openRow();
$xls->writeString('ID');
$xls->writeString('Zipcode');
My Client wants a proper excel report with-out any warnings in windows.
Please suggest me any excel helper for cakephp which will generate proper excel file on all the platform and different application.
Your problem is that you are using a helper that puts your data in xml format. Excel can read XML and HTML but with a warning. You should use the one that Ivo suggested in the comments. LINK
This helper really makes an xls valid format, that complys with open office and office. Also, this helper relies on PHPExcel class that is constantly updated here so your code will be easy to upgrade if needed.
Remember to follow instructions given in the helper page.
I've tried a lot of this xls helper for cakephp, but neither one work as expected, either outdated or create xml o html tables or didn't work at all, haven't tried this one though... still creating a helper using PHPExcel shouldn't give you much trouble, you may use this tutorial as a how to base to modify the helper.
I think you need to set the mime-type. This has happened to me in the past and it was when the mime-type of an older excel helper was set to an out-dated value.
The code from the linked (by Ivo) helper has the following:
function _output($title) {
header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment;filename="'.$title.'.xls"');
header('Cache-Control: max-age=0');
$objWriter = new PHPExcel_Writer_Excel5($this->xls);
$objWriter->setTempDir(TMP);
$objWriter->save('php://output');
}
I would make sure you are:
a) using the newest helper (http://bakery.cakephp.org/articles/melgior/2010/01/26/simple-excel-spreadsheet-helper)
b) that the mime-type is actually set.
c) that that specific mime-type is accurate.

Resources