Cucumber test failed : Exception in thread "main" java.lang.NoClassDefFoundError: io/cucumber/plugin/SummaryPrinter - selenium-webdriver

I was trying to execute basic test from Cucumber feature file but found the error:
Exception in thread "main" java.lang.NoClassDefFoundError: io/cucumber/plugin/SummaryPrinter
Feature File:
Feature: Login Action
Scenario: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters UserName and Password
Then Message displayed Login Successfully
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully
Test Runner File:
package test;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "Feature"
,glue={"stepdefinition"}
)
public class TestRunner {
}
I am using eclipse and have installed cucumber plugin through eclipse marketplace.
Can anyone help me to fix this issue?

package cucumberOptions;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
//#RunWith(Cucumber.class)
#CucumberOptions(
features = "src/test/java/features",
glue = "stepDefinations")
public class TestRunner extends AbstractTestNGCucumberTests {
}
Just keep in mind that features, stepDefinations, are folders at the same level, also my testRunner class is inside a folder called 'cucumberOptions' which is at the same level than the other 2 folders, in my case they are inside test folder, since this is a maven like project

It looks that missing dependency of one of the jar. It's really bean hectic and cumbersome with new versions of cucumber as there are always coming with breaking changes. I also seen same error while upgrading from cucumber 5.1.3 to 5.7.0. After spending sometime i resolved it by adding below additional dependency in pom:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-plugin</artifactId>
<version>5.7.0</version>
</dependency>

Related

Target class [App\\Http\\EnsureFrontendRequestsAreStateful] does not exist

I am using Laravel Sanctum to authenticate a react SPA with a laravel API backend.
While I am trying to access routes which does not need authentication, I am getting this error:
"Target class [App\Http\EnsureFrontendRequestsAreStateful] does not exist."
What should I do to guard only some routes, while leaving others open.
You are probably missing the import in the app/Http/Kernel.php file.
// app/Http/Kernel.php
<?php
namespace App\Http;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
This can usually be solved with: composer dump-autoload
You can read more about what the command does here
composer dump-autoload won’t download a thing. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project.

Flink Cannot load user class on running from IDE

I have a Flink application and generating a fat jar with all its dependencies I can submit it successfully on the remote cluster, using flink run command. Trying to submit the application on IntelliJ IDE, I faced the folloing error:
Caused by: org.apache.flink.streaming.runtime.tasks.StreamTaskException: Cannot load user class: MyFlink$1
ClassLoader info: URL ClassLoader:
file: '/tmp/blobStore-0fe289f8-b35b-4666-8402-67f9f6a22f55/cache/blob_3fd776b533f2268b6cf7ef1cc62b187bc4513c99' (valid JAR)
Class not resolvable through given classloader.
I packaged dependencies in a single jar file and pass it in createRemoteEnvironment method.
StreamExecutionEnvironment env = StreamExecutionEnvironment.createRemoteEnvironment(
"jobmanager", 6123, 2,
"FlinkProcessing_dependencies.jar"
);
How can I disaper this error?
Notice: Passing all user-defined classes in addition to dependencies, it runs successfully, but I don't want to pass the classes jars and export a jar file each time I change my classes!

How do I set up Allure with JUnit in an IntelliJ project?

I've been reading in the Allure wiki however I do not seem to be able to get started with Allure.
I have an IntelliJ project which I use to run JUnit tests with Selenium. I want to add Allure for better feedback after test runs. However I've not been able to understand how Allure would integrate with the rest of my project.
On the wiki page for JUnit it looks like Allure with JUnit only supports maven projects? How can I set up allure to work with an IntelliJ project?
I want to add Allure for better feedback after test runs
It is strange that you don't have a build tool.
But for single test (as you mention) following will work.
Dependencies - you need aither allure-junit-adaptor or allure-testng-adaptor
Allure implements test listener, which should be added to test runner:
For TestNG it happens automatically (once you add adaptor dependency).
For JUnit you should add listener manually. I don't know how to add it to Intellij Idea JUnit runner, but you can always run tests programmatically:
public static void main(String[] args) {
JUnitCore runner = new JUnitCore();
runner.addListener(new AllureRunListener());
runner.run(CalculatorTest.class);
}
That will generate XML report in target/allure-results folder.
If you need advanced Allure features like file attachments and test steps you need another dependency (aspectjweaver) and according JVM args, e.g.
-javaagent:lib/aspectjweaver-1.8.7.jar
To generate HTML report from existing XML report you can:
either use Allure CLI (requires tool installation http://wiki.qatools.ru/display/AL/Allure+Commandline)
or use 'mvn site' on existing project (e.g. https://github.com/allure-examples/allure-junit-example)
Open your HTML report in Firefox (or look here how to open locally generated report in Chrome).
To have allure-results after launching JUnit4 tests from IDE using context menu or controls on the gutter I use #RunWith anntotation where I set my custom runner with AllureJUnit4 listener.
CustomRunner class
package ru.atconsulting.qa.system.junit4runners;
import io.qameta.allure.junit4.AllureJunit4;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.InitializationError;
public class CustomRunner extends BlockJUnit4ClassRunner {
/**
* Creates a BlockJUnit4ClassRunner to run {#code klass}
*
* #param klass
* #throws InitializationError if the test class is malformed.
*/
public CustomRunner(Class<?> klass) throws InitializationError {
super(klass);
}
#Override
public void run(RunNotifier notifier) {
notifier.addListener(new AllureJunit4()); //just add listener
super.run(notifier);
}
}
Using #RunWith annotation in test classes
#RunWith(CustomRunner.class)
public class ExampleSuite {
#Test
public void testExample() {
....
}
}

Camel: org.apache.camel.ResolveEndpointFailedException: No component found with scheme

I have a custom Camel component packaged in a separate jar. As advised here:
http://camel.apache.org/how-do-i-add-a-component.html
I created a file a META-INF/services/org/apache/camel/component/aq (aq is the component scheme name) containing:
class=<full class name>
Everything works When I run a test program standalone. However, when I try deploying it into a container (servicemix, karaf) it cannot resolve the component scheme name:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route7: Route(route7)[[From[aq:oprDequeuer]] -> [WireTap[properties:... because of Failed to resolve endpoint: aq://queue1 due to: No component found with scheme: aq
Also, when I register the component explicitly:
CamelContext context = getContext();
context.addComponent("aq", new AQComponent(context));
it works fine, including ServiceMix.
Make sure that file in META-INF is included in the JAR.
If that file is missing then the component cannot be auto discovered, and that is your problem. As you build a component for OSGi, then maybe the felix bundle plugin somehow does not include that file.
I suggest to double check this, and look inside the built JAR if the file is included.

ImportError: No module named pydevd_vm_type

I'm using PyCharm 2.6.3 and Python 2.7.5 for my Google Application Engine project.
Today occurred strange error when I was trying to debug my GAE project:
ImportError: No module named pydevd_vm_type
Module exists but doesn't want to be imported somewhere in debug tools.
When I trying to type "import pydevd_vm_type", autocomplete tool gives me right path to that module. How can I solve this issue?
Problem solved!
File Path_on_disk\PyCharm 2.6.3\helpers\pydev\pydevd.py
Error occurs in class
class PyDBCommandThread(PyDBDaemonThread)
in method
def OnRun(self)
...
import pydevd_vm_type
if pydevd_vm_type.GetVmType() == pydevd_vm_type.PydevdVmType.JYTHON and sys.hexversion <= 0x020201f0:
# a lot of comments about Jython bug
run_traced = False
and next in
import pydevd_tracing
if run_traced:
pydevd_tracing.SetTrace(None) # no debugging on this thread
I've deleted those two imports. PROFIT!!!

Resources