How to send result file after all tests run in nunit console c# - selenium

Is there a way to send a mail with result file (I set this file in console command with option --result) after running.
I have run my selenium test cases in following way
How to Schedule Selenium Web Drivers Tests in C#
The result file was created after OneTimeTearDown function.
If sending an e-mail into OneTimeTearDown function - the result file comes incomplete
Thanks in advance
Sangeetha P.

I'm not sure I'd actually recommend doing this - but I think it's possible. Personally, I'd instead handle the email sending outside of the NUnit console, in a separate script in your CI System.
Anyway. You could achieve this by writing your own ResultWriter extension. Take a look at the implementation of the standard NUnit3XmlResultWriter as an idea - you'd essentially want the same thing, except to send the file by email, rather than write a file. (You may even want to make your ResultWriter actually inherit the NUnit3XmlResultWriter class.)

Related

How to send Automation Result mails from Testcomplete Jscript

I need to send automation Result to devlopers which is automatically from test complete is there any possibility method there
In TestComplete 12.50, you can send results via email. The log of the entire test run or any of its children logs via:
Quick sending from the log context menu
Sending from scripts
Sending from keyword tests
Last two methods allow you to send, during the test execution.
Result to developers which is automatically
Ideally the CI employed should provide you with a mechanism to support the reporting activity. Basically, in your case, you have to follow two steps:
Use methods of the slPacker object to pack the test results to a file (it is easier to manage a single file then a group of files). You can call these methods from a keyword test, for instance, via the Call Object Method operation. There is more details on how to pack results, in Archiving results from tests.
Write script code that will send the test log. JScript snippets here.

How to prompt user in a Gherkin test?

We are using Gherkin/Behave (in Python) to test an embedded application. The Gherkin code is executed on a server while the actual activity is performed by an application on the device, communicating over the network. The application on the device needs to be started manually.
I need a test to reboot the device. I can get the test application to perform a reboot, but then I need the code on the server to prompt the user to restart the test app so that the test can continue with subsequent steps. However I cannot get the Python code in the "steps" file to output any text.
I appreciate that Gherkin/Behave is meant to provide fully automated testing, but real world restrictions apply here.
for formatter in context._runner.formatters:
formatter.stream.write("Your message here\n")
formatter.stream.write("\n")
The extra newline is needed because Behave prints a description of the step first, then overwrites it in green if it passed. The extra newline ensures that this overwrite overwrites a blank line rather than your text.
Note that when I tested this I was using the default "pretty" formatter. I don't know how well it will work with other formatters.

SoapUI with Groovy Script calling multiple APIs

I am using SoapUI with Groovy script and running into an issue when calling multiple APIs. In the system I am testing one WSDL/API handles the account registration, and returns an authenticator. I then use that returned authenticator to call a different WSDL/API and verify some information. I am able to call each of these WSDLs/APIs separate but when I put them together in a Groovy Script it doesn't work.
testRunner.runTestStepByName("RegisterUser");
testRunner.runTestStepByName("Property Transfer");
if(props.getPropertyValue("userCreated") == "success"){
testRunner.runTestStepByName("AuthenticateStoreUser");
To explain the first line will run the TestStep "RegisterUser". I then do a "Property Transfer" step which takes a few response values from "RegisterUser" - the first is "Status" to see if it succeeded or failed, second is the "Authenticator". I then do an if statement to check if "RegisterUser" succeeded then attempt to call "AuthenticateStoreUser". At this point everything looks fine. Though when it calls "AuthenticateStoreUser" it shows the thinking bar then fails like a timeout, and if I check the "raw" tab for the request it says
<missing xml data>.
Note, that if I try the "AuthenticateStoreUser" by itself the call works fine. It is only after calling "RegisterUser" in the Groovy Script that it behaves strange. I have tried this with a few different calls and believe it is an issue calling two different APIs.
Has anyone dealt with this scenario, or can provide further direction to what may be happening?
(I would have preferred to simply comment on the question, but I don't have enough rep yet)
Have you checked the Error log tab at the bottom when this occurs? If so, what does it say and is there a stacktrace you could share?

Send Jenkins notification only when new test fails

I have Jenkins project that perform some sort of sanity check on couple of independent documents. Check result is written in JUnit XML format.
When one document test fails, entire build fails. Jenkins can be simply configured to send email to commiter in this situation. But I want to notify commiters only when new test failed or any failed test was fixed with the commit. They are not interested in failed tests for documents they have not edited. Email should contain only information of changes in tests, not full test report. Is it possible to send this kind of notification with any currently available Jenkins plugins? What could be the simplest way to achieve this?
I had the same question today. I wanted to configure Jenkins sending notifications only when new tests fail.
What I did was to install email-ext plugin.
You can find there a special trigger that is called Regression (An email will be sent any time there is a regression. A build is considered to regress whenever it hasmore failures than the previous build.)
Regarding fixed tests, there is Improvement trigger (An email will be sent any time there is an improvement. A build is considered to have improved wheneverit has fewer failures than the previous build.)
I guess that this is what you are looking for.
Hope it helps
There's the email-ext plugin. I don't think it does exactly what you want (e.g. sending only emails to committers who have changed a file that is responsible for a failure). You might be able to work around that/extend the plugin though.
Also have a look at the new Emailer, which talks about new email functionality in core hudson that is based on aforementioned plugin.

Selenium Test Suite: differing paths to test cases

I have a test suite that does the following
log in
do tests
log out
since I want to reuse log in and log out with other test suites I moved them into a separate folder and referenced those test cases in the href field e.g.
a href="..\lib\fLogIn.html"
Selenium however raises an exception that it can't find the file in question.
I tried all sorts of URLs, e.g.
file:///E:\absolute\path\lib\fLogIn.html
file:///E:/absolute/path/lib/fLogIn.html
../lib/fLogIn.html
..//lib//fLogIn.html
..\lib\fLogIn.html
etc.
I even tried to access them through a webserver.. no success.
Does anyone have an idea as to how this can be solved?
I really want to reuse test cases.
Thanks a lot
Juergen
PS: forgot to add: I am using Windows OS
Try to move all the reusable functions to an upper level class and using them accordingly.