output_path not working in behat 2.4.0? - behat

I'm experiencing problems with HTML formatter and the output_path in behat. I'm using cmd:
behat --format=html --out=output.html --config /www/config/behat.yml test.feature
Simplified config (behat.yml) looks like this:
default:
formatter:
name: html
parameters:
output_path: /www/features/output
The problem is that no matter what output_path I set, the output.html is always placed inside same directory, where is behat.yml (/www/config). Can anybody see what am I doing wrong?
Thanks a lot for help!
UPDATE Behat v 2.4.3 use the output dir same as current dir (not the same as config), but still output_path parameter in behat.yml seems not working.

consider using the command line args and see if the issue still happens
for example:
/bin/behat --config=/pathToYML -f pretty,progress,junit --out path/to/output/file/for/pretty,,path/to/junit/output/file /path/to/behat/features/folder
The command line stuff seems to want all three if you don't specify something it will output to console which is why there are , , between pretty and path
This could hold a clue as to why you are having a problem if the command line wants more than one option by default you might need to configure your yaml for that as well.
Our shell script just feeds the command line what we want dynamically instead of doing guess work with yaml configs. Good luck

I had the same issue with behat 2.4.0, this was a known bug that was fixed on version 2.4.3.
Installation method #2 (PHAR) in the guide unfortunately only gives you version 2.4.0 at the time of writting... So in order to fix this you'll have to use the composer method #1.
Hope that helps!

Related

karate.callSingle not found .feature file in karate-config.js

I'm using karate v0.9.6, and it's wonderful tool.
I have a >1000 scenarios, each of them need to token for work, so i use callSingle in karate-config.js for creating and caching tokens. I use standalone jar file.
Part of my karate-config.js:
var auth_cfg = {
server: env,
credentials: karate.properties['credentials']};
var result = karate.callSingle('classpath:credentials/generate_tokens.feature', auth_cfg);
I'm using .sh file like this:
rm -rf target &&
java -Xmx2048m \
-Dlogback.configurationFile=cfg/logs_debug.xml \
-jar \
-Dcredentials=data.json \
karate-1.0.1.jar -e https://my-server/ \
--tags ~fixme \
--tags ~ignore \
--threads 4 \
features/services/simple_plan.feature
And, it's working perfectly on v.0.9.6 long time.
But, when I'm try to upgrade to v 1.0 or 1.0.1, a give an error:
org.graalvm.polyglot.PolyglotException: not found: credentials/generate_tokens.feature
I found this issue: https://github.com/intuit/karate/issues/1515
But examples not working for me. I'm trying use "file:" and karate.properties['karate.config.dir'] + '/features/auth/auth.feature'.
Always i got an error:
not found: credentials/generate_tokens.feature
Who else has faced this problem?
As you can see in the discussion of #1515 - this is why we'd really like more folks to try the RC versions and give us feedback (we spent months on this) instead of waiting for 1.0.
Yours seems to be an edge case where you are using the stand-alone JAR and a custom shell script.
My first suggestion is to use the -w flag. This is a new argument in 1.0 which can set the "current working directory", but it should default correctly in your case.
The second suggestion is to set the classpath for the JVM. Use this as a reference: https://stackoverflow.com/a/58398958/143475 - and once you do that, classpath: will work as you expect.
Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and I have to say that unless you can help us fix this, you may have to remain on 0.9.6 for a while. Sorry.
Peter Thomas, thank you for fast response!
I modify callSingle function, and .feature file wich called by callSingle - change "classpath:" to "file:"
karate.callSingle('file:credentials/generate_tokens.feature', auth_cfg)
,
# read credentials
* def authdata = read('file:credentials/' + credentials)
and it's works now. Before, when i change classpath: to file: i, probably made a mistake.
Thanks for so awesome testing framework!

"Unrecognized plugin: org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter" error every time I run test in intellij idea

I am getting the following error every time I try to cucumber test using the cucumber plugin in Intellij Idea. I am using the following version deaIC-2017.3.5. I even tried installing the latest version - ideaIC-2018.2.4 - but the issue still persists. Anybody has any idea why this could be happening?
Exception in thread "main" cucumber.runtime.CucumberException: Unrecognized plugin: org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter
at cucumber.runtime.RuntimeOptions.addPluginName(RuntimeOptions.java:171)
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:122)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:84)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:77)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:69)
at cucumber.api.cli.Main.run(Main.java:31)
at cucumber.api.cli.Main.main(Main.java:18)
In the "Run/Debug Configuration", update "Program arguments" replacing --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter by --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter
Let me illustrate how I encountered and found a way about to solve this problem.
I used to run my feature file by right clicking and run in intelliJ. Then I modified the program arguments in the edit configuration for that Run XYZ.feature file configuration.
In that process, I deleted the argument that passed " org.jetbrains.plugins.cucumber.java.run.CucumberJvm4SMFormatter" and added "--thread 5" something like that.
And then when I was done with wanted to revert to the old config. It wouldn't run and throw this error. My hunch is that maybe the arguments are not being passed properly?.
Anyway the solution (kinda hack) is to choose another feature file ABC.feature and edit the configuration for Run ABC.feature and change the location path of the feature file to XYZ.feature and change nothing else. Maybe could rename the configuration to Run XYZ2.feature something like that.This works for me.
This has worked for me: (intelliJ)
In the Program Arguments I have kept below line and it worked for me.
--plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^Login with valid credentials$"

casperjs.bat on windows fails with cannot find module cli.js error

I'm trying out casperJS to run some automated tests. On windows. I followed this installation guide but am stuck.
when I try to run a simple test from the command line like this:
casperjs.bat smoketest.js
I get the following error:
Error: Cannot find module 'C:/code/base/main/Shared/casperjs\modules\cli.js'
I checked, and the file cli.js does exist under the specified path.
I thought the problem could be the mixture of forward and backward slashes in the path, but I edited the bootstrap.js casper code to hard code the path and it made no difference - it still the cannot find module.
I'm have tried this using phantomJS version 1.9.0, and 1.8.2.
Anyone know what I am doing wrong?
Has anyone had success running casper on Windows?
This is due to a bug in PhantomJS 1.9.0 that does not allow for absolute path loading in Windows. Afaik, this should only be apparent if you are using a master build of CasperJS (v1.1).
This bug has been fixed, but is not yet in the Windows binary. You can compile it yourself if you'd like, but that can take quite a bit of time.
I was using the master build of casper. With the latest released version, 1.0.2, it works fine.

How do I run casper from within the phantomjs shell?

Anyone know if and how it's possible to run casperjs from within the phantomjs shell (a.k.a InteractiveModeREPL )?
I've also tried passing the direct path to the casper.js module and that has not worked either.
Progress/Update:
Tried phantomjs.injectJs('C:/casperjs/module/casper.js'); but got Error: Cannot find module 'colorizer' I guess I'm getting close.
This gets me closer but still missing path:
phantomjs.injectJs('C:/casperjs/module/bin/bootstrap.js')
errors out with Cannot find package.json at C:/package.json
OK, looks like I can pass the --casper-path option when starting phantomjs (see - casper/bin/bootstrap.js: line 189).
OK that worked. (passing the option did not work but setting the path inside of phantom did).
So to get this stuff to run inside the phantomjs shell first you need to set a casperPath variable in the phantom global object.
phantom.casperPath = "C:/casper";
Then you need to inJect caspers's bootstrap.js file.
phantom.injectJs("C:/casper/bin/bootstrap.js");
Now you can instantiate a casper object and play with it in the shell.
var casper = require("casper").create();
enjoy.

Hadoop configurations seem not to be read

Every time when I try to start my mapreduce application (in standalone Hadoop), it tries to put stuff in the tmp directory, which it can't:
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-username\mapred\staging\username-1524148556\.staging to 0700
It ties to use an invalid path (slashes should be the other way around for cygwin).
I set hadoop.tmp.dir in core-site.xml (in the conf folder of Hadoop), but it seems that the config file is never read (if I put syntax errors in the file, it makes no difference). I added:
--config /home/username/hadoop-1.0.1/conf
To the command, but no difference. I also tried:
export HADOOP_CONF_DIR=/home/username/hadoop-1.0.1/conf
but also that does not seem to have an effect....
Any pointers on why the configs would not be read, or what else I am failing to see here?
Thanks!
It's not that the slashes are inverted, it's that /tmp is a cygwin path which actually maps to /cygwin/tmp or c:\cygwin\tmp. since hadoop is java and doesn't know about cygwin mappings, it takes /tmp to mean c:\tmp.
there's an awful lot of stuff to patch if you want to get 1.0.1 running on cygwin.
see: http://en.wikisource.org/wiki/User:Fkorning/Code/Hadoop-on-Cygwin
I found the following link useful, it seems that the problem stands with newer version of Hadoop. I'm using version 1.0.4 and I'm still facing this problem.
http://comments.gmane.org/gmane.comp.jakarta.lucene.hadoop.user/25837
UPDATED: in Mahout 0.7 and for the ones who use the "Mahoot in Action" book example, you shoud change the example code as follows:
File outFile = new File("output");
if (!outFile.exists()) {
outFile.mkdir();
}
Path output = new Path("output");
HadoopUtil.delete(conf, output);
KMeansDriver.run(conf, new Path("testdata/points"), new Path("testdata/clusters"),
output, new EuclideanDistanceMeasure(), 0.001, 10,
true, 0.1, true);