Quarkus remote application testing in dev mode - junit5

When we run #QuarkusTest annotated tests, one of these tests run the Quarkus test extension and start Quarkus in dev mode. Quarkus will then remain running for the duration of the test run. This is how we can achieve fast debugging.
But my use case is bit different from it. I need to verify an application which is running remotely. Is there a way I can tell Quakus not to start application while I'm using the #QuarkusTest annotation?
one possible way to achieve it that I simply write JUnits and boiler-plate code to connect the api and then verify it. However, I want to use Quakus framework while stopping Quarkus not to run application.

Related

Using OWASP ZAP Proxy for existing suite of Selenium tests

We have a suite of automated regression tests driven using Selenium for an Angular app with a .NET Core WEB API backend.
The intention is to include some automated security testing as part of our overnight build/test run.
From reading so far it looks like running ZAP as an intercepting proxy between Selenium and our web application is the way to go (see 'Proxy Regression/Unit Tests' in https://www.zaproxy.org/docs/api/#exploring-the-app) but I'm struggling to find clear documentation/examples.
What is the simplest way to achieve this using OWASP ZAP, and are there any definitive articles/examples available?
Start with the packaged full scan: https://www.zaproxy.org/docs/docker/full-scan/
Set the port and then proxy your selenium tests through ZAP. Use the -D parameter to pause ZAP until your tests have finished. For more ZAP automation options see https://www.zaproxy.org/docs/automate/

BrowserStack e2e tests with mock server

My goal is to set up an environment where CircleCI would run my e2e tests on BrowserStack in different browsers.
My tests are assuming that there is a mock server running. (E.g. tests are checking whether a certain call to the mock server has been made or not.)
I learned that there is such a thing as local testing for BrowserStack, but whenever I'd like to start the mock server on port 65432 it says the port is already being used. Error: listen EADDRINUSE :::65432
I have an Express mock server running (on port 65432), tests are ran by Nightwatch against Selenium server.
So far I only saw examples which run tests against homepages which are living on the internet (like google.com), but I would like to run my own mock server locally and run my tests against it.
Is there a way where I could run a mock server and run my tests with Nightwatch and Selenium against that mock server and all done by a CI tool running the tests on BrowserStack?
If you have a internal website (not accessible to public) hosted on your machine (using mock server - Tomcat, Nginx, Express Mock Server, etc) and wish to run the Selenium based scripts to test that application on BrowserStack, then you can use the Local Testing feature.
You simply need to run the binary file that they provide on your local machine (where the internal website is accessible) and set the capability 'browserstack.local' to 'true'. Hence the tests running on BrowserStack will be able to access your internal website. I would recommend you to review the documentation here. You can checkout the documentation on NightwatchJS-BrowserStack here.
If you wish to trigger the tests using CircleCI. They provide the plug-in for CircleCI as well, read more on the same here. The plug-in itself will handle the Local Testing for you in that case.
For future readers: my problem was parallelism - I set 2 workers (child processes basically) with the following object:
"test_workers": {
'enabled': true,
'workers': 2
}
I found this setup from one of the examples which I can't find anymore, but if you are running your Nightwatch tests with your own mock server this might mess up the test suite since every worker will try to spin up a mock server for it's own tests, which will obviously fail.

WCF project will not be hosted when unit test runs

I created a WCF project using the IIS model. I then created unit tests which reference services from that project. Now when I start the unit test, the service is not hosted and thus I get EndpointNotFoundExceptions. When I simply hit F5 everything works fine and the IIS Express comes up in tray.
I checked the option "Always start when debugging" in the property-pane of the service-project and it is set to true.
A Unit Test is a unit test. If you need another process for it (namely some IIS or other web server) it's no longer a closed unit. If you want to test your service when it's hosted, I'd suggest you host it in your test yourself. Check self-hosting services. Then you have control about what class is hosted when and where. For example, you may want a different URL for your unit test and you may want to inject a different data layer so your tests don't need anything outside your unit, like a database.
You are not doing unit testing, and you are actually doing integration testing, since your test suit has no direct knowledge/binding of the service codes and it is just a client program of the service.
Both unit testing and integration testing contribute to good QA. Generally you should create unit testing which directly test the service codes through in process binding interfaces, and make sure it has comprehensive code coverage.
Then create integration testing using MS Test, NUnit or xUnit as test harness, in order to test some run time behaviors of the service.
What puzzle you is that how to make the test suit in the same VS sln run while the service should be running in debug mode. There could be a few solutions:
Build the test suit using Nunit or xUnit, then run the test suit outside VS IDE which is running the service in Debug mode. Actually MS Test could support as well, but only in command line mode.
Host the service in IIS, and you have a batch files to copy assemblies and web.config to there upon every update. Then attach the service codes with respective w3wp.exe instance.
If you just want to test rather than debug, there could be another solution: Use IIS Express. You use either C# codes or batch file to launch IIS Express with the service during tearing up, and close IIS Express when tearing down.

Launch/Deploy latest version WCF service before running unit tests in vs2012

I want VS to deploy the latest version of the WCF every time I run my tests.
Currently I have to deploy manually, or run the WCF Service, for it to be deployed.
I'm looking for a functionality similar to starting multiple projects when debugging.
Maybe to specify the behaviour I am missing right now. I can not set breakpoints inside the webservice, as it's not run in debug-mode.
#codespike Using standard unit testing in VS2012
#codespike With Deploy I mean "copy latest version to local IIS, so it can be respond
to calls over the web.
#mayo Yes! that is a brilliant suggestion. Bypassing the Coding and Decoding (webtransport) phase, and go straight to the classes that manipulate the data.

Integration testing two grails web applications at once?

I've got two grails applications, A and B.
A makes explicit REST calls to B, and I'd like an automated way of knowing this works. In the traditional grails integration-test model, only a single instance is pulled up at a time. I'm using jenkins as my build server, but it almost seems like I would need to deploy both systems and run tests locally, which I'm not sure jenkins supports.
What's the best way to do full integration functional testing of A using B?
use jenkins to deploy your apps to a container after successfull builds. and have some environment property or config that sets the url of app B in app A.
This isn't unique to grails or even Jenkins, but here's what you can do.
Set up a functional test server where you can deploy your applications. Create one Jenkins job to poll project A for SCM changes and deploy to server A, and one job to poll project B for SCM changes and deploy to server B.
Create a downstream build, C, which runs any functional tests against the combined system. Note that you probably don't want to bootstrap either database here, so don't use the integration test phase. This where you would use something like selenium. Make sure to block both upstream builds A and B on dowstream builds, and block C on all upstream builds.
That way, no server gets re-deployed in the middle of a test-run.
As for integration testing, imagine B to be like any other web service, like a database or an LDAP server or anything. If you wanted a full integration test, you'd just setup a server for your test run and run against it, right? Do the same. Using your B build or another build, create an integration test job which explicitly knows about the B server.