Run Selenium tests against a .NET Core web app - selenium

I have a .NET Core web app that connects to a .NET Core API and I want to run Selenium UI tests against it. However, the Webdriver can only connect to the web app if I first run the web app and API in IISExpress. What's the best way to run them without having to explicitly start them in IIS? I've tried to create a new Process to use 'dotnet' to run the web app (and API) for me but it won't run. Has anyone had a similar problem?

You'll first want to figure out how to get your application running before trying to test it with Selenium. This post might help you with that. After you figure that part out, you'll want your web application with its server running before you run your Selenium tests against it. This can be accomplished in a number of ways:
Get your server hosted non-locally
Manually starting your server locally and running it prior to running the test
Have your test application build and run your server with a Process instance
If you decide to go with the third option, you'll of course need to find out how to properly get your server running. In my experience, the dotnet build and dotnet run commands usually do the trick. The dotnet build command takes in a SLN or CSPROJ file, then compiles your server's source files and outputs a DLL. You can then specify this DLL in the dotnet run <DLL> command.

Related

How to get Selenium tests to run after deployment in visual studio team services

I am having an issue getting selenium end to end tests to work after an automated deployment using visual studio team services (VSTS).
I have a build working that generates a build artefact. This is triggered from VSTS but runs on an on premises build server. I have a deployment working that deploys to an on premises development web server. All this works including unit tests running after the build.
When I try to add testing after the deployment is when I run into the problem. The tests are to be run on the build server and point to the dev server website. The deployment has two phases. A deploy and then an agent phase that runs a test assemblies task using the build agent on the build server. The problem seems to be that the test dll's are not being included in the build artifact and so are never found when the test process runs. Deploy setup us as follows.
I have a copy files before the publish artifact in the build definition that seems to copy the files in to the right place but they are not included in the zip file artefact. I've looked at several websites and posts on here but I still seem to be missing a vital bit of knowledge that will get this working.
Use of the log did help as recommended so thanks for that.
I have managed to get this working. I separated the selenium tests out into a separate solution and built that separately creating it's own build artefact. I then added this to the agent task in the deploy. This worked. The only thing I need to get sorted now is the correct search path to find the test DLL's. It's not quite as dynamic as I would like at the moment. I can play tunes on that until I get it right though.
I accept this is working around rather than solving the original problem but needs and timescales must. I think moving the end to end UI tests out of the main solution makes sense anyway but no doubt others may think differently.
Thanks for your help everyone

Running automated tests in client machine

Basically my requirement is :
I have developed a framework using selenium webdriver,maven and testng for a application under test.
Now i have to pass that on to the client without sharing the source code ..so that if he wants he can run the test in his machine without having everything else installed ..except java. and the output should be stored in one of the specific folders of the client machine.
Can i use any plugin in maven which will store the result or copy the result file to any folder of client machine.?
Please guide me how to achieve this.. how to pass on the above to client so that test run smoothly in his machine .
is there anything i need to take care while am using maven in the project?
I am using chrome browser to run the tests..
The application under test is available to be accessed from any type of browser.
kindly suggest.

Unable to run tests while attached for debugging

We've recently moved to VS2k13 from VS2k10. In VS2k10 we'd often attach to IIS to debug our MVC4 based services by running one, or more, of the tests we've written.
In VS2k13 I can run tests, and run tests in debug, but I can't run the test after I've attached to IIS. Once I attach to the IIS process the entire Test menu grays out. My tests are listed, but I can't run them.
Updates:
IIS is being run locally on my machine
I have removed *.testsettings and *.vsmdi files
This is VS2013 Ultimate
What did I miss?
Well I think thats because while testing ASP.NET code it runs as VSTestHost process and in scenarios when you run the App it is associated with the IIS process or in an ASP.NET Development Server process.
Because the test runs in other than the typical test process, you do not have any tests menu options available or Debug option of tests available.

Test Automation: TeamCity with Selenium and SOAPUI and Calabash

We are building apps for iOS and Android. Currently we are experimenting with TeamCity for CI.
Currently we have various tools to help us in the Test automation.
1. Selenium: For testing the web interface
2. SOAPUI: For testing the web services
3. Calabash-iOS: For testing iOS app
This is the scenario that we have done successfully with TeamCity:
1. Developer commits code to BitBucket
2. TeamCity runs calabash
3. If calabash pass, TeamCity will build and give the artifacts
This is the scenario that I am trying to do so that I can achieve an end-to-end automated testing:
When developer commits his code to our Bitbucket git repository,
TeamCity will trigger Calabash to run and check for the UI and the output of the details. On end,
TeamCity will trigger Selenium to add data in the Back Office web. On end,
TeamCity will trigger SOAP UI to check newly added data. On end,
TeamCity will trigger Calabash to check the newly added data
Has anyone tried this before or can give me an idea on how I can approach this?
You can setup different builds for each step since you can trigger builds via simple GET requests triggered by a script. TeamCity Accessing Server by HTTP
We run a similar setup. Basically we have one build kick off the Selenium/SoapUI scripts. That build doesn't wait for the job to finish, it just kicks it off. Then in our Selenium/SoapUI tests as the last step we hit the URL for the next build that picks up reports etc.

Using MS Build to deploy after tests

I have a web project structured the following way:
WebSite
WebSite.test
In the test project, I have all the unit tests (using Microsoft test framework). In the WebSite project I have a target to deploy the site using MSDeploy, the MSDeployPublish target, and DeployOnBuild=true. I then run this build using Jenkins. The problem is that using this setup, the site will get deployed before it's tested.
I could add another build step in Jenkins, so that the entire solution is built first, then the deploy projects are run. However, I would like for it all to be in one step. Is this at all possible?
This is probably a bug in Jenkins. See this bug (or this one). See comments for possible workarounds.