GithubHelp home page GithubHelp logo

executeautomation / seleniumwithcucucumber Goto Github PK

View Code? Open in Web Editor NEW
197.0 197.0 930.0 1.1 MB

In this project we will discuss working Selenium with cucumber

HTML 50.38% Java 30.66% CSS 11.08% JavaScript 6.68% Gherkin 1.21%
cucumber framework idea intellij java selenium webdriver

seleniumwithcucucumber's Introduction

SeleniumWithCucumber

This is an sample project to demonstrate how to work with Selenium and cucumber for Java

Java CI with Maven

# Important
Make sure you have JAVA 10 or above installed to run this test

Access Cucumber Report online

Access Cucumber Report from GitHub pages running via GitHub Actions from here https://executeautomation.github.io/SeleniumWithCucucumber/cucumber-report-html/cucumber-html-reports/report-feature_file-src-test-java-features-Login-feature.html

Upgraded to Cucumber 4

The code is now upgraded to Cucumber 4 with new

Upgraded to Cucumber-JVM 5

The code is now upgraded to Cucumber 4 with new

  1. Libraries support
  2. Test Runner support
  3. Hooks (@BeforeStep and @AfterStep)
  4. DataTable code change

More Information

The complete code base development video is available in ExecuteAutomation YouTube channel https://www.youtube.com/playlist?list=PL6tu16kXT9Pqr70SZlwcmTSAfOw_0Qj3R

Cucumber BDD video Series (YouTube)

https://www.youtube.com/playlist?list=PL6tu16kXT9PpteusHGISu_lHcV6MbBtA6

Cucumber BDD video Series (Udemy)

https://www.udemy.com/cucumber-with-selenium/

For more articles and videos

Visit http://www.executeautomation.com

seleniumwithcucucumber's People

Contributors

anaghaprabhu19 avatar executeautomation avatar kartmcad avatar mohit10sharma avatar mohmeidax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seleniumwithcucucumber's Issues

"var" type not found? What am I missing?

What am I missing with this?

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile (default-testCompile) on project CucumberBasics: Compilation failure
[ERROR] /f:/gitprojects/SeleniumWithCucucumber/src/test/java/Base/ExtentReportUtil.java:[39,9] cannot find symbol
[ERROR] symbol: class var
[ERROR] location: class Base.ExtentReportUtil
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

NullPointerException in Hook.java

Hi,

  1. I just now downloaded the code and when I run the LoginStep feature I am getting the NullPointerException:

Step failed
java.lang.NullPointerException
at steps.Hook.InitializeTest(Hook.java:34)

I understand why we get this exception because we are not creating an instance of BaseUtil. How an instance of BaseUtil is created and passed to Hook and LoginUtil?

  1. Saw the video "Part 9 - Dependency Injection with Picocontainer for cucumber" of "Cucumber wit Selenium Java (Basic)", there also its not mentioned how Hook class constructor is called. so could you please explain.

Thanks
Krishna

hook.java

[ERROR] /C:/Users/Dell/.jenkins/workspace/BasicFreeStyle/src/test/java/steps/Hook.java:[34,59] illegal escape character
please add back lash

Testing Phase can't launch Chrome/FireFox browser

HI karthik, For me testing phase unable to lauch Firefox/Chrome browser, is there anything i am missing?

Running runner.TestRunner
Login with correct username and password
Closing the browser : MOCK
Login with correct username and password to fail
Closing the browser : MOCK

Failed scenarios:
Login.feature:4 # Scenario: Login with correct username and password
Login.feature:12 # Scenario: Login with correct username and password to fail

2 Scenarios (2 failed)
8 Steps (8 skipped)
0m0.003s


T E S T S

Running runner.TestRunner
Login with correct username and password
Closing the browser : MOCK
Login with correct username and password to fail
Closing the browser : MOCK

Failed scenarios:
Login.feature:4 # Scenario: Login with correct username and password
Login.feature:12 # Scenario: Login with correct username and password to fail

2 Scenarios (2 failed)
8 Steps (8 skipped)
0m0.003s

java.lang.NullPointerException
at steps.Hook.InitializeTest(Hook.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at cucumber.runtime.Utils$1.call(Utils.java:40)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:34)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:202)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:63)
at cucumber.api.testng.AbstractTestNGCucumberTests.feature(AbstractTestNGCucumberTests.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

java.lang.NullPointerException
at steps.Hook.InitializeTest(Hook.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at cucumber.runtime.Utils$1.call(Utils.java:40)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:34)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:202)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:63)
at cucumber.api.testng.AbstractTestNGCucumberTests.feature(AbstractTestNGCucumberTests.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.259 sec <<< FAILURE! - in runner.TestRunner
feature(runner.TestRunner) Time elapsed: 0.351 sec <<< FAILURE!
cucumber.runtime.CucumberException: java.lang.NullPointerException
Caused by: java.lang.NullPointerException

Results :

Failed tests:
TestRunner>AbstractTestNGCucumberTests.feature:21 » Cucumber java.lang.NullPoi...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[ERROR] There are test failures.

Please refer to C:\Users\santh.jenkins\workspace\SeleniumwithCucumberwithPipeline\target\surefire-reports for the individual test results.

Getting "lambda expressions are not supported in -source 1.5" error at line no.73 in Main.java

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/DemoFreestyleProject/src/main/java/com/ea/Main.java:[73,61] lambda expressions are not supported in -source 1.5
(use -source 8 or higher to enable lambda expressions)
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/DemoFreestyleProject/src/main/java/com/ea/Main.java:[118,50] method references are not supported in -source 1.5
(use -source 8 or higher to enable method references)
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.426 s
[INFO] Finished at: 2020-03-18T17:29:09+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project CucumberBasics: Compilation failure: Compilation failure:
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/DemoFreestyleProject/src/main/java/com/ea/Main.java:[73,61] lambda expressions are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable lambda expressions)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.