cucumber-JVM report after every scenario - cucumber-jvm

We have test automation scripts in Cucumber-JVM. At the moment it takes about 2 hours to execute our scripts and we are using json formatter for report. We get report after execution.
Is there a way to publish cucumber.json report after every scenario using json formatters? I should be able to see the report during the execution. I dont have to wait until all the scripts are completed.

More detail (e.g. is runtime Jenkins? Eclipse on linux desktop? Are you using log4j ?) would have been helpful. That being said, in the After hook you can write the scenario status to a file that you can then tail.
#After
public void afterScenarioExecution(Scenario scenario) {
log = Logger.getLogger(YourClass.class);
log.info("Scenario: '" + scenario.getName() + "' has status " + scenario.getStatus());
}
}
Your log4j.properties file could look like this:
# root level configurations
log4j.rootLogger=INFO,console,file
# configuration for console outputs
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1}:%L - %m%n
# configuration for file output (into a file named messages.log)
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=messages.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# threshold for file output
log4j.appender.file.Threshold=INFO
Of course if you have a console then no need to tail.

Related

java.lang.nullpointer exception in jmeter in Non-GUI mode

When i try to execute my Jmeter (version 5.3) recorded script in Non-GUI mode, using a remote server, it displays a "java.lang.NullPointerException" while generating the dashboard(HTML) report. Also, my CSV file (or jtl report) is creating an empty file without any data.
I have used loop controller to call my http request .
I have added sample variables to my jmeter.properties file so that they can be recorded.
Also , I have set "jmeter.save.saveservice.output_format=csv" in properties file.
The summarizer shows 0 and it shows error in generating report: java.lang.nullpointerexception.
Also, my log file shows the following:
Please let me know if there is any possible way to overcome this issue. Thanks in advance!
You're getting this error because you're trying to generate HTML reporting dashboard from an empty .jtl results file
In its turn the .jtl results file is empty because no Samplers were executed
And finally no samplers were executed because all your Thread Groups are disabled
Open your .jmx script in JMeter GUI
Right click each Thread Group
Choose "Enable" from the context menu
Save the test plan
If for some reason you cannot open JMeter GUI just change this line(s) in the .jmx file:
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="false">
to
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
with your favourite text editor or use Taurus tool which can change any property of any element in the runtime
I re-installed jmeter and the same script worked well for me. Cheers!

Is there a way to use WLST to get JVM arguments of a WebLogic node?

How can one get the JVM startup arguments of a WebLogic node, using WLST? This would be the same information gathered from the Admin console (Environment --> Server Start tab --> Arguments) as shown outlined in red in the screen-shot here.
This data seems to also appear in a properties file at path $WEBLOGIC_DOMAIN_PATH/servers/$NODE_NAME/data/nodemanager but I would like if possible to grab this information from inspecting a live instance of a running WebLogic node.
Here is a WLST snippet that successfully gets the CLASSPATH, but not the JVM start up arguments:
domainRuntime()
svrRuntimes = domainRuntimeService.getServerRuntimes()
for svr in svrRuntimes:
serverName = svr.getName()
# Successfully gets CLASSPATH using the following syntax...
print str(serverName) + " CLASSPATH: " + str(svr.getServerClasspath())
# Would like to also be able to get JVM startup arguments, like
# the following commented-out line, which does not work:
# print str(serverName) + " ARGS: " + str(svr.getArguments())
Many thanks for any suggestions on this. I have been sifting through many websites and the WLST reference trying to find out how to do this.
You can request this information from the mbean "java.lang:type=Runtime" and its attribute "InputArguments" :
on=ObjectName("java.lang:type=Runtime")
attrs=mbs.getAttribute(on,"InputArguments")
for attr in attrs:
print attr

Hive - How can I stop logs displaying in console?

I have been trying to omit logs from console while querying in hive, but still it is showing up.
If you are opening the hive console by typing
> hive
in your terminal and then write queries, you can solve this by simply using
> hive -S
This basically means that you are starting hive in silent mode.
Hope that helps.
You could increase the polling interval to minutes or hours:
SET hive.exec.counters.pull.interval=[millis];
The default is 1000 milliseconds, but you can increase it to anything you like. That should decrease the number of logs written to stdout.
If you don't want any logs on the console while starting the shell you can set the hive.root.logger property
$HIVE_HOME/bin/hive --config hive.root.logger=INFO,DRFA
hive.root.logger specifies the logging level as well as the log
destination. Specifying console as the target sends the logs to the
standard error (instead of the log file).
If you want to see ERROR messages on console you can set this command
$HIVE_HOME/bin/hive --config hive.root.logger=ERROR,console
Start hive in silent mode using
$ hive -S
then Set logger level to Error, which will avoid Warnings/Info from printing.
hive> set logger.PerfLogger.level = ERROR;
If there is "SLF4J: Class path contains multiple SLF4J bindings." in your log, it means that there are multiple log4j jars (different versions, different behaviors) in the class path
I don't know the principle of log4j, but according to the Hadoop configuration file, perform the following steps:
cd $HIVE_HOME/conf
cat > log4j.properties <<EOL
log4j.rootLogger=WARN, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
EOL
After starting hive (Hive 3.1.2 Apache), the log is set to WARN level, which may not necessarily work, but you can try it.

JMeter Test Results Monitoring/ Analysis

I want to start load testing by running JMeter from command line for more accurate test results, but how can I monitor the run and then analyze the results after the test finishes.
You can generate JTL (JMeter results) file while executing the JMX (JMeter script) file from command line. A sample command for generating JTL file will look like this..
jmeter -n -t path-to-jmeterScript.jmx -l path-to-jtlFile.jtl
After completion of script execution you can open the JMeter GUI and simply open the JTL file in any listener (as per your requirement).
Most of the listeners in JMeter have an option to save the results into a file. This file contains usually not the report itself, but the samples which are generated by the tests. If you define this filename, you can generate the reports using these saved files. For example see http://jmeter.apache.org/usermanual/component_reference.html#Summary_Report .
If you run JMeter in command-line non-GUI mode passing results file name via -l parameter it will output results there. After test finishes you will be able to open the file with the Listener of your choice and perform the analysis.
By default JMeter writes results in chunks, if you need to monitor them in real time add the following line to user.properties file (lives under /bin folder of your JMeter installation)
jmeter.save.saveservice.autoflush=true
You can use other properties which names start with jmeter.save.saveservice.* to control what metrics you need to store. The list with default values can be seen in jmeter.properties file. See Apache JMeter Properties Customization Guide for more information on various JMeter properties types and ways of working with them.
You can also consider running your JMeter test via Taurus tool - it provides some statistics as the test goes either in console mode or via web interface.

null printing on console

This is my log4j configuration file, whenever I run the batch file to execute the test case, a number of nulls are printed on the console. I have no experience with log4j, but I guess I have not assigned testAppender to ConsoleAppender, then why it is printing on console.
log4j.logger.com.rbs.rmd_test_suite.util.TestSuiteLogger=DEBUG, testAppender
log4j.appender.testAppender=org.apache.log4j.RollingFileAppender
log4j.appender.testAppender.File= ../log/rmd_test_suite_info.log
log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.testAppender.layout.ConversionPattern=%m%n
log4j.appender.testAppender.append=true
#Prevent internal log4j DEBUG messages from polluting the output.
log4j.logger.org.apache.log4j.PropertyConfigurator=INFO
log4j.logger.org.apache.log4j.config.PropertySetter=INFO
log4j.logger.org.apache.log4j.FileAppender=INFO
#Disabling logging of external jars
log4j.rootLogger=Off
log4j.logger.org.openqa = OFF
I am using Selenium Web Driver API to automate test cases for an application. Any help is appreciated.
Logging in the file is perfectly fine. Problem is the nulls that are being printed on console.
One possible reason I can think of is, your log4j.properties file is not in the bin folder of your app.
Edited : Got it your rootLogger is OFF
log4j.rootLogger=Off
Instead use
log4j.rootLogger=ALL
log4j.logger.org.openqa=ALL
log4j.rootLogger=ALL, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n