#Xray(requirement = "QA", test = "TM-3553" ,ProjectName="QA")
#Test()
public void GETGradeForGuestStudent() {
}
why the execution is not getting mapped to TM-3553 Rather its getting mapped always to TM-3601
mapped to jira
my testng report.xml-pastebin.com/iHc4hJmD
In jenkins postbuild action i am calling this sh command
token=$(curl -H "Content-Type: application/json" -X POST --data #"./cloud_auth.json" https://xray.cloud.xpand-it.com/api/v2/authenticate| tr -d '"')
curl -H "Content-Type: application/xml" -X POST -H "Authorization: Bearer $token" --data #"./target/surefire-reports/testng-results.xml" https://xray.cloud.xpand-it.com/api/v2/import/execution/testng?projectKey=TM&testExecKey=TM-3563"
The TestNG XML report you shared seems to have the correct format, as detailed here. The Test issue key is being mapped to an attribute named "test" under the <attributes> element, which in turn is inside the <test-method> element.
I changed your XML report, so that the first reference to TM-3553 is one of my existent Tests ... and it worked fine in my scenario.
Therefore, I think your scenario needs to be analyzed by the Xray team in more depth to figure out exactly why this association is not being done in Xray side.
Let me just add that the annotation you shared is not correct, as "requirement" must be an issue key and "ProjectName" doesn't exist/is supported by Xray during the import process..
Therefore, this needs to be changed:
#Xray(requirement = "QA", test = "TM-3553" ,ProjectName="QA")
to something like:
#Xray(requirement = "TM-1243", test = "TM-3553")
Another note about the TestNG XML report, is that it contains several references to the same test method GETGradeForGuestStudent.. which I find weird at first sight but it depends on how you're running the tests.
Related
I have upgraded my Opensearch cluster from 1.3 to 2.4.1 (using RPM - just following the instructions on https://opensearch.org/) The cluster runs on openjdk 17.0.5 that comes with the RPM).
I use to be able to leverage the SQL plugin like so:
curl --location --request POST 'https://my_cluster/_plugins/_sql' --header 'Content-Type: application/json'
--data-raw '{ "query": "SELECT date, #timestamp, value FROM profiler_outputs-*", "fetch_size": 100}'
But since I upgraded, I get:
{'error':
{'reason': 'There was internal problem at backend',
'details': 'Index type [profiler_outputs-*] does not exist',
'type': 'IllegalArgumentException'},
'status': 500}
If I use an actual index name, instead of a pattern, it works (aka 'profiler_outputs-2023-02-09').
If I use '_plugins/_sql?format=json' it also works - as in it gives me the result in json format.
It also works in csv. But somehow, in JDBC (default return format) it always errors out if I use an index pattern. Is this a bug or am I missing something? I need the JDBC format so that I can paginate the result.
I'm using karate v0.9.6, and it's wonderful tool.
I have a >1000 scenarios, each of them need to token for work, so i use callSingle in karate-config.js for creating and caching tokens. I use standalone jar file.
Part of my karate-config.js:
var auth_cfg = {
server: env,
credentials: karate.properties['credentials']};
var result = karate.callSingle('classpath:credentials/generate_tokens.feature', auth_cfg);
I'm using .sh file like this:
rm -rf target &&
java -Xmx2048m \
-Dlogback.configurationFile=cfg/logs_debug.xml \
-jar \
-Dcredentials=data.json \
karate-1.0.1.jar -e https://my-server/ \
--tags ~fixme \
--tags ~ignore \
--threads 4 \
features/services/simple_plan.feature
And, it's working perfectly on v.0.9.6 long time.
But, when I'm try to upgrade to v 1.0 or 1.0.1, a give an error:
org.graalvm.polyglot.PolyglotException: not found: credentials/generate_tokens.feature
I found this issue: https://github.com/intuit/karate/issues/1515
But examples not working for me. I'm trying use "file:" and karate.properties['karate.config.dir'] + '/features/auth/auth.feature'.
Always i got an error:
not found: credentials/generate_tokens.feature
Who else has faced this problem?
As you can see in the discussion of #1515 - this is why we'd really like more folks to try the RC versions and give us feedback (we spent months on this) instead of waiting for 1.0.
Yours seems to be an edge case where you are using the stand-alone JAR and a custom shell script.
My first suggestion is to use the -w flag. This is a new argument in 1.0 which can set the "current working directory", but it should default correctly in your case.
The second suggestion is to set the classpath for the JVM. Use this as a reference: https://stackoverflow.com/a/58398958/143475 - and once you do that, classpath: will work as you expect.
Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and I have to say that unless you can help us fix this, you may have to remain on 0.9.6 for a while. Sorry.
Peter Thomas, thank you for fast response!
I modify callSingle function, and .feature file wich called by callSingle - change "classpath:" to "file:"
karate.callSingle('file:credentials/generate_tokens.feature', auth_cfg)
,
# read credentials
* def authdata = read('file:credentials/' + credentials)
and it's works now. Before, when i change classpath: to file: i, probably made a mistake.
Thanks for so awesome testing framework!
Currently I am using the following command to run my feature file:
mvn test -Dcucumber.options="--plugin html:target/cucumber-html --tags #dogs" -Dtest=TestParallel.java -Dkarate.env=Pets
But I wish to add another variable while calling running the command. Something like this:
mvn test -Dcucumber.options="--plugin html:target/cucumber-html --tags #dogs" -Dtest=TestParallel.java -Dkarate.env=Pets -Dname=Charlie
How can I do that?
You can pass extra dynamic parameters using a combination of Java system-properties and reading karate.properties
mvn test -Dtest=TestParallel.java -Dkarate.env=pets -Dmy.name=foo
And then in karate-config.js
var myName = karate.properties['my.name'];
Or even in any feature file:
* def myName = karate.properties['my.name']
Kindly do note that -Dcucumber.options="--plugin html:target/cucumber-html" does not have any effect in Karate and will be deprecated in the future.
I'm using Newman and Postman to test a website.
My Newman command construction looks like:
newman run
"https://api.getpostman.com/collections/{collection_id}?apikey={my_postman_api_key}"
--environment "https://api.getpostman.com/environments/{environment_id}?apikey={my_postman_api_key}"
--export-environment "https://api.getpostman.com/environments/{environment_id}?apikey={my_postman_api_key}"
--insecure
This all works fine but my environment values don't update after the Newman run.
In my request, I use a Pre-request Script to update the value:
var mail = pm.environment.get("mail_randomizer");
pm.environment.set("mail_randomizer", Number(mail) + 1);
After sending this request in Postman, the value for the mail_randomizer variable has gone up by 1 but after running the request using Newman, it doesn't work.
How can I export the environment correctly in Newman?
create
.env : environment variable let's say
url = http://localhost:3000/api
.env.example should be
url =
in your test call :
var local-url = process.env.url;
add in your package json
npm install dotenv
I would like to use the prestashop app from a php script (external_script.php) located outside prestashop folder but still on the same server.
I could do that with Magento using :
require_once external_folder/magento/app/Mage.php;
I've tried to include prestashop/config/config.inc.php and prestashop/init.php but it redirects external_script.php to prestashop index.php
Any help would be greatly appreciated.
STEF
Add the following 2 lines at the start of your PHP script and then you can use all the classes and functions of PrestaShop:
include(dirname(__FILE__).'/../../config/config.inc.php');
include(_PS_ROOT_DIR_.'/init.php');
Also, include the main class file whose functions you want to call in the external script, it must be some of your module's file. For example:
include_once(__PATH__TO__CLASS__FILE__.'/xyzmodule.php');
After adding the above codes to include required files you can simply create objects of the class file you want to call and use its code. For example:
$xObj = new Xyzmodule();
$xObj->callingXFunction();
Hope this helps.
Magento is a well structured Zend project and it's easy to bootstrap the app to use it outside HTTP front controller, PrestaShop is another story it's really a big mess of spaghetti code, to bootstrap the app really depends os PS version and in some cases on installed modules that changes core behaviour.
To start you can first include the config/config.inc.php file that is on PS root dir, this will init the PS classloader and a bunch of configuration defines, if you use another autoloader and a old version on PS (<1.6) you need to workaround it, this is a simple bootstrap code that allow make any PS call:
<?php
// Load PS config and autoloader
define ('PS_DIR', __DIR__ . '/../ps-wtf');
require_once PS_DIR .'/config/config.inc.php';
// I use this to load compoper dependencies
require_once __DIR__ . '/../vendor/autoload.php';
// Call old __autoload() if present, required for PrestaShop old versions
if (function_exists('__autoload')) {
spl_autoload_register(function ($className) {
__autoload($className);
});
}
// Init Shop context, required some operation will fail without it
// adust accordly to multistore PS >= 1.6
Shop::setContext(Shop::CONTEXT_ALL);
// Init PS context, some modules require that this context was initialized and with correct data
// some core function fired in the admin require at least a employee
define ('PS_DEFAULT_EMPLOYEE', 1);
$psContext = Context::getContext();
if (!$psContext->employee) {
$psContext->employee = new Employee(PS_DEFAULT_EMPLOYEE);
}
// You can make any API call
$cat = new Category();
$cat->name = [
1 => 'New',
2 => 'Nuevo',
];
$cat->id_parent = 1;
$cat->save();
echo $cat->id;
Some PS functionality depends on correct initialization of some core classes (Yes it's crazy), you can take a look at ControllerCore and FrontControllerCore to see what is happening in the normal PS request flow.
I hope that this can help.
The way prestashop is designed won't let you do this kind of thing easily.
I think your best bet is to use their web service API : http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service
There is a PHP client library for this : https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/master/PSWebServiceLibrary.php
You can also use curl, but be warned : they use a lot of different tokens on differents pages, this is quite annoying.
Here is some bash code to log yourself in, grab some tokens and upload an import file. You can adapt it to PHP curl and do anything else you want :
r=$(curl -k -c cookies -b cookies -s --request POST -d "ajax=1&token=&controller=AdminLogin&submitLogin=1&passwd=[YOU_PASSWORD_URL_ENCODED]&email=[YOUR_EMAIl_URL_ENCODED]" 'https://[YOUR_PRESTASHOP_HOST_OR_LOCALHOST]/[YOUR_PRESTASHOP_ADMIN_DIR]/index.php')
token=$(echo $r | sed -n 's/.*token=\([0-9a-zA-Z]*\).*/\1/gp')
admin_token=$(curl -k -c cookies -b cookies 'https://[YOUR_PRESTASHOP_HOST_OR_LOCALHOST]/[YOUR_PRESTASHOP_ADMIN_DIR]/index.php?controller=AdminDashboard&token='"$token" | sed -n '0,/.*?_token=\([-_0-9a-zA-Z]*\).*/s/.*?_token=\([-_0-9a-zA-Z]*\).*/\1/p')
brand_file_name=$(curl -k -c cookies -b cookies -F 'file=#local_path_of_a_file.xlsx' 'https://[YOUR_PRESTASHOP_HOST_OR_LOCALHOST]/[YOUR_PRESTASHOP_ADMIN_DIR]/index.php/configure/advanced/import/file/upload?_token='"$admin_token" | sed -nE 's/.*"name":"([^"]*).*/\1/gp')