Running a specific browser NUnit test using the command line - nunit

I am trying to run the firefox only test using the command line for NUnit but not sure how to. The code is as follow.
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(ChromeDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
public class TestCases<TWebDriver> where TWebDriver : IWebDriver, new()
{}
No problem with NUnit GUI since it is separated, however requirements forces us to run it with the command line. Thanks.
I'm looking into like: nunit.console.exe /fixture:"value" /xml:.. etc.. or any other implementation
Thanks!

The best way I've found to do this is to specify a category with the driver such as: [TestFixture(typeof(string), "Chrome")]
Then you can specify the category on the console arguments with nunit-console.exe foo.dll /include:Chrome

Related

How do i run/import a downloaded command-line programm?

there is a command-line program called tcpvcon.exe
According to Microsofts website (https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview) it should be possible to access it the following way:
tcpvcon [-a] [-c] [-n] [process name or PID]
Do I have to import this executable somehow to be able to access its commands?
I am trying to write a small script, but I am struggling to access the program in a reasonable way that allows me to pass it arguments.
I am using Powershell.
Thanks
Edit:
I downloaded the program, executed it once and accepted the licence agreement. Now I would like to be able to use the above command in Powershell.
If I use it i get following error:
"tcpvcon" is not recognized as the name of a cmdlet...
Do I have to import the cmdlet somhow? I cannot find any information on this... It is probably a very simple fix and I just do not know the procedure.
Thanks again.

Want to activate a virtual environment from terminal with Octave/Matlab

I would like to execute a bash command to activate a virtual environment with Octave using Linux. What I actually want to do is run DeepSpeech using Octave/Matlab.
The command I want to use is
source $HOME/tmp/deepspeech-venv/bin/activate
The line of code I tried on my own is system("source $HOME/tmp/deepspeech-venv/bin/activate")
And the output I'm getting is sh: 1: source: not found
I saw this answer on a post and tried this command setenv('PATH', ['/source $HOME/tmp/deepspeech-venv/bin/activate', pathsep, getenv('PATH')]) but with no help it returned the same error.
It's not completely clear from your question, but I'm assuming you're trying to do is run python commands within octave/matlab, and you'd like to use a python virtual environment for that.
Unfortunately, when you run a system command from within octave, what most likely happens is that this creates a subshell to execute your command, which is discarded once the command has finished.
You have several options to rectify this, but I think the easiest one would be to activate the python virtual environment first, and run your octave instance from within that environment. This then inherits all environmental variables as they existed when octave was run. You can confirm this by doing getenv( 'VIRTUAL_ENV' ).
If that's not an option, then you could make sure that all system commands intended to run python scripts, are prefixed with a call to the virtual environment first (e.g. something like system( 'source ./my/venv/activate; python3 ./myscript.py') ).
Alternatively, you can try to recreate the virtual environment from its exported variables manually, using the setenv command.

Getting detailed version information of the executed program

I'm trying to get the version information of the executable from a crash dump. It's not that simple, so please read the whole question before you come up with an answer that does not work.
lm vm appname
Basically I can do lmv to get the version details, and that is exactly the information I want.
If you don't know how to get the version information of the executable, you can google a bit and get this answer, which suggests
lm vm appname (without .exe)
This works probably in 90% of the cases. However, it has the following two issues which I want to resolve in an automated analysis:
What is appname if I don't know the executable in advance?
In special cases like Notepad++, the module name is not notepad++ but rather notepad__
Now I can find out the executable name using |, but extracting the name of the executable from that output is not trivial.
Finding the exe in the list of modules
It is possible to find executables in the list of modules with a command like
.shell -ci "lmf" findstr "\.exe"
We can then extract the address and list the details with
.foreach /ps 9999 (exe {.shell -ci "lmf" findstr "\.exe"}) {lmva exe}
Still, there is a problem: .NET processes can load assemblies that are not DLLs but EXEs. In that case, the output might be wrong if the first result is not the main executable but a EXE loaded later.
List of modules
It is possible to get a list of modules using lm1m. And usually, the first one in that list is the executable.
It is then possible to extract the first line and get the details for it. A command looks like
.foreach /ps 9999 (exe {lm1m}) { lm vm ${exe}}
Unfortunately, it is not guaranteed that the executable is the first module. The modules are sorted by address. And IMHO it might happen that the executable is loaded at a higher address.
Question
How do I get lmv information for the main executable reliably.
Assumptions that can be made:
user mode crash dump of type /ma
only one process is being debugged
As mentioned in the comments by Jeroen Mostert, a suitable command might be
lmv a $exentry
This works, because lm is smart enough to accept address which are within a module. $exentry gives the entry point of the first executable.
You find the description in the pseudo register syntax:
$exentry: The address of the entry point of the first executable of the current process.
[Source: WinDbg help]
For the C# part, we can use the following piece of code for testing:
using System;
using System.IO;
using System.Reflection;
namespace exentry
{
class Program
{
static void Main()
{
var fullExe = Assembly.GetEntryAssembly().Location;
var path = Path.GetDirectoryName(fullExe);
var newexe = Path.Combine(path, "exentry2.exe");
File.Copy(fullExe, newexe);
Assembly.LoadFrom(newexe);
Console.WriteLine("Debug now");
Console.ReadLine();
}
}
}

Running the same Katalon test case with a different parameter

In our Katalon Studio project we have a test case.
We like that test case to accept a parameter from the command line when running the test suite.
For example, we like to run the same test case one time with parameter=A and another with parameter=B.
This will enable our Jenkins to run different tests without the need to duplicate test cases again and again.
Is there a way to do it?
Actually, you can't specify your parameters in the command line. But it seems to be in demand by the community (Katalon - How to pass user defined parameters from command line)
Solution :
You can define your parameters in profiles. Each profile can contains the same parameters with different values, and can be chosen during the Test Suite execution.
You can choose the profile you need manually or by passing it in command line. To do it you only have to use the -executionProfile option:
katalon -noSplash -runMode=console -consoleLog -noExit -projectPath="C:\MY_PATH" -retry=0 -testSuitePath="Test Suites/MY_TEST_SUITES" -executionProfile="Profile_A"
Finally, don't forget to convert your step input Variables into Global Variables where you need in your Test Case. You can do that manually or by script :
import internal.GlobalVariable as GlobalVariable
GlobalVariable.my_variable
docs: Katalon Docs - Execution Profile (v5.4+)
Hoping it will help you.
Like post above but in more way of showing where to look for the answers.
After You open Your Project, look for Profile :
Need to add to your script(it should be added be default be still remember if you will get error about missing keyword)
You are ready to make your "Build CMD"
From version 5.10, it is possible to override profile variables from the command line.
So, if you have a GlobalVariable.parameter=A as the default, you can add
-g_parameter=B
to the command line command to switch it to B.

NUnit console - when attempting to redirect output /err seems to have no effect

I've got an Nunit project with some tests and they all run as expected. Now I want to incorporate the running of these scripts automatically.
I'm trying to use some of the redirect options so I can separate the test output, but whatever combination I use, all I seem to get is the standard TestResult.xml. I can use /out:AnnotherOut.txt OK, but I'm really interested in capturing the error output using /err:TestErrors.txt.
Command line is:
(NunitConsole App) /nologo /framework:net-4.0 MyTestProject.nunit /include=Integration /err=TestErrors.txt