How do I Rerun test from perforce swarm api? - api

Swarm's web section has a Rerun test button to do this when I pass a review and want to restart other review tests, but I didn't find a way to do so in swarm's api.

What I'm doing right now is, PATCH method in swarm api was used to change the current state of testruns to running, and then ${swarm_URL}/ API /v10/${id}/testrun/${uuid}, the combination of testruns data obtained by curl, was used as parameter to remotely start the construction of jenkins.

Related

What's the best way to do end to end testing that can be run via CI pipeline when the frontend and backend are in separate repos?

I currently have an Angular frontend and a dockerized Django backend. Both are deployed separately. Angular via Netlify and Django via Heroku. Both are triggered to deploy any publishes to the master branch.
I've written end to end tests using Cypress and integrated it to the CI using GitHub actions. At the moment I ended up deploying a test backend server which is a replica of the production on a separate Heroku instance and am using that link as the backend for the cypress test suite that lives inside the UI repo and runs every time before pushing to master. To be more specific, whenever I need to publish changes, I push to staging and on push to staging, the CI workflow is triggered and runs the test and if the tests pass, the changes to staging get merged with master and from there changes are automatically deployed. The backend gets published to production without any prior testing.
There are two problems with this setup. First is that for the CI to rely on an external API is time consuming. Second thing is that for me to push changes to the API without the e2e suite running and having it only be run when corresponding UI changes get published is sort of problematic because breaking changes to the API could get published unchecked.
Is there a more elegant way to do this within GitHub actions? Because I find it convenient. If not, what other solution do I have to address these 2 issues?

Jenkins testing setup and test in every push for main project or testing code push

I have to test the project code using Jenkins. In Jenkins, I am using automation testing throw selenium. then my question is I have test scripts on my laptop and using Google Cloud virtual machine SHH i have to set up and test in every push on git. Here is my 2 demand-
1. on demand-whenever we want all the test run we should just trigger the test run.
2. Whenever we deploy something on staging then test all the test cases
Regarding (1), you are always able to trigger a job manually through the Jenkins UI. No special configurations there.
Regarding (2), you can install a plugin that will integrate webhooks functionality into Jenkins. In my case, I like to use Generic Webhook Trigger for this purpose, as it has the flexibility that I need on my setups.
In order to trigger the job on every deploy to staging, and assuming that your deploys are automated, you will need to add a final step on the deploy script, to make an HTTP request to the webhook URL (eg. JENKINS_URL/generic-webhook-trigger/invoke?token=<your-token>
I don't fully understand your setup with your machine and the VM on GCloud, in any case, I believe that the test code should be available to the machine running the tests, and not be stored in a location that might be unavailable when the tests need to be run (as your laptop might be).

How to set up ZAP plugin in Jenkins

I have a problem on Zap plugin of Jenkins. Assume I have my selenium UI testing code, it will launch a browser and set a proxy automatically. What I need is to launch the test from Jenkins, and use the zap plugin to open the zap proxy and generate report.
The process in Jenkins should be :
1. Open ZAP proxy, add alert filter to ZAP.
2. Execute UI test (which will go through the ZAP proxy automatically)
3. ZAP generate report and send back to Jenkins.
4. Shut down ZAP proxy.
My confusion is when I use the zap plugin in Jenkins, there is a starting point which is necessary to put. But I don't want an active scanning, I only need a passive scanning from what go through the zap proxy by UI test. Is there a way to walk around it?
I found another way by using ZAP API to do the job https://medium.com/#PrakhashS/security-testing-for-apis-using-zap-5df8ec07a131. But I don't manage to make a alert filter by API. Can someone help?
I am newbie of Jenkins, I would like to know which way is proposed to meet my need. By executing zap from zap plugin, or by executing shell from zap API?
Thank you!
If you just want passive scanning then why not try the ZAP Baseline scan: https://github.com/zaproxy/zaproxy/wiki/ZAP-Baseline-Scan
Theres now an option to add a delay for other tests to proxy through ZAP. I need to update the wiki ;)
I did something similar - I had an existing UI automation tests, and I was able to proxy them through Zap. You can find an example here, using webdriver.io (which is basically selenium). If this is what you're looking for, I can help you set this up.

build jmeter-parellarel-request-master

I need to write a scenario where we make several calls to an API in parallel with JMeter. The solution is based on OAuth, where a token is extracted and passed along with every call made to the API. This works fine, however, JMeter has no built-in option to make multiple parallel calls. I could divide them into separate thread groups, but this would not be desired.
Thread group
oauth calls to get token
extract token
api call /getCustomerActions
api call /getCustomerBlabla1..
api call /getCustomerBlabla2..
I've found the following custom sampler by Franz See:
https://github.com/franz-see/jmeter-parellarel-request
As I'm not big on development/compiling, my question would be how do I compile this package and use in in JMeter?
Download and install Apache Maven.
Download latest jmeter-parallel-request release
Unpack downloaded sources and switch to that folder
Invoke maven package command from that folder
Copy file from target/jmeter-parallel-request-xx.jar to JMeter's lib/ext folder
Restart JMeter to pick the plugin up
You can also check out How to Load Test AJAX/XHR Enabled Sites With JMeter guide for alternative solutions.
this plugin seems to work, but using it as a seperate thread group, all extracted values or tokens from other (main) threads are not captured.. too bad

Continuous integration with Yii

I have implemented the unit testing with Yii and phpUnit. I want to do more, please help me with this.I am developing ma software in multiple local machines. I wanna keep a repository and want to automate the merging of local developments and test it..kind of continuous integration.
Any one have such suggestion?
If you do not have much experiece working with revision control applications, I'm offering you to use SVN as your revision control software.
For Continues integration, there are jenkins, and phpci on top. for example you can configure your ci server to build & run all the test unit after each commit (via jenkins hook system) and in case of any failed test, send an email to commiter and so on.