Executor is not getting displayed in Allure reports. I have created a executor.json file which has only 1 attribute i.e., tester as we can see the code below
executor.json
{"Tester":"Suhail"}
when I generate the report I am not getting Executor field it is showing as Unknow as you can see the screenshot attached below
I am using Allure version-2.13.2
can anyone help me where I am going wrong
As you already found out the Executor is display if you have a executor.json file in your allure-results folder when you generate your report.
This file is usually generated by your builder, for example Jenkins with the plugin allure.
If you want to manually add theses informations here what the file look like:
executor.json
{
"name": "Jenkins",
"type": "jenkins",
"url": "http://example.org",
"buildOrder": 13,
"buildName": "allure-report_deploy#13",
"buildUrl": "http://example.org/build#13",
"reportUrl": "http://example.org/build#13/AllureReport",
"reportName": "Demo allure report"
}
I was going through this and found out interesting so posting it as an answer,if anyone has more details on this please paste your answer.
So here is my findings,
in executor.json file, we need to have general syntax like below
{"name":"Suhail", // this will print the tester name on the report
"buildName":"Give the project Name", // if this attribute is not given that **Unknown** is displayed
"type":"jenkins" // if this attribute is not given we will be getting a user icon next to the name else a hat icon will be displayed
}
I could find only this much, if anyone know how to enter more records of executors then please let me know.
Related
I am using Netlogo Api Controller With spring boot
this my code (i got it from this link )
HeadlessWorkspace workspace = HeadlessWorkspace.newInstance();
try {
workspace.open("models/Residential_Solar_PV_Adoption.nlogo",true);
workspace.command("set number-of-residences 900");
workspace.command("set %-similar-wanted 7");
workspace.command("set count-years-simulated 14");
workspace.command("set number-of-residences 500");
workspace.command("set carbon-tax 13.7");
workspace.command("setup");
workspace.command("repeat 10 [ go ]");
workspace.command("reset-ticks");
workspace.dispose();
workspace.dispose();
}
catch(Exception ex) {
ex.printStackTrace();
}
i got this result in the console:
But I want to get the table view and save to database. Which command can I use to get the table view ?
Table view:
any help please ?
If you can clarify why you're trying to generate the data this way, I or others might be able to give better advice.
There is no single NetLogo command or NetLogo API method to generate that table, you have to use BehaviorSpace to get it. Here are some options, listed in rough order of simplest to hardest.
Option 1
If possible, I'd recommend just running BehaviorSpace experiments from the command line to generate your table. This will get you exactly the same output you're looking for. You can find information on how to do that in the NetLogo manual's BehaviorSpace guide. If necessary, you can run NetLogo headless from the command line from within a Java program, just look for resources on calling out to external programs from Java, maybe with ProcessBuilder.
If you're running from within Java in order to setup and change the parameters of your BehaviorSpace experiments in a way that you cannot do from within the program, you could instead generate experiment XML files in Java to pass to NetLogo at the command line. See the docs on the XML format.
Option 2
You can recreate the contents of the table using the CSV extension in your model and adding a few more commands to generate the data. This will not create the exact same table, but it will get your data output in a computer and human readable format.
In pure NetLogo code, you'd want something like the below. Note that you can control more of the behavior (like file names or the desired variables) by running other pre-experiment commands before running setup or go in your Java code. You could also run the CSV-specific file code from Java using the controlling API and leave the model unchanged, but you'll need to write your own NetLogo code version of the csv:to-row primitive.
globals [
;; your model globals here
output-variables
]
to setup
clear-all
;;; your model setup code here
file-open "my-output.csv"
; the given variables should be valid reporters for the NetLogo model
set output-variables [ "ticks" "current-price" "number-of-residences" "count-years-simulated" "solar-PV-cost" "%-lows" "k" ]
file-print csv:to-row output-variables
reset-ticks
end
to go
;;; the rest of your model code here
file-print csv:to-row map [ v -> runresult v ] output-variables
file-flush
tick
end
Option 3
If you really need to reproduce the BehaviorSpace table export exactly, you can try to run a BehaviorSpace experiment directly from Java. The table is generated by this code but as you can see it's tied in with the LabProtocol class, meaning you'll have to setup and run your model through BehaviorSpace instead of just step-by-step using a workspace as you've done in your sample code.
A good example of this might be the Main.scala object, which extracts some experiment settings from the expected command-line arguments, and then uses them with the lab.run() method to run the BehaviorSpace experiment and generate the output. That's Scala code and not Java, but hopefully it isn't too hard to translate. You'd similarly have to setup an org.nlogo.nvm.LabInterface.Settings instance and pass that off to a HeadlessWorkspace.newLab.run() to get things going.
I have recently converted my project from JUnit5 to TestNG, solely for the purpose of getting decent reports.
I have added a listener that generates the report at the end of each run:
#Override
public void onFinish(ITestContext context) {
System.out.println("FINISH. Sending email report.");
utils.EmailHandler.sendEmail("Finished test", context.toString());
}
My problem is that the reports being sent by email are not from the current run, as desired, but the previous run.
Yet if I open the report in /test-output/custom-report.html using Eclipse IDE it is the correct one!
How do I ensure the emails sent out are current?
I have looked at a couple of similar questions here, but neither are appropriate to me:
Similar questions:
TestNg emailable-report is not updating?
ReportNG HTML report not updating
It finally worked when I moved the call to sendEmail to the end of the GenerateReport method of the listener. That removes all confusion and ensures that that output file is complete before attempting to send it out.
Unless, you 're somehow attaching the old version; from your description, I would say that most likely the file is created AFTER the email is being sent (hence previous version every-time). However, if this theory is correct, it must have emailed an empty file the first time :) Did it?
Idea: insert a couple of minutes delay in your code where the email is being sent. Go check the file as soon as the email leaves the ground, I think it will be the old version (as it hasn't been created yet!)
Have you tried using the #AfterTest annotation? Not sure, but onFinish(ITestContext context) could be lingering somewhere between #AfterMethod and AfterTestcausing your email to leave slightly earlier; before fully attached! Not sure though, why you send an email after each test and not after the whole suite has finished [so to use onFinish(ISuite suite)].
#AfterTest
public void afterTest(ITestContext context) {
//improving answer after initial comments
if(bufferredWriter!=null){
bufferredWriter.close();
}
else{
System.out.println("FINISH. Sending email report.");
utils.EmailHandler.sendEmail("Finished test", context.toString());
}
}
Best of luck!
PS. Nevertheless, I would highly recommend to have a look at extentReports. Definitely better reporting than the built-in that comes with TestNG!
I am trying to build a Jenkins Post build plugin where I have to process JSON file (contains test results) and show it in tabular format in Jenkins once build is executed.
Following are the steps done till now:
Created Jenkins plugin
Able to retrieve JSON file content and read it as Google gson JSONElement.
Built BuildAction (extends Action) to show the results.
In index.jelly (view for BuildAction) corresponding to BuildAction, trying to show each record in JSON file, as a row.
JSON File sample:
{
"records": [{
"objectProps": {
"OTYPE": "TEST",
"NAME": "testMethodError",
}
},
{
"objectProps": {
"OTYPE": "TEST",
"NAME": "testMethodFail",
}
}]
}
BuildAction class:
public class BuildAction implements Action {
private JsonElement results;
private Run<?, ?> build;
TaskListener listener;
// this value referred as `it.results` in `index.jelly`
public JsonArray getResults(){
return results.getAsJsonObject().get("records").getAsJsonArray();
}
}
current index.jelly for above BuildAction class
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<l:layout>
<st:include it="${it.build}" page="sidepanel.jelly"/>
<l:main-panel>
<table> Test - Wise Results
<j:forEach items="${it.results}" var="i">
<tr><td>Test case name: ${i}</td></tr>
</j:forEach>
</table>
</l:main-panel>
</l:layout>
</j:jelly>
Actual behaviour:
As of now, ${results} value is of JSONArray type. forEach in jelly, I am able iterate over and get the record using var i (syntax ${i}). i refers to each record in records JSONArray. Now, I want to access objectProps.NAME field using i, I don't know the syntax in Jelly to achieve the same.
Expected behaviour:
I wan to iterate through records array in JSON file and each child/jsonObject as one table row (and its values as corresponding columns).
something similar to this (to access NAME value):
<j:forEach items="${it.results}" var="i">
<tr><td>Test case name: ${i}."objectProps"."NAME"</td></tr>
</j:forEach>
Need help in building the table out of a JSON using Jelly. Any other way of achieving the same also welcome (please post code samples when suggesting the same).
Note: Groovy related answer also welcome as Jenkins support both Jelly and Groovy for View.
I am interested in solving you problem, but might not have a 100% certain answer as I can't test locally.
Have you tried to use ${i.objectProps.NAME}or ${i."objectProps"."NAME"} instead of ${i}."objectProps"."NAME"in your example?
You could also see if g:evaluate is available, as jelly might not evaluate your variable without explicitly telling it to do so. You can find some documentation on g:evaluate here.
I have a XML from which I want to create a Jasper report keeping XML as datasource. Report contains a Sub report so I set tag in main report because I need to iterate through all but as root is now set as for Main report , i am unable to sent another tag which is not inside , to make things more clearer please see the XML bellow.
<Root>
<containerInfo>...</containerInfo>
<containerInfo>...</containerInfo>
<containerInfo>...</containerInfo>
<StuffingInfo>...</StuffingInfo>
<StuffingInfo>...</StuffingInfo>
<StuffingInfo>...</StuffingInfo>
<StuffingInfo>...</StuffingInfo>
</root>
I need to set ContainerInfo as Root for main report and send StuffingInfo in "Data Source Expression" in sub report , which I can't do as Root is ContainerInfo and its not allowing Expression "../StuffingInfo" for subreports.
I have set Root node as ContainerInfo in main Report , so main report detail are working fine and I tried setting everything in "Data Source Expression" of sub report but nothing seems to work , data for sub report is coming all NULL.
Please let me know if my question is not clear enough. any help is most appreciated.
I downloaded google calendar api sample from http://code.google.com/p/google-api-java-client/source/browse/calendar-cmdline-sample/?repo=samples and created a project in eclipse.
Now when i try to run the project am getting java.lang.IllegalArgumentException: no JSON input found at this line
FileCredentialStore credentialStore = new FileCredentialStore(
new File(System.getProperty("user.home"), ".credentials/calendar.json"), JSON_FACTORY);
Have any of you tried this example? what is wrong here?
This error can be resolved by providing input to the .credentials/calendar.json file. If you manually provided the following entry in the calendar.json , it will work :
{
"installed": {
"client_id": "client_id",
"client_secret": "client_secret"
}
}
It seems to be the Windows problem which is not allowing to set writable permissions on calendar.json file . The method setWritable(boolean,boolean) is returning false and so is the cause of this problem. Still providing json input manually is not a perfect solutions but your application will work.
That may happen when your application executed before and it created empty .credentials/calendar.json file in you home dir. That may happen if you're running your application in Windows, cause FileCredentialStore tries to do:
file.setReadable(false, false)
and fails.
To solve it just remove calendar.json. Although you might have another error: [unable to set file permissions]
which I don't know how to solve yet.
Is that project having calendar.json resource file. Please share complete exception stack trace.
Seems some required configuration missed from calendar.json file