getting error in "pretty" in cucumber file - cucumber

Getting below error while running the test runner file,can someone please suggest how to resolve this after changing the different version of the report, still facing the same error
cucumber.runtime.CucumberException: Only one formatter can use STDOUT, now both pretty and pretty use it. If you use more than one formatter you must specify output path with PLUGIN:PATH_OR_URL
at cucumber.runtime.formatter.PluginFactory.defaultOutOrFailIfAlreadyUsed(PluginFactory.java:185)
at cucumber.runtime.formatter.PluginFactory.convertOrNull(PluginFactory.java:144)
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:99)
at cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87)
at cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:245)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:291)
at com.sun.proxy.$Proxy14.done(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.done(JUnitReporter.java:227)
at cucumber.api.junit.Cucumber.run(Cucumber.java:101)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Test Runner File:-
package com.ntrs.msf.runner;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import com.ntrs.msf.managers.FileReaderManager;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
//#RunWith(CucumberWithSerenity.class)
#RunWith(Cucumber.class)
#CucumberOptions(tags = {"#IRR515-Test",}, features = "src/test/resources/features/", plugin = { "pretty",
"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" }, glue = {
"com/ntrs/msf/stepDefinitions" }, monochrome = false)
public class Holdings515_Test {
#AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
}
}

Try changing plugin = to format =
Does that help?

Related

jenkins pipeline import org.apache.poi

I am trying to automate with excel and can't import the org.apache.poi for use.
I try something like this:
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
pipeline {
agent any
stages {
stage('excel') {
steps {
script {
SXSSFWorkbook wb = new SXSSFWorkbook(100);
}
}
}
}
}
and get "unable to resolve class org.apache.poi.ss.usermodel.Row" with all of them.
In the script part the error is the same: "unable to resolve class SXSSFWorkbook".
If I download the jar file from search.maven.org where do I put it to be used?
If you are running on Tomcat you can add them to <TOMCAT_HOME>/lib directory. Else you can add them to your JDK itself, into $JAVA_HOME/jre/lib/ext/

I'm trying to run my tests in parallel using Courgette-JVM but i cant get this to run correctly

I need your help!
I'm trying to run parallel tests using Courgette-JVM and Cucumber but looks like when i try to run this way the tags are just ignored and it tries to run all tests...
When i use only Cucumber to execute the tags are used and it only runs the tests that i specify with tag.
My runner with Courgette-JVM:
package runner;
import courgette.api.CourgetteOptions;
import courgette.api.CourgetteRunLevel;
import courgette.api.CourgetteTestOutput;
import courgette.api.CucumberOptions;
import courgette.api.junit.Courgette;
import org.junit.runner.RunWith;
#RunWith(Courgette.class)
#CourgetteOptions(
threads = 1,
runLevel = CourgetteRunLevel.SCENARIO,
rerunFailedScenarios = false,
//rerunAttempts = 1,
testOutput = CourgetteTestOutput.CONSOLE,
reportTargetDir = "target/cucumber-reports",
cucumberOptions = #CucumberOptions(
features = "src/test/resources/features",
glue = "steps",
tags = {"#Carlos"},
publish = true,
plugin = {
"pretty",
"json:target/cucumber-reports/report.json",
"html:target/cucumber-reports/report.html"}
))
public class Runner2 {
}
My runner without Courgette-JVM:
package runner;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions( plugin = {"pretty", "html:target/cucumber-reports/report.html","json:target/cucumber-reports/report.json"},
features = "src/test/resources/features",
glue = {"steps"},
tags = "#Carlos",
publish = true
)
public class Runner{
}

Scriptrunner/ Copying Project while logged-in as another user

I want to use my script, so that it will be executed by someone who is not me, but another user (ServiceUser) in the Jira Instance.
This is my functioning code, but I do not know how to make someone else execute it.
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.AssigneeTypes
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.canned.jira.admin.CopyProject
import org.apache.log4j.Logger
import com.atlassian.jira.bc.projectroles.ProjectRoleService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.util.SimpleErrorCollection
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.security.roles.ProjectRoleActor
import com.atlassian.jira.bc.project.ProjectCreationData
import com.atlassian.jira.bc.project.ProjectService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.AssigneeTypes
import com.atlassian.jira.project.type.ProjectTypeKey
// the key for the new project
def projectKey = "EXA987"
def projectName = "EXA987"
def log = Logger.getLogger("com.onresolve.jira.groovy.MyScript")
Thread executorThread = new Thread(new Runnable() {
void run() {
def copyProject = new CopyProject()
def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : "SWTEMP",
(CopyProject.FIELD_TARGET_PROJECT) : projectKey,
(CopyProject.FIELD_TARGET_PROJECT_NAME) : projectName,
(CopyProject.FIELD_COPY_VERSIONS) : false,
(CopyProject.FIELD_COPY_COMPONENTS) : false,
(CopyProject.FIELD_COPY_ISSUES) : false,
(CopyProject.FIELD_COPY_DASH_AND_FILTERS) : false,
]
def errorCollection = copyProject.doValidate(inputs, false)
if(errorCollection.hasAnyErrors()) {
log.warn("Couldn't create project: $errorCollection")
}
else {
def util = ComponentAccessor.getUserUtil()
def adminsGroup = util.getGroupObject("jira-administrators")
assert adminsGroup // must have jira-administrators group defined
def admins = util.getAllUsersInGroups([adminsGroup])
assert admins // must have at least one admin
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(util.getUserByName(admins.first().name))
copyProject.doScript(inputs)
}
}
})
executorThread.start()
I stumbled upon other codes, using things like
def oldLoggedInUser = jiraAuthenticationContext.getLoggedInUser()
jiraAuthenticationContext.setLoggedInUser(serviceUser)
jiraAuthenticationContext.setLoggedInUser(oldLoggedInUser)
but it was not succesful for me.
I have used following solution to change user during script execution:
def authContext = ComponentAccessor.getJiraAuthenticationContext();
def currentUser = authContext.getLoggedInUser();
def superuser=ComponentAccessor.getUserManager().getUserByKey("ANOTHER_USER_ACCOUNT")
authContext.setLoggedInUser(superuser);
// < do the needed work>
authContext.setLoggedInUser(currentUser);
I had first issues as my used another account had not needed Jira access rights (and I got funny "user must be logged in" errors)

Kotlin - menuInflater cannot find reference of the xml file

I am trying to add create option menu to my activity, however the android-studio sent me this error
Unresolved reference: chat_app_menu
Here is my code in Kotlin
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.chat_app_menu)
return true
}
The line with menuInflater.inflate(R.menu.chat_app_menu) show me the error Unresolved reference: chat_app_menu
However, I have been create the resource file chat_app_menu.xml under res\menu\
Here are my import files
package com.example.chat_app
import android.R
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuInflater
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
My file directory:
What should I do to disable this error to make the app work?
Use your com.example.chat_app.R instead of android.R
import com.example.chat_app.R

ALL time groovy compilation error

All time am getting below error message in groovy...
Could not understand whats causing this " Unexpected token error" ????
I used to think only PERL give bad compilation error,now groovy outperforming it..
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
D:\Playground\groovy\release-b-work\cmd_line_soapui\trial.groovy: 12:
unexpected token: myrunner # line 12, column 1.
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
^
1 error
Code taken from comment;
import com.eviware.soapui.SoapUIProTestCaseRunner;
import com.eviware.soapui.support.*;
import com.eviware.soapui.model.*;
import com.eviware.soapui.impl.wsdl.*;
import com.eviware.soapui.*;
class trial {
def myrunner = new com.eviware.soapui.SoapUIProTestCaseRunner();
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
myrunner.setTestSuite("MediaAssetServiceTestSuite");
myrunner.setTestCase("createMediaAsset TestCase");
myrunner.run();
}
You need to put your code in a method
You can't just add code into a class at class level
Try:
import com.eviware.soapui.SoapUIProTestCaseRunner;
import com.eviware.soapui.support.*;
import com.eviware.soapui.model.*;
import com.eviware.soapui.impl.wsdl.*;
import com.eviware.soapui.*;
class trial {
def someMethod() {
def myrunner = new com.eviware.soapui.SoapUIProTestCaseRunner();
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
myrunner.setTestSuite("MediaAssetServiceTestSuite");
myrunner.setTestCase("createMediaAsset TestCase");
myrunner.run();
}
}

Resources