how to send parameter to a dll with nunit command? - dll

I run through console a myProgram.dll with NUnit. I'd like the myProgram.dll I coded to receive a specific date which is a date to stop.
nunit-console myProgram.dll
I know I could achieve it by writing the date to stop in a text file and my function [Test] could read in the document. But is there a more direct way?

Related

Is it possible to have .net console application that embed another executable file?

I have a single command line windows executable that has many options built into this exe file.
Eg:
(It can take screenshot)
ToolGo.exe printscreen c:\temp\filename.jpg yyyymmdd
(It can show up)
ToolGo.exe showIP machineA
I want to write another command line application, possibly in .net , where it can embed/build a wrapper around this ToolGo.exe file into my application without the user be able to use the ToolGo.exe, and also users can only access one function of this main exe file.
In the example I want this other tool to access only the print screen function in this new exe file.
The new application will have this:
Tool2go.exe printscreen c:\temp\filename.jpg yyyymmdd
But if someone types the following, it will not work:
Tool2go.exe showIP machineA
Or
ToolGo.exe showIP machineA
Any ideas how I can write this code to do this in a .net command line application?
This is a multi-part question, so I'll just give the main part of the issue as the answer with suggestions on handling the rest.
You can embed a .exe into your program by clicking on Properties and navigating the the Resources section, and adding that .exe to it.
After that, it's just a matter of extracting it locally so you can pass your commands to it, and handle it's responses. (I'm not really aware of any way to do so w/out first extracting the. exe; the .exe itself needs to run somehow after all).
To extract the embedded .exe, you do this:
' Extract the MyProgram resource (i.e. your .exe)
Dim b() As Byte = My.Resources.MyProgram
' Write it to the user's Temp folder
File.WriteAllBytes(Environment.ExpandEnvironmentVariables("%TEMP%\MyProgram.exe"), b)
By extracting it to the user's Temp folder, you can pass it your commands, and since it's 'out of sight' the user probably won't even know it's there to directly use it themselves, unless they're a bit more advanced and visit their Temp folder often. You can slightly help to avoid this, but extracting the .exe when your program starts, and then deleting it when it exits, so it only exists on the user's system while your program is running.
As far as what the user can and cannot type in order to pass to the program, you can simply handle the filtering with your program; since your program is the one passing the commands to the .exe, just don't pass any commands that you don't allowed, and pass the ones you do want allowed.

Is there a way to re-run successful tests, from previous run, with google test?

Is there a gtest flag or any other way to re-run tests with google test that were previously successful ( and no change to any code).
It doesn’t seem that there is a specific option for rerunning tests.
You could run the test collection and generate a report in XML or JSON format. Then, you could parse the report, and create a --gtest_filter=... argument by joining the names of successful tests as a colon-separated string.
You could also imagine writing a custom test listener. This would need to write out successful test names to a file, and once again, you could write some simple code to generate the corresponding --gtest_filter argument.

How to get nunit console 3 to output failed and ignored tests (only) to text files?

I understand that nunit console 3 can write to TestResult.xml after running the tests, where the TestResult.xml is located inside the directory specified by --work parameter.
But from what I can tell, TestResult.xml contains too many (irrelevant) details, that I don't need to fix my unit tests errors. All I need is just the failed or ignored test cases, just like what is displayed in command line prompt when I am running nunit console in it.
How to configure the parameters for nunit console 3 so that it only gives me failed or ignored test cases?
Sorry, I'm a few months late (unfortunately I came across this problem only now). But as far as I searched, the only possibility is to use XSL transformation. There are some applications that can convert the XML report file, but... I tested a few, but unfortunately the output was not that was I need.
Therefore I created a simple NUnit3summary application that can transform the standard XML output file to text file. I was surprised that nobody until now made something like this (or at least did not publish it). It were only two hours of work (first working version) and a few more to finish it to stare ready for publishing.
It is only a simple application that was aimed for my needs. You can use filtration for now only with another application, e.g.:
NUnit3summary.exe TestResult.xml | grep Failed >FailedTests.txt
You can see a practical application here (this is also the project where the application was needed, because of too many errors in unit tests).

I am using msbiuild to call my itegrations tests using open cover. I want to append all the results into one XML file. Is this possible?

I am using msbuild to call my integrations tests using open cover. I want to append all the results into one XML file. Is this possible?
Currently I run open cover against each individual dll we have. This produces an xml file for each dll. Is there a way of just having all the results appended into the one file when running from opencover?
I would like to get all the results appended into the default test results .xml file.
You can use the -mergeoutput switch that allows the output of one run to be loaded and the data updated into the next run.
I used ReportGenerator to amalgamate all the OpenCover results and used the existing team city nunit reporter, to report on the nunit results generated. This gives me two reports from all runs. One with coverage and the second with just the nunit results.

Program Automation in Windows using VB.NET 2008

I am trying to automate a program using Visual BAsic.NET. The idea is to invoke my "Program" at the click of a button, pass inputs to the program and save the results it would generate.
For now I can invoke my program using VisualBasic.NET(comands: shell, appactivate), I can pass in data to the program( My.Computer.Keyboard.SendKeys("a")),( just that it is broken).
the main problem is that the data to be input goes into a form with multiple tabs and I am not able to figure out the best way to select the correct tab so that I can throw my data in there and get to the results
Can some one please help me with this.
Also is this program has a dll( obviously I am new to windows application programming), is there any way i can directly pass data to the dll and get results?
Thanks!
I think you need to look up reflection. A good starting point for me was
vbdotnetheaven