Testrigor CI/CD RESULT:OK Dont trigger test - testrigor

Team
Im using the script on CI/CD tab for the integration with Github Actions (Ubuntu-latest)
The issue is when i try to run labeled test all the request give me:
{
"result": "ok",
"queueId": "QUEUEID"
}
But there is not any test running after make that request, So i try testing this things
1.- Run the without labels to run all test (It Works)
2.- Then i try with a one labeled test like
"labels":[ "mobile" ] or "labels":"mobile"
Give me the same result as upper example result: ok but does'nt trigger any test
2.1.- Try with a 2 labeled test
"labels":[ "mobile" , "login"]
and still the same.
So, there is any way that i can see the logs from your side, or any way that i can check why its not triggering the test
Some examples that i've been trying
curl -X POST \
-H 'Content-type: application/json' \
-H 'auth-token: TR_AUTH_TOKEN' \
--data '{ "fileUrl":"URL_TEST_TO_A_PUBLIC_CLOUD", "labels":["Mobile","Login" ] }' \
https://api.testrigor.com/api/v1/apps/TEST_CASES_ID/retest
curl -X POST \
-H 'Content-type: application/json' \
-H 'auth-token: TR_AUTH_TOKEN' \
--data '{ "fileUrl":"URL_TEST_TO_A_PUBLIC_CLOUD", "forceCancelPreviousTesting":true, "storedValues":{"storedValueName1":"Value"}, "labels":["Mobile","Login" ] }' \
https://api.testrigor.com/api/v1/apps/TEST_CASES_ID/retest
PD: This is for android tests

The tests will trigger eventually. Once you do the API call the system needs to download your APK, then start the emulator, upload APK to the emulator and start the APK.
This all takes a bit of time and your task might be in queue if you are using a free version of testRigor.

When you trigger a retest and you specify certain labels to be considered, you won't see the run in the main view, there you can see only the last run that was triggered for all the test cases in the suite. Label/branch tests will be listed in All Runs option on the left menu.

Related

Reporters for Flutter integration testing

I am looking for examples of integrations among Flutter Integration library and test management tools like TestRail or Xray.
For Cypress and other browser automation tools I can find plenty of solutions but for Flutter integration basically nothing.
For Xray, there's no tutorial yet. However, it should be fairly simple.
Run your tests using flutter test and pass the --machine argument to generate a JSON report.
Use the junitreport package to generate a JUnit XML report.
Then you can add it to your command as such:
flutter test --machine | tojunit -o junit.xml
If you redirect this to a file, then you have the report that you can submit to Xray for example.
For Xray server/datacenter, you need to call the REST API endpoint, something like:
curl -H "Content-Type: multipart/form-data" -u username:password -F "file=#junit.xml" http://yourserver/rest/raven/1.0/import/execution/junit?projectKey=JIRAPROJECTKEY
For Xray on Jira Cloud, the syntax is slightly different. You have to make an authentication request first, and then do another submiting the JUnit XML report.
token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "32A27E69B0AC4E5000000...","client_secret": "d62f81eb9ed859e1....." }' https://xray.cloud.getxray.app/api/v2/authenticate)
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token" --data #"junit.xml" https://xray.cloud.getxray.app/api/v2/import/execution/junit?projectKey=XTP

Create environment for repository using gh

Is it possible to create a new environment for a repository https://github.com/org/repo/settings/environments using the gh cli?
The only mention of environment I can find in the manual is here https://cli.github.com/manual/gh_secret_set where it says you can assign a secret to an existing environment, but it seems the environment would have to be created manually.
From what I'm seeing here in the gh cli repo that's going to be a no at this time. The issue [linked] is an enhancement request for just that.
I too wanted to know if this could be done, as it's part of my workflow to inject environment secrets.
You can still use the API to create it though.
curl -X PUT \
-H 'Authorization: Bearer ghp_...' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/<org>/<repo>/environments/<env>
Basically you need to create the environment first, then you can set branch policies:
jq -n '{"deployment_branch_policy": {"protected_branches": false, "custom_branch_policies": true}}'|gh api -H "Accept: application/vnd.github+json" -X PUT /repos/:owner/:repo/environments/dev --input -
gh api --method POST -H "Accept: application/vnd.github+json" "/repos/Oceaneering/it_infra_base_application_bootstrapper/environments/dev/deployment-branch-policies" -f name=dev
I wrote a python script for my use case that uses the gh cli to create environments and can include a branch pattern.
https://gist.github.com/walkerk1980/8a6f6879b32260360854a89bb880a48d

How to remove files inside a container using the Docker API

Please advise, how to remove files inside a container using the Docker API?
I have tried to do it this way, but it doesn't work
curl --location --request POST 'http://192.168.1.55:5555/containers/{id}/exec' \
--header 'Content-Type: application/json' \
--data-raw '{
"Cmd": [
"/bin/sh",
"-c",
"'rm -rf /files/*'"
]
}'
According to the Docker API doc "To exec a command in a container, you first need to create an exec instance, then start it. These two API endpoints are wrapped up in a single command-line command, docker exec." In this way, after getting the response you must run new POST request /exec/{id}/start

How to associate a project with a quality profile in Sonarqube

I am using sonar webapi to associate a project with a quality profile but not able to do it. On every run of sonnar-scanner it is associating default quality profile. Below is the code snippet.
Updated the code snippet
curl -k -X POST --insecure -H “X-Auth-Token:XXX” -d "language=py" -d "qualityProfile=test_profile" -d “project=test_1.0” https://sonartest.xxx.com/api/qualityprofiles/add_project
I am not sure what I am doing wrong. I have administrative access and followed the webapi of Version 6.7.3 (build 38370)
Finally got some help from Soanrqube community. I need to remove X-Auth-Token from code. It should be something like this
curl -u ur_token: -X POST -d language=py -d qualityProfile=test_profile -d projectKey=${params.ProjectName} https://sonar-url.com/api/qualityprofiles/add_project

Algolia: Delete multiple records from dashboard

How can I delete multiple records at once? Is it possible to select all, say "products" post_type, and delete it or it has to be one by one? (I'm not trying to clear all the records)
Algolia's dashboard is not designed to be a complete graphical interface on top of the API, it's mostly here for convenience, understanding and testing purposes, not complete management of the data.
As soon as you start being limited by the dashboard, you should probably write a small script to achieve what you're trying to do.
Fortunately, it's been designed to be as easy as possible.
With PHP, here's how it would look like:
First, let's create a small folder to hold the script.
mkdir /tmp/clear-algolia && cd /tmp/clear-algolia
If you don't have composer yet, you can simply install it in the current folder by launching the commands described here.
If you've just installed it and want to just use it just for this session:
alias composer=php composer.phar
Then install Algolia using composer:
composer require algolia/algoliasearch-client-php
Write a small script along those lines:
<?php
// removeSpecific.php
require __DIR__ . '/vendor/autoload.php';
$client = new \AlgoliaSearch\Client("YOUR_APP_ID", "YOUR_ADMIN_API_KEY");
$index = $client->initIndex('YOUR_INDEX');
$index->deleteByQuery('', [ 'filters' => 'post_type:products' ]);
?>
Then run it:
php removeSpecific.php
And you're good to go! Next time you want to do an operation on your index, you'll only have to change the last line of the script to achieve what you want.
You can use the REST API.
It can be easier or faster to do it with PostMan.
Here you can check a simple request: https://www.algolia.com/doc/rest-api/search/#delete-by
To first check what you are deleting, you can use:
curl --location --request POST 'https://[AplicationID]-
dsn.algolia.net/1/indexes/[IndexName]/query' \
--header 'X-Algolia-Application-Id: XXXXXXXXXXXX' \
--header 'X-Algolia-API-Key: XXXXXXXXXXXXXXXXXXXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"params":"numericFilters=id<=9000"
}'
And to delete the records you can use:
curl --location --request POST
'https://[AplicationID].algolia.net/1/indexes/[IndexName]/deleteByQuery' \
--header 'X-Algolia-Application-Id: XXXXXXXXXXXX' \
--header 'X-Algolia-API-Key: XXXXXXXXXXXXXXXXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"params":"numericFilters=id<=8000"
}'
The "params" should receive a Search Parameter, you can find a list here: https://www.algolia.com/doc/api-reference/search-api-parameters/