Some of my tests needs something like
{EXECUTION_ENVIRONMENT}.arguments.separate_character_option_value ('l')
to be attached (not Void), how do I set commandline arguments to eiffel autotest?
At the moment there is no support to run Autotest from the command line and pass arguments, we are looking into it.
So, for now, It's possible to launch test cases from the command line using something like
ec -config testing.ecf -tests
but there is no way to filter test cases or even pass command line arguments.
But there is a workaround
You can set environment variables before to run the test cases from the command line or EiffelStudio IDE.
Define all the environment variables that you need to mimic the arguments
export ARGUMENT_C=my_value or set ARGUMENT_C=my_value.
Call the test cases from the command line or IDE
ec -config testing.ecf -tests
The test cases that need to get access to these values need to do something like this
if attached {EXECUTION_ENVIRONMENT}.get ("ARGUMENT_C") as l_val then
-- do something
end
Hope this helps
Related
I'm trying to add some variables into Python virtual environment activate.bat.
I supposed it's a regular BAT file with pretty expected behaviour. But what I see is weird.
set env=abc
set db_url=dfg
If I do echo %env% after in the command prompt I see:
abcset db_url=dfg
Who can explain why is that and how to fix it?
Also, if I try clear it up like
set env=
it just reads all the strings after.
UPD: Okay, I don't know what I've done but what worked:
I recreated the virtual environment
I opened all files in VS Code (not in Notepad++ as before)
I put all the variables sets into double quotes like set "env=dev"
I'm using dotCover command line tool to run coverage on some Tests.
In order for it to run it needs to receive as arguments the path of the "Target executable" which in my case is Nunit and "Target Arguments" which is in my case are the arguments I pass to Nunit.
The thing is that one of the arguments I pass to Nunit is a path with white spaces. And when I pass the arguments of Nunit to dotCover it is also surrounded with quotes because it has white spaces.
So, for example to run the tests simply on nunit I run the command:
"%NunitDir%\nunit-console-x86.exe" /nologo /noshadow "%DllDir%\Tests.dll"
/config=Release /domain=%Domain% /xml=%resultDir%\NUnitTestResults.xml
and to run coverage on tests I need to run something like:
set NunitArgs=/nologo /noshadow "%DllDir%\Tests.dll"
/config=Release /domain=%Domain% /xml=%resultDir%\NUnitTestResults.xml
%dotCoverDir%\dotCover.exe cover /TargetExecutable="%NunitDir%\nunit-console-x86.exe"
/TargetArguments="%NunitArgs%" /Output="%outputDir%\NUnitTestResults.xml"
The problem is that NunitArgs already contain quotes, and when I run the dotCover command it only read the arguments from first quotes to the second quotes.
Try /TargetArguments="%NunitArgs:"=""%" or even /TargetArguments="""%NunitArgs:"=""%""".
Read How Command Line Parameters Are Parsed by David Deley © 2009 (Updated 2014) (especially Windows®: 4. Everyone Parses Differently). Good luck!
As I Know , in cmd , when we want to switch drives we write "[drive]:" exemple :
when we want to switch to D:\ we type
D:
and i try this and it work .
But now , I want to apply this process in my C program , so I used the famous "system " command and i type :
system("D:");
and i have some code after that , when i try to execute it , it write
the specified path was not found.
so i tried to see if the system comand really work and i add another system comand like this :
system("chdir");
to verify the working directory and when I execute it , it show me the path of the executable that's mean that the system("D:"); dont work.
any solution please
Probably because system() starts a new instance of cmd.exe, which runs your command and then exits. Thus, it doesn't hold state between invocations, unlike when you run a single instance and give it multiple commands interactively.
One way of working around this is hinted at by cmd.exe's help text:
Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes.
So, you should be able to run a command like "d: && chdir" to do both operations in a single invocation of cmd.exe.
I'm trying to create a GNU like configure script for Windows in a batch file. It seems to work ok so far except depending on the order options get ignored and in particular with the '--with-smtube' option it sometimes gets the path but again depending on the order causes it to result in:
test.cmd --enable-portable --with-smtube=C:\svn\smtube
configure: error: unrecognized option: `C:\svn\smtube'
Try `--with-smtube --help' for more information
(supposed to also say Try `test.cmd --help)
I copied the structure from another script I found but not having success. The order of arguments shouldn't matter and arguments can be omitted (all or some). Can someone steer me in the right direction?
The script is for a Qt program, it uses command prompt as the shell and not msys or cygwin or anything like that.
This is what I have so far: http://redxii.users.sourceforge.net/test.cmd
In Oracle you can use &&VAR_NAME in a script and then the script will ask you for that value when you run it.
In SQLSERVER you can use $(VAR_NAME) and reference a property file using:
:r c:/TEMP/sqlserver.properties
And in the property file you have something like:
:setvar VAR_NAME_some_value
Can you do the equivalent of &&VAR_NAME so the script asks you for the value when you run it instead of having the value predefined in a script.
If I've understood correctly, you're talking about variable substitution with the SQLCMD utility.
I don't see that SQLCMD supports the behaviour you describe.
An alternative would be to exploit the fact that SQLCMD will substitute the values of system or user environment variables (see the link above), and create a wrapper CMD script which prompts the user for the variable value(s) using SET with the /P flag.
There is nothing in sql server like this, you should predefine all parameters values before using them, like this:
DECLARE #i SMALLINT
SET #i = 1
The problem with having a form pop up and ask you for the parameter is that you normally want rather more control over the nature of the form, even for an admin script. I'd use the variable substitution in SQLCMD, from within a Powershell or Python script so you can provide the guy running the script a better and more helpful form. That would make a very powerful combination.
You can do quite a lot with template variable substitution in SSMS, but that would only go so far as formulating the correct SQL to execute. you'd then have to bang the button. It would be a bit clunky outside the development environment!