I have a DOTNET ASP.NET API REST service that needs to have integration testing with code coverage measured.
I have the code coverage for unit tests currently functioning.
The testing harness is using Postman (Newman for CLI) issuing requests to an executing instance of the API service.
I was considering using the utility dotnet-coverage connect to collect the code coverage data during testing. However, I can't find any examples of its usage.
Documentation: dotnet-coverage connect
Does any one have any experience with this approach? Any other technique I should consider?
Thanks in advance.
Related
I have deployed wso2am-4.0.0 in okd, with 2gw, 2cp, 2tm. I'm going to have a performance test for WSO2 API Manager, I got docs from here, but I don't know hot to config, can any one guide me?
Although these scripts are in the public domain, they seems to be developed specifically to be used inhouse. Hence trying to use them may be an overkill. I would suggest you to look at Some of the test scenarios available in that repo and build your own test script to test your specific use cases.
This question already has an answer here:
Is there a way to run Karate tests as an integration test suite against a pre-booted spring boot server?
(1 answer)
Closed 1 year ago.
Maybe this is not possible to do generically in a test framework but
I would like to be able to deploy the microservice I am testing within the test itself. I have looked at Citrus, RestAssured, and Karate and listened to countless talks and read countless blogs but I never see how to do this first stage. It always seems to be the case that there is an assumption that the microservice is pre-deployed.
Honestly it depends on how your microservice is deployed and which infrastructure you are targeting on. I prefer to integrate the deployment into the Maven build as Maven provides pre- and post-integration-test phases.
In case you can use Kubernetes or Docker I would recommend integrating the deployment with fabric8 maven plugins (fabric8-maven-plugin, docker-maven-plugin). That would automatically create/start/stop the Docker container deployment within the Maven build.
In case you can use Spring boot the official maven plugin can do so in the same way.
Another possibility would be to use build pipelines. Where the continuous build with Jenkins for example would deploy the system under test first and then execute the tests in a pipeline.
I personally prefer to always separate deployment and testing tasks. In case you really want to do a deployment within your test Citrus as a framework is able to start/stop Docker containers and/or Kubernetes pods within the test. Citrus can also integrate with before/after test suite phases for these deployment tasks.
I found a way to do it using docker-compose.
https://github.com/djangofan/karate-test-prime-example
Basically, make a docker-compose.yml that runs your service container and then also runs e2e tests after a call to wait-for-it.sh.
2 points:
The karate-demo is a Spring Boot example that is deployed by the JUnit test-runner. Here is the code that starts the server.
The karate-mock-servlet takes things one step further where you can run HTTP integration tests within your project without booting an app-server. Save time and code-coverage reports are easier.
If you have any requirements beyond these, I'd be happy to hear them. One of the things we would like to implement is a built-in server-side mocking framework - think embedded wiremock: but with the ease of Karate's DSL. But no concrete timeline yet.
EDIT: Karate has mocking now: https://github.com/intuit/karate/tree/master/karate-netty
To everyone that took their time, to read my question, I want to point out, that I'm writing Integration-tests NOT Unit-tests.
Using the definition of Integration-test, provided by sites(that are at the bottom of the question):
Integration tests do not use mock objects to substitute
implementations for service dependencies. Instead, integration tests
rely on the application's services and components. The goal of
integration tests is to exercise the functionality of the application
in its normal run-time environment.
My question is what is the best practice on writing integration test for ASP.net web API. At the moment I'm using the in memory host approach provided by Filip. W. blog post.
My second question is, how do you ensure, that your test data is there and is correct, when you're not not Mocking(msdn and other sites clearly say, that integration test do not mock databases). The internet is filled with examples of how to write extremely simple integration tests, but has zero examples for more complex api(anything that goes further than returning 1)
Reference Sites:
https://msdn.microsoft.com/en-us/library/ff647876.aspx
https://msdn.microsoft.com/en-us/library/vstudio/hh323698(v=vs.100).aspx
http://www.codeproject.com/Articles/44276/Unit-Testing-and-Integration-Testing-in-Business-A
http://blog.stevensanderson.com/2009/06/11/integration-testing-your-aspnet-mvc-application/
Filip. W. In-Memory-Hosting:
http://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/
Have you seen my answer over at this other SO question here . I will pad this out with the additional information below.
In our release pipeline (using Visual Studio Release manager 2013) we provision a nightly integration database from a known test script by creating the database from scratch (all scripted) - initially we cloned production but as data grew this was too time consuming as part of the nightly integration build. After the db is provisioned we do the same with the integration VM web-servers and deploy the latest build to that environment. After these come up we run our unit tests again from command line as part of the release pipeline this time including the tests decorated with the custom action filter I descried in the answer linked.
I am new to Task Scheduler for asp.net mvc. I want to perform the automatic sending mail functionality using it but i have no idea how to achive it.
please help me to carry out from it or suggest any new idea or way to perform the above task
thanks.
I have used http://taskscheduler.codeplex.com/ to achieve the same thing. I have created a Console application Which accepts some parameters and based on the parameters sent to the applications it fetches data from db and sends mail.
Task Scheduler provided by codeplex, adds tasks to your system task scheduler (you can find this in Accessories -> System Tools).
At http://taskscheduler.codeplex.com/ basic example is provided. Please visit documentation section if you want more sample code.
You can use ATrigger scheduling service. A .Net library is also available to create scheduled tasks without overhead. Errors log, Analytics, Tasks Listings and more benefits.
You can use this kind of services in shared hosting.
Disclaimer: I was among the ATrigger team. It's a freeware and I have not any commercial purpose.
I have been given the task of using JMeter for performance testing for our web application.
Until now I was using selenium for UI testing and I have selenium test (testNG framework) ready, which I have executed using Selenium RC.
Is any migration from selenium to JMeter possible? Failing that, some helpful tutorials on JMeter would be much appreciated.
Once upon a time, I use jmeter for load testing and had much trouble for just login to our asp.net web application. After lot of searching I write the blog asp.net login testing with jmeter.
If you are not using asp.net, then it may not be very helpful. In that case, you may visit build web test plan using jmeter
Other Links:
http://jmeterperftest.blogspot.com/
http://jmeter.apache.org/usermanual/glossary.html
Jmeter Summary Report analysis
I understand you are told to use JMeter.
Nevertheless, you could quickly evaluate other tools to check if another would not fit your needs.
I just tried gatling and could easily
record a stress test by running manually my scenario in the browser
customize the script to fit my needs
run it with multiple configuration (number of users, length of the test etc.)
You might want to take a look : https://github.com/excilys/gatling/wiki/Getting-Started