No video

Part 7 Cucumber Test Runner class creation

In this video I have explain how to create cucumber test runner class

Пікірлер: 18

  • @amitasingh5799
    @amitasingh57994 жыл бұрын

    Awesome! Very nicely explained.

  • @shankarraj3433
    @shankarraj34333 жыл бұрын

    @RunWith(Cucumber.class) @CucumberOptions(features = {"src/test/resources/features/simple.feature"} ,glue = {"stepdefinitions"} ,plugin = {"pretty", "html:target/cucumber"} ) public class TestRunner { } In this JUnit Runner Class, if I use the absolute path for 'stepdefinitions' i.e 'src/test/java/stepdefinitions' - the browser is not responding. But if I use only the folder name i.e 'stepdefinitions' - the browser opens and works fine. Is there any specific reason for this?

  • @NirajGupta

    @NirajGupta

    3 жыл бұрын

    @Shankar Raj Yes.If you pass the step definition then some of the step might be missing that why it does not work. Example suppose if you have put the common step in other class and hooks are present in another class then how it will be execute. cucumber is keyword and data driven frame work so it will search for step in all the class.

  • @shankarraj3433

    @shankarraj3433

    3 жыл бұрын

    Thanks

  • @intellectuallearning8118

    @intellectuallearning8118

    Жыл бұрын

    It is because we already have a Default Dependency ( ) added in our POM.xml and that dependency helps Cucumber to reach up to src/test/java and when you try to write it explicitly it doesn't work!!

  • @anitharaj1970
    @anitharaj1970 Жыл бұрын

    Hi thanks for the session I have put all common stepdefinition in another as a jar sonincan use across multiple projects. But runner class is not picking that step definition. Can U please guide

  • @NirajGupta

    @NirajGupta

    Жыл бұрын

    you need to mention the package path in runner class glue = "com.automation"

  • @NirajGupta
    @NirajGupta Жыл бұрын

    The Runner class with latest cucumber jar version 7.6.0 /* private static final Logger LOGGER = LogManager.getLogger(CommonUtil.class); public static WebConnector webConnector = WebConnector.getInstance(); public WebConnector webConnector=WebConnector.getInstance(); WebDriver driver=webConnector.getDriver();*/ package com.automation.action; import java.text.SimpleDateFormat; import java.util.Date; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.openqa.selenium.WebDriver; import com.github.mkolisnyk.cucumber.runner.ExtendedCucumber; import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions; import com.github.mkolisnyk.cucumber.runner.ExtendedParallelCucumber; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = "src/test/resources/", tags={ "@AddToCart"}, plugin = { "html:target3/cucumber-html-report", "json:target3/cucumber.json", "junit:target3/cucumber.xml" ,"rerun:target/rerun.txt" }, glue = "com.automation" ) public class TestRunner { @BeforeClass public static void beforeClass(){ //For BeforeClass annotation static is compulsory because JVM calls it directly if(System.getProperty("Browser")==null){ System.setProperty("Browser", "chrome"); } if(System.getProperty("headless")==null){ System.setProperty("headless","no"); } if(System.getProperty("ENV")==null){ System.setProperty("ENV", "SIT"); } if(System.getProperty("ExecuteOn")==null){ System.setProperty("ExecuteOn", "null"); } if(System.getProperty("Remote")==null){ System.setProperty("Remote", "yes"); } //for one time driver object initialization //SeleniumUtil.initializeSeleniumConnector(); //SeleniumUtil.getInstance(); SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd hh-mm-ss"); System.setProperty("currentdate", dateFormat.format(new Date())); //SeleniumUtil.cleanFolder(1, "Logs");//delete all except todays } @AfterClass public static void afterClass(){ } }

  • @abhilash6200
    @abhilash6200 Жыл бұрын

    Hi Sir if u have used cucumber latest versions >6.8.1 please share the video... I am having challenges with cucumber >6.8.1

  • @NirajGupta

    @NirajGupta

    Жыл бұрын

    What chanlleges are you facing

  • @sreekanthpdas7118
    @sreekanthpdas71183 жыл бұрын

    Can anyone share the pom.xml file with all the needed dependencies for Cucumber with all latest stable versions ?

  • @NirajGupta

    @NirajGupta

    3 жыл бұрын

    4.0.0 com.portal.aucdt.edu PortalAucdtEdu_Cucumber_IO_Junit 0.0.1-SNAPSHOT jar PortalAucdtEdu_Cucumber_IO_Junit UTF-8 org.apache.maven.plugins maven-compiler-plugin 3.7.0 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin 2.22.2 true 7 true **/TestRunner.class **/TestRunner2.class **/TestRunner3.class net.masterthought maven-cucumber-reporting 5.3.0 execution verify generate cucumber-jvm-example ${project.build.directory}/cucumber-JVM-reports true 1 false ${project.build.directory} **/cucumber.json true true org.codehaus.mojo exec-maven-plugin 1.6.0 first-execution install java test com.aucdt.edu.util.SendEmail junit junit 4.13 test org.seleniumhq.selenium selenium-java 3.141.59 io.cucumber cucumber-junit 6.10.4 test io.cucumber cucumber-java 6.10.4 log4j log4j 1.2.17 io.github.bonigarcia webdrivermanager 4.0.0 com.relevantcodes extentreports 2.40.2 io.rest-assured rest-assured 3.2.0 test com.sun.mail javax.mail 1.5.5

  • @achuthramireddy
    @achuthramireddy3 жыл бұрын

    can you provide pom.xml file of this video

  • @NirajGupta

    @NirajGupta

    3 жыл бұрын

    4.0.0 com.portal.aucdt.edu AucdtEduTest 0.0.1-SNAPSHOT jar AucdtEduTest UTF-8 org.apache.maven.plugins maven-compiler-plugin 3.7.0 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin 2.22.2 true 7 true **/TestRunner.class **/TestRunner2.class **/TestRunner3.class junit junit 4.13 test org.seleniumhq.selenium selenium-java 3.141.59 info.cukes cucumber-junit 1.2.6 info.cukes cucumber-java 1.2.6 log4j log4j 1.2.17

  • @achuthramireddy

    @achuthramireddy

    3 жыл бұрын

    @@NirajGupta sir I had completed selenium+java(data driven framework,BDD framework ) in cognizant.I am looking for another opportunity for another company.can you provide any suggestions for me sir

  • @achuthramireddy

    @achuthramireddy

    3 жыл бұрын

    @@NirajGupta this is my mobile number 9705455087

  • @Labordorrocks
    @Labordorrocks2 жыл бұрын

    Can you pls latest dependency

  • @NirajGupta

    @NirajGupta

    2 жыл бұрын

    which one you want to use cucumber-java8 or cucumber-java11 or simply any java io.cucumber cucumber-java 7.5.0

Келесі