Visual Studio (2015) Debugging Integration Tests Runing in a DOCKER Container - visual-studio

I try to figure out how I can debug unit tests and integration tests in Visual Studio 2015 that be execute in a Docker container.
I've made an ASP.Net Core 1.1 app that is Dockerized and is connect to a Postgresql Database via the docker-compose.json file.
I wrote some unit and integration tests. The integration tests run tests against a database, so I've created a docker-compose.json to :
launch the database
compile code
launch tests with the command docker test test/path-to-the-test-project/project.json
I run the docker-compose by hand with powershell. Everything work well, but it's realy painfull to debug by reading thousand lines of log.
So, how can we execute the test suite in Visual Studio and debug the test code like we can debug code running in a Docker container (and use break point and other debug tools) ?
(Debuging an ASP.Net Core app in a Docker container was explained in the Microsoft documentation)

For now there isn't way to debug integrations test who are executed in a docker environment.
The way I found is to launch the Dockerized Database by hand and execute integrations tests in Visual Studio.
With that, I cant execute and debug tests. I can also execute OpenCover, and that's nice.

Related

Visual Studio Load Test

I have a web application which I want to test with Visual Studio Load Test feature.
I could create a load test on my local machine successfully.
My application deployed to a Windows Server and I would like to test it using TFS.
Can I deploy load test with my web application as well?
I need a stress test so I would like to use load test for hours which is quite difficult using my local machine, but unfortunately I don't find any useful tutorial.
My expectation is that I can deploy my load tests, and I can run that without local machine and Visual Studio.

Run MSTest unit tests on a project when it needs to be running

I am looking to run some automated RestSharp API tests in Continuous integration.
Right now, the application API is running in it's own project, which is set as a Startup Project. The Web App is running in a separate project. And when they are both run manually from Visual Studio, the app's UI can be manually tested against the locally running API (That's just for reference, I only need the API project to run for my tests to work).
So right now, to run my automated API tests as I script them, I start the API project to get the API up and running locally, then open a new window of Visual Studio, and run my MSTests from there.
My question is, how do I get the API project up and running automatically, so the tests can be run against the API? Can I start tests, while the API project is actively running in Visual Studio?
Mainly, how can I run these API tests in Continuous Integration, if the API needs to be started up in a separate VS window every time?
Sorry for the fairly broad question, I am a test automation engineer, and not an API developer. A pointer in the right direction would be great.
You can deploy the Web API to IIS (or IIS Express). In that way, it would be running in the background rather than launched from Visual Studio. The CI tool would then update the deployment after it creates a new build, but before it runs the tests. I would start with the documentation for whatever CI/CD system you are using, but assuming you're using TFS, here is a reasonable starting point: https://www.visualstudio.com/en-us/docs/build/apps/. There are links from that page for deployment and CI.

Debugging a Windows service

I learned that for Windows Service Debugging in Visual Studio 2015 IDE,
launch the service from IDE using the ā€œ-cā€ command-line switch. This enables the service to run as a console application.
Why do we need to enable the service to run as a console application, in order to debug the service?
Does running as a console application here mean running as a foreground process?
Does running a service here mean running as a background daemon?
How do we debug a service, if running it normally instead of running as a console application?
Is the switch "-c" a switch of Visual Studio debugger, or of something else?
Thanks
This blog also shared us the reason why we convert a Service to Console Application for Debugging like "debug more easier" or others:
https://social.technet.microsoft.com/wiki/contents/articles/30957.c-windows-service-in-console-mode-for-debug-and-admin.aspx.
I think the command line switch would be similar to the UT project property settings.
To debug the windows Server without using the console app type, you could use the attach to process or customer code or unit tests:
https://msdn.microsoft.com/en-us/library/7a50syb3(v=vs.110).aspx
Easier way to debug a Windows service

Sonarqube and code testing

I want to run sonarqube testing on my sonarqube server and want to see test result (test report) from my client machine without touching server.
How can I do that in case of multiple developers will push their code to test on sonar server and need to see test result from their local machine?
There is the http://www.sonarlint.org/ plugin available for eclipse, IntelliJ IDEA and Visual Studio. The plugins for first two IDEs support Java, JavaScript and PHP, the plugin for Visual Studio supports .NET code.
All three offer the Connected Mode which can "establish a connection to a SonarQube server (4.5.4+) and bind your [...] project to a SonarQube project."
This might help you depending on your development environment.

Start ASP.NET Development Server automatically in unit tests

In Visual Studio, if you begin debbuging on a webservice, the ASP.net Development Server will start up for you.
I have a series of unit tests that rely on this server being here. How can I find out how this Development Server is invoked? I would like to start it up automatically.

Resources