IDE PyCharm professional, python 3.4.5, behave 1.2.5, environment Windows 7;
Note: I am running the command from the feature file directory;
When I attempt to execute a feature file using the behave command syntax (ex: behave home_page.feature); the behave interpreter response with the following message 'invalid command name 'home_page.feature'.
What might be causing behave interpreter to parse a feature file as a command name? Would this be an environmental issue?
This was not an issue with the community edition 'Free' of PyCharm (I did upgrade to Professional to get full access to the Behavior Driven Development (BDD) features in the professional version of PyChram).
FYI, behave has a --help argument to list available commands
You can't simply call behave home_page.feature
Doing so, behave (or any command line executable for that matter) thinks that home_page.feature is an argument itself
Instead behave uses the -i or --include arguments to search for feature files matching the provided regular expression
So instead, run behave like so behave -i home_page
Alternatively, you can add tags in your feature file with #TAG_NAME
You can then run those specific tags using -t or --tags arguments
Tags are helpful when you want to run a specific scenario of many scenarios in a feature
See https://pythonhosted.org/behave/behave.html for more information
Related
I have Python 3.10.7 with the follwing packgaes installed using pip install in command line:
behave 1.2.6
selenium 4.4.3
These have also been added to the packagelist of the project using the project config in pycharm
Also behave is in the systme path as well along with python.
I am trying to use the behave command but I am getting the following error:
behave : The term 'behave' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ behave features\myfeaturefile.feature
Following is my project directory:
Following is my project in pycharm:
I need help in fixing this problem as I am new to this tool. Thanks
First check if you have behave and python in the path variables.
Check if you can execute the below command
C:\demo>behave -h
If this does not return a list of help commands associated with behave, this means that behave is not in the path variables
Alternatively, you can check it via cmd using the "PATH" command. This will show you all the entries in the system path
C:\demo>PATH
PATH=C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin...
If behave or python are not in the path variables, you can set them using
set PATH=%PATH%;c:\PATH_TO_BEHAVE
NOTE: Setting path using cmd is only valid till the time the cmd window is open. Once you close it, the path variable will be rest to original values.
Behave, along with a few other .exe files is sitting in the:
C:\Users\chauhany\AppData\Roaming\Python\Python310\Scripts
As per your instructions #Manish Agarwal, I added the C:\Users\chauhany\AppData\Roaming\Python to the PATH from the command line and re-started the machine. But it didn't help. I then moved the behave.exe from the above location to my python 3.10 directory which is sitting in C:\Program Files\Python310 and python is in the system path, and restarted my machine again.
I then deleted and recreated my project with the new feature file (same directory structure).
If I now run the same command, that is, features\myfeaturefile.feature from
C:\Users\chauhany\PycharmProjects\martechBehaveProject>
I get a FileNotFound error
So I went to the folder where the file is actually sitting that is:
C:\Users\chauhany\PycharmProjects\martechBehaveProject\features\steps> and then re-ran the command and it worked.
I was under the impression that if you have just one feature file you don't have to specify the actual feature file and it can be run from anywhere in your project i.e., from any location which certainly is not correct.
Here is the error when I type "hbase shell"
*:\hbase-2.5.0\hbase-config.cmd"' is not recognized as an internal or external command, operable program or batch file. \Java\jdk1.8.0_261\lib\tools.jar was unexpected at this time.
and here comes another error when I type "start-hbase.sh"
The file does not have an app associated with it for performing this action. please install and app or if already installed, create an association in the Default Apps setting page
Seems like you are on windows (correct me if I'm wrong).
Your first command seems to come from an installation issue. The shell can't seem to find hbase-config.cmd. Make sure you followed the installation instructions properly and everything is where it's supposed to be.
As for the second error, you can't run bourne shell files (.sh extension) on windows.
It would be best you link the tutorial/documentation you followed in your original question, and add more information about your directory structure.
I'm using gatling 2.2.3 and I'm following the Quickstart guide. I've got it all working up until the point where I can run the scenario.
Instead of allowing me to select the simulation I want to run I'm getting this output:
U:\>%GATLING_HOME%\bin\gatling.bat
GATLING_HOME is set to "C:\Users\name\Downloads\gatling-charts-highcharts-bundle-2.2.3\"
JAVA = "java"
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
It seems like it's trying to execute some Java command which isn't done properly. Does anyone know how I can fix this?
What this folder is:
U:>%GATLING_HOME%
Be sure don't have blank spaces in it
I have this line code in my file .pl
system("./read_image http://echopaw.fr/wp-content/uploads/2015/09/animals-41.jpg");
read_image is a C executable file, it works well in command line, but when I run my .pl file in web server, this line didn't work, its function is to write some data into a file, so I can see if it works
I also tried `` , but it still didn't work
anyone gets some ideas?
I think it's because when your webserver runs your CGI then it does so from some wierd directory (/var/www/htdocs or / or whatever). Then your read_image is also expected to be in that directory because of the ./read_image.
./ means current directory, which is not necessarily the directory where your .cgi is located.
I'd suggest using the Perl module FindBin:
your cgi:
...
use strict;
use warnings;
use FindBin;
...
system("$FindBin::Bin/read_image http://echopaw.fr/wp-content/uploads/2015/09/animals-41.jpg");
$FindBin::Bin resolves to the path where your .cgi is located -- no matter where you call it from. It's a quite handy module and can also be used to pimp the #INC path to find your own modules:
use lib "$FindBin::Bin/../lib";
use MyModule;
This way MyModule.pm is expected to be in $current_script_path/../lib. Very convenient.
Addendum
As the discussion evolves this is apparently not only a problem of whether apache can or cannot find the read_image command but also of whether read_image in turn can find the wget command which it tries to execute.
As #CDahn already noted in a comment apache runs CGI scripts and the like with a limited environment for security reasons. If you run read_image from your shell, then you have a fully working environment with, say, PATH including 15 different directories (like /usr/bin:/opt/bin:/usr/share/bin:/usr/local/bin:..., whatever). When apache runs your scripts, PATH may only contain 2 or 3 directories that are absolutely necessary, e.g. /usr/bin:/usr/local/bin. The same applies to other environment variables.
You can verify this with a little .cgi script that simply echoes the current environment, like
while (my ($key,$value) = each %ENV) {
print "$key=$value\n";
}
(Taken from http://perldoc.perl.org/functions/each.html)
Call this .cgi from your browser and you'll see the difference.
When your read_image cannot find the wget command then probably because wget is located in a PATH apache doesn't know of. Instead of teaching apache about the additional directory (bad idea), I would give the full path to wget command in your read_image program. From your terminal window run
$ which wget
/usr/bin/wget
and use that very path when calling wget from your read_image.
I am trying to do the equivalent of the following Linux command with a Windows batch file and TortoiseSVN.
svn info > info.txt
I have tried the following with no luck:
start /wait "" "c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:info >> %CD%\info.txt
I am running Windows with TortoiseSVN v1.6.16 so I don't have access to the command line tools.
Note: We were encountering issues with the newer version of TortoiseSVN so we went back to 1.6 until issues are resolved with a newer version and the company upgrades the server to that version.
Your construction didn't work, doesn't work and will never work due to zero-bits of trueness:
start (with and without /wait) have sense in bat-file only if you have more than one bat-process starting from this bat (compare with call), for called GUI it doesn't differ from direct using program-name
TortoiseProc is GUI-app after all, it emits nothing to stdout
Info was and is unknown command for TortoiseProc, thus you'll get only GUI-window "About"
:about Shows the about dialog. This is also shown if no command is
given
In addition to correct suggestion "Update to at least 1.8 on client and have CLI-tools" you can consider following solutions:
Install from unrelated to TortoiseSVN sources pure CLI SVN-client (also 1.6.* - from WanDisco will be good choice) at the same as TSVN or another location (I done it at the times of 1.6)
Study and use subwcrev (it was part of TortoiseSVN even in 1.6, AFAICR) and emulate some part of svn info in subwcrev's template-file with correct keywords