Getting WatiN.Core.Exceptions.TimeoutException while running from CruieControl - nunit

I am getting WatiN.Core.Exceptions.TimeoutException:
Timeout while Internet Explorer busy error while executing my tests via CruiseControl.Net.
Any one have idea how to resolve this?

While we are using TeamCity, we had to disable IE protected mode.
Also, check that user, under which watiN tests are being run can interact with desktop.

I know this question is old and answered, but below are some of my observations.
It is possible to run watin tests under a service account
but the following restrictions/prerequisites apply:
service must run in desktop interactive mode. Only available if running as system.
tests must not create a new windows, even alert/confirm dialogs
Ie cannot create a new window, so watin fails when looking for/expecting it to appear.
ie may show its own warnings, e.g. Insecure content in a secure Page, this can cause tests to fail*
if the tests fail/timeout and the ie instance is forcefully closed, the next instance may try to restore the previous state. The tests then appear to fail*
this can be turned off in the advanced settings.
*from what I've experienced, usually because the prompt is halting the document from being reported as loading-finished.
Feel free to add with other restrictions /comments.

Related

Azure Devops automated test results incoherent with powershell test results using the same data

I'm currently trying to integrate automatic test execution on the deployment process using Azure Devops but it's causing me an issue where some tests don't run properly.
The application I'm testing has a log-in page and I've set up a couple of tests to see if it opened properly. These ones run smoothly, but the ones that require going through the login process do not.
I've set up some snapshots amidst the process and the result was that I was getting an error on the last step of logging in. I've checked the application logs and the result I got was that no credentials were sent through the request which I found odd since they were displayed on the snapshots.
All the data being inserted was correct, I've checked the endpoints and settings on the agent that was running them and everything seemed fine.
I tried then to run the automated tests through powershell command directly on the same agent and all of them passed with no issue whatsoever.
I've tried changing my task to a powershell command but it still gives me an error.
I have no idea where my issue could be or where I should be even able to start looking for the problem, as clearly it seems that the problem is on the azure devops task but everything seems fine with it, I've tinkered around with the settings a bit but none of them seemed to have any impact on the results I was getting.
I'm using version 2 of the vstest task and am targetting the test assembly that was deployed to the agent. Any idea on what I could be missing or pointers on how to find the solution?
These ones run smoothly, but the ones that require going through the
login process do not
Based on this description, it seems that it will open a new window automatically by the task.
If I'm right, and your test will open a window to login with your private-hosted agent. At this time, the mode of your private-hosted agent must be in interactive which it can allow auto-logon enabled.
Just check this official document for more detail information.

How to (automatedly) test different ways to close an application with SWTBot (with Tycho)

Probably there is a simple answer to this, but I'm finding it hard to figure it out myself: How can I test different ways to exit an application with SWTBot?
In my application based on the Eclipse RCP 3.x, you can close the application in three different ways:
Per mouse click on menu items (File > Exit)
Per keyboard shortcuts on a menu (Alt+F X)
Per shortcut (Ctrl+Q)
I'm currently writing unit tests for this behaviour with the help of SWTBot. Running them I have a simple and very real problem: Once one way of closing the application is tested, the application is closed and hence all the other tests fail.
All tests are currently residing in one test class.
My question therefore is: How can I run all tests successfully, from Eclipse for starters. But also: How can I have them run by Tycho during the build, so that following tests won't automatically fail due to the application not being open anymore?
In short, you cannot test closing an application with SWTBot.
As you already found out, closing the application will terminate the VM as well. And since your tests run in the same VM as the application under test, the tests will be terminated as well.
Aside from these implications, you shouldn't test closing an application. The three ways to close an application that you mention are all provided by the platform and hence the platform should have tests for that functionality, not your application.

How to programmatically build VIs without user interaction?

I have a LabVIEW project with five cRIO targets. I wrote a build VI that compiles and deploys the rtexes, after the deployment the target is rebooted. The problem is that while deploying, LabVIEW opens a connection to the target that it wants to keep alive. That is why it displays an error dialog that says "Warning: Connection to target (name) has been lost."
The question now is what do I have to do to supress these dialogs or how can I write it that they are avoided totally?
EDIT:
I want to build or compile the buildspecifications, I don't want to generate any code. The problem is that if LabVIEW connects to a cRIO it keeps the connection alive and when restarting it, it cannot reconnect because it would stop the executed rtexe so it pops up an error which I don't know how to supress or get rid of it. The restart has to be done that the built rtexe is executed.
EDIT 2
The problem is that this popup blocks the execution of the following code. It should be a silent VI without popups. The replication software is not the right choice because the code differs from target to target.
It seems that you have the cRIOs added to your project. Interesting that a deploy will automatically connect but not disconnect.
One possibility is to disable the automatic connection check in the project properties of the cRIO.
The other possibility is having LabVIEW disconnect from all targets. See screenshot below. Basically you iterate through all devices of all open projects and disconnect from them. You'd have to do this after every deploy.
[Sorry, only german LabVIEW available here]

How to run scheduled Coded UI Tests on Virtual Machine without having a RDP connection

Situation in short:
Virtual Machine with Visual Studio 2013 installed. PowerShell script
runs on the VM to execute Get Latest, Build and Execute Coded UI
Tests. Windows Scheduled Task to execute PowerShell nightly.
auto-logon is enabled (or I'm doing something wrong?)
yes, I've read post Is it possible to run Coded UI tests without having to connect via remote desktop?
I've seen posts about TCM. Does this help and how can I use it in my
situation?
I made some tests in Microsoft Test Manager and I also executed and recorded them.
I've loaded these tests in a test project (and changed the script providing categories and custom checks).
I then categorized these (as Development or Acceptance).
I executed out using a PowerShell script on a VM (with Visual Studio 2013 installed) with following actions:
Get Latest
Build
Run latest build with a selected set aka category using mstest.exe
So far everything is going perfectly. All the tests pass.
However, when I create a Scheduled Task on my VM run the PowerShell script everything fails because of a missing session.
Do I have the VM (I have no knowledge of Virtual Machines) then unlock or something?
Side-Note:
I also tried to fix this with a Test Agent and Controller, but once I had installed these, all other users of TFS lost their rights, so I prefer not to do this again.
I would be very grateful if you know something that can solve this.
I spent hours on Google finding a solution for this issue, but no solution helped me.
Do I need to provide more information?
The problem you're seeming to have is that the testagent is not setup correctly. You need an active desktop session for Coded UI to be able to run (it needs it to perform all the actions such as clicks).
Microsoft has some nice info about setting up your test agent here.
But to tackle your exact problem of the test failing because of a missing session I'd suggest the following:
Run AutoLogOn.exe from the sysinternals suite (can be found at http://live.sysinternals.com/). It will automatically log in with specified user when the machine starts, and keeps the desktop session active.
Alright...I'm making progress.
I've installed test agent and controller. It's all running fine.
Next I've opened Lab Center on my own MTM to create a new environment.
Test Controller is found, but I receive the message in this post "Microsoft Test Manager cannot install test agent on these machines" when creating new Lab Center environment
File and Printer sharing exception is enabled. I don't get the other message.
I don't understand what is wrong.
Maybe I'm completely on the wrong track and it's not necessary to use the Lab Center.
Then the only remaining issue is the non-active desktop issue.

Coypu/SpecFlow acceptance tests hang when run via Jenkins job

I'm running acceptance tests on a project via SpecFlow, NUnit and Coypu (for browser automation, using the WatiN driver). The running of the tests are invoked via a powershell/psake script.
If I run these tests on my local box, they run fine. However, we have a build server on which a Jenkins job will automatically run these tests, and when run via this Jenkins job they don't execute -- they just hang.
Looking in task manager I can see there's two instances of iexplore.exe that are created when the Jenkins job runs. However after a certain point they just hang - no changes in memory usage or CPU.
nunit-agent-x86.exe and nunit-console-x86.exe are also running but mostly hung, just nunit-agent-x86.exe going up very slowly in memory.
If I kill one of the iexplore.exe processes things continue, but the SpecFlow specs all subsequently fail.
At the point of killing iexplore.exe, the following exception is in the log:
Unhandled Exception: System.Runtime.InteropServices.COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
If I invoke the psake script manually when logged in to the server, the specs run OK.
This issue began to occur when I tried to use basic DI for the BrowserSession as in the gist here: https://gist.github.com/2301407
Before that I was sharing the BrowserSession via a static property of an NUnit [SetupFixture] class. Things were working mostly OK that way, except a small issue with a test involving a modal dialog not working correctly, but I wasn't sure I was doing it right so wanted to do the technique in the gist
I'm a bit lost as to what's causing the hang. Any ideas what it is or tips to track it down?
UPDATE: After switching to Firefox as the browser, and Selenium as the driver, the problem has gone away...
I got a couple of responses on the Coypu list. I've yet to test them out as everything is fine with Firefox at the moment, but in case they are of assistance to anyone else...
On Thursday, 2 August 2012 16:38:30 UTC+1, Adiel wrote:
[...]i believe that watin needs nunit to run in STA (single-threaded) which could possibly be related to your problem.
In other words, perhaps you made your tests thread safe with the static singleton browser session, but now via specflow's IOC you are
getting multiple instances due to the way nunit is running.
On Thursday, 2 August 2012 16:41:11 UTC+1, Matt Ellis wrote:
This sounds like it's Internet Explorer's protected mode getting in the way. IE runs different zones, such as Internet and Intranet
(and about:blank) in different processes, and IIRC WatiN doesn't
handle that very well. If you can disable protected mode on your
server, you should be fine.