I am trying to use allure report with jbehave on Java using maven. So there is a package that has a java class that we can use to create the allure report.
I only imported that class and I added the class as a reportBuilder for the configuration of Jbehave, just like the code below.
...
import io.qameta.allure.jbehave.AllureJbehave
...
public class RunStories extends JUnitStories {
private AllureJbehave allureJBehave;
...
...
#Override
public Configuration configuration() {
// set path of results
System.setProperty("allure.results.directory", "build/allure-results")
// create AllureJbehave instance
allureJBehave = new AllureJbehave();
StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
.withReporters(allureJBehave)
.withCodeLocation(codeLocationFromClass(this.getClass()));
// create and return configuration instance
Configuration jBehaveConfiguration = new MostUsefulConfiguration();
jBehaveConfiguration
.useStoryReporterBuilder(reporterBuilder);
return jBehaveConfiguration;
}
}
But I am not getting the information for trends graphs, how can I add those values or add more information to the allure report ?
You might want to check the plugin file (allure.yml) you are using for Allure. in case there is none, you can add your own with the list of plugins you are interested to use and add it to your configuration.
You can also check the read access of your files. If you are using Jenkins (for example), sometimes there is some access rights that are inherited and that can cause some issues when read.
Related
How can you use an Apex class from the hello.apex script in a newly created standard project with VS Code?
This is probably really simple, I thought I should use some 'using' or 'include' statement but I cannot find the information. This is what I did:
I am working from VS Code.
sfdx create project.
chosen: Standard.
In the directory scripts/apex I open the file hello.apex.
Log in to org, vscodeOrg.
sfdx Execute Anonymous Apex with Editor contents, this succeeds.
sfdx Create Apex Class, called NewClass with static function
right under the constructor I add a static method, the complete class code is now:
public with sharing class NewClass {
public NewClass() {
}
public static void Test() {
System.debug('call from apex class');
}
}
The file is located in: ...\NewStandardProject\force-app\main\default\classes\NewClass.cls
Go back to hello.apex, execute still succeeds.
I add in the hello.apex file:
NewClass.Test();
Making the script code this:
string tempvar = 'Enter_your_name_here';
System.debug('Hello World!');
System.debug('My name is ' + tempvar);
NewClass.Test();
The editor gives me 'Intelligent code completion', so it seems my new class is known.
I try to execute again with 'Execute Anonymous Apex with Editor contents', it fails with this feed back:
Error: Variable does not exist: NewClass
If I replace the static call with e.g.
NewClass nc = new NewClass();
It gives the same error.
If I replace public with global in NewClass, that also does not help.
What am I doing wrong here?
Answering my own question then to make this complete:
Install sfdx
Install vs sfdx plug in
Press Ctrl-Shift P to call the sfdx from vs code
sfdx create project -> Standard
In the directory scripts/apex, open the file hello.apex
Log in to org, vscodeOrg (or if you have no standard org yet call control shift p, sfdx create a default scratch org)
sfdx Execute Anonymous Apex with Editor contents, this succeeds
sfdx Create Apex Class, called NewClass with static function
right under the constructor I add a static method, the complete class code is now:
public with sharing class NewClass {
public NewClass() {
}
public static void Test() {
System.debug('call from apex class');
}
}
In the left pain click on the file in the project directory and choose 'sfdx deploy source to org'.
(And that step as a developer customed to working with local executables, I forgot).
Add in the hello.apex file: NewClass.Test();
Making the code there:
// Use .apex files to store anonymous Apex.
// You can execute anonymous Apex in VS Code by selecting the
// apex text and running the command:
// SFDX: Execute Anonymous Apex with Currently Selected Text
// You can also execute the entire file by running the command:
// SFDX: Execute Anonymous Apex with Editor Contents
string tempvar = 'Enter_your_name_here';
System.debug('Hello World!');
System.debug('My name is ' + tempvar);
NewClass.Test();
I try to execute again with 'Execute Anonymous Apex with Editor contents'.
In the output amongst a few other lines you should see: 'call from apex class'.
I was developing a pagefactory based framework. I had earlier used pagefactory.initements method to inintialise and move from page to page. Init method basically does the same work as saying Homepage HP = new HomePage(driver);
So it is necessary to use init method in pagefactory?
Will we loose something if we do not use it and instead use new to create a page.
If you are using a Java PageFactory with annotations yes.
The PageFactory.initElements(driver, My.class) command parses the annotations and sets up the Java Proxy classes. If you don't .initElements() none of the WebElements in your class will have locators assigned to them and they will all be null.
You can put the .initElements() in your constructor if you just want to new up a page e.g.:
public class MyPage {
public MyPage(WebDriver driver) throws Exception {
PageFactory.initElements(driver, this);
}
}
I've just started developing plugins in jenkins and tried to implement a root action by writing a plugin which implements RootAction. From the documentation of this interface (http://javadoc.jenkins-ci.org/?hudson/model/RootAction.html) it seems very easy compared to other plugins but I'm not getting it to work..
Here is my class which implements RootAction:
#Extension
public class MultiActionView implements RootAction {
public String getIconFileName() {
return "/plugins/multi-action-view/images/24x24/myPicture.png";
}
public String getDisplayName() {
return "My RootAction";
}
public String getUrlName() {
return "http://www.stackoverflow.com/";
}
}
I see that my plugin is installed but nothing shows in the sidepanel despite it says in the documentation that the rootaction will be added automatically. I've tried with and without an index.jelly file in the appropriate folder of my project but with no positive results.
Does anyone have any idea of why this plugin is not showing or can come with a working example of how to create a simple root action in jenkins? Thanks!
// Bogge
I am using Enterprise Library 5.0 in my win-form Application.
1. Regarding creating instances of Enterprise Library objects
What is the best way to Resolve the reference for Logging / exception objects? In our application, we have different applications in solution. So Solutions have below project:
CommonLib (Class Lib)
CustomerApp (winform app)
CustWinService (win service proj)
ClassLib2 (class Lib)
I have implemented logging / exceptions as below in CommonLib project. Created a class AppLog as below:
public class AppLog
{
public static LogWriter defaultWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();
public static ExceptionManager exManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
public AppLog()
{
}
public static void WriteLog(string LogMessage, string LogCategories)
{
// Create a LogEntry and populate the individual properties.
if (defaultWriter.IsLoggingEnabled())
{
string[] Logcat = LogCategories.Split(",".ToCharArray());
LogEntry entry2 = new LogEntry();
entry2.Categories = Logcat;
entry2.EventId = 9007;
entry2.Message = LogMessage;
entry2.Priority = 9;
entry2.Title = "Logging Block Examples";
defaultWriter.Write(entry2);
}
}
}
And then I used Applog class as below for logging and exception in different projects:
try
{
AppLog.WriteLog("This is Production Log Entry.", "ExceCategory");
string strtest = string.Empty;
strtest = strtest.Substring(1);
}
catch (Exception ex)
{
bool rethrow = AppLog.exManager.HandleException(ex, "ExcePolicy");
}
So its the correct way to use Logging and Exception? or any other way i can improve it?
2. Logging File Name dynamic
In logging block, we have fileName which need to be set in app.config file. Is there a way I can assign fileName value dynamically through coding? Since I don't want to hard code it in config file and paths are different for production and development environment.
Thanks
TShah
To keep your application loosely coupled and easier to test, I would recommend defining separate logging and exception handling interfaces, then having your AppLog class implement both. Your application can then perform logging and exception handling via those interfaces, with AppLog providing the implementation.
You can have a different file name set per environment using config transforms, which I believe you can use in a winforms application by using Slow Cheetah.
You cannot vote on your own post
0
Hi.
I am developing this (http://arg-co.com/SabteNam%20-%20Copy.zip) windows application, and for my DAL I use Entity Framework. But every single extension has its own EntityTypeConfiguration, so I decided to use [Import] and [Export] to add them in OnModelCreating method of my DbContext.The problem here is that, in 'SabteNamDbContext' class which is located on 'SabteNamDataAccess' library, the '_Configs' is not initialized so I cant iterate it and add its items to 'modelBuilder.Configurations'.
In the source code of 'SampleConfiguration' class, I commented out '[Export(typeof(IDbConfiguration))]' but even Uncommenting this part of code, do not cause application to work properly.
Intresting point is that, if I use the following code in 'Main' windows form, the '_Configs' would be initialized :
[ImportMany(typeof(IDbConfiguration))]
public IEnumerable<EntityTypeConfiguration<object>> _Configs { get; set; }
How can this be fixed ?
While I realize this is probably no longer of use to you, we use a variation on this model from OdeToCode, which I advise you read.
In our case, we have created an interface for our extensions in general, not just for the entity configuration like Scott did, which allows us not only to load the configurations, but also factory and test data per extension, add new permission types to the core application, etc.
Our OnModelCreating looks something like this:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// load core object mappings
modelBuilder.Configurations.Add(new UserConfiguration());
modelBuilder.Configurations.Add(new PermissionConfiguration());
// get plugin assemblies
var catalog = new DirectoryCatalog("bin");
var container = new CompositionContainer(catalog);
container.ComposeParts();
var plugins = container.GetExportedValues<IPlugin>();
// load plugin object mappings
foreach (IPlugin plugin in plugins)
{
plugin.RegisterDomainEntities(modelBuilder.Configurations);
}
base.OnModelCreating(modelBuilder);
}