Cucumber-jvm @after with Appium driver












2















I'm using cucumber-jvm , and trying to implement global @After method which should be executed only once after all scenario's execution was completed.
The @After method should quit the appium driver.



Currently @After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.



Any help will be much appreciated










share|improve this question

























  • Use a jvm shutdown hook instead to close the appium driver.

    – Grasshopper
    Jan 1 at 8:11











  • are you executing sequentially?

    – niharika_neo
    Jan 2 at 3:59











  • Maybe this question could help.

    – troig
    Jan 2 at 11:39
















2















I'm using cucumber-jvm , and trying to implement global @After method which should be executed only once after all scenario's execution was completed.
The @After method should quit the appium driver.



Currently @After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.



Any help will be much appreciated










share|improve this question

























  • Use a jvm shutdown hook instead to close the appium driver.

    – Grasshopper
    Jan 1 at 8:11











  • are you executing sequentially?

    – niharika_neo
    Jan 2 at 3:59











  • Maybe this question could help.

    – troig
    Jan 2 at 11:39














2












2








2








I'm using cucumber-jvm , and trying to implement global @After method which should be executed only once after all scenario's execution was completed.
The @After method should quit the appium driver.



Currently @After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.



Any help will be much appreciated










share|improve this question
















I'm using cucumber-jvm , and trying to implement global @After method which should be executed only once after all scenario's execution was completed.
The @After method should quit the appium driver.



Currently @After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.



Any help will be much appreciated







appium hook cucumber-jvm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 7:24









Al Imran

703418




703418










asked Dec 31 '18 at 20:29









IgalIgal

1,552122952




1,552122952













  • Use a jvm shutdown hook instead to close the appium driver.

    – Grasshopper
    Jan 1 at 8:11











  • are you executing sequentially?

    – niharika_neo
    Jan 2 at 3:59











  • Maybe this question could help.

    – troig
    Jan 2 at 11:39



















  • Use a jvm shutdown hook instead to close the appium driver.

    – Grasshopper
    Jan 1 at 8:11











  • are you executing sequentially?

    – niharika_neo
    Jan 2 at 3:59











  • Maybe this question could help.

    – troig
    Jan 2 at 11:39

















Use a jvm shutdown hook instead to close the appium driver.

– Grasshopper
Jan 1 at 8:11





Use a jvm shutdown hook instead to close the appium driver.

– Grasshopper
Jan 1 at 8:11













are you executing sequentially?

– niharika_neo
Jan 2 at 3:59





are you executing sequentially?

– niharika_neo
Jan 2 at 3:59













Maybe this question could help.

– troig
Jan 2 at 11:39





Maybe this question could help.

– troig
Jan 2 at 11:39












1 Answer
1






active

oldest

votes


















0














You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.



When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:



#will reuse driver session for close browser after all testcase configured under xml test node
selenium.singletone=true
#will teardown after each scenario/testcase
selenium.singletone=Method
#will reuse driver session for group
selenium.singletone=Groups


If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.



Moreover, you can use all TestNG listener and annotations. For example:





  • @BeforeMethod:Invokes Before each Testcase/Scenario


  • @BeforeSuite: Invokes once before entire suite


  • @BeforeTest: Invokes once before each xml test node for each xml test node in configuration


  • @BeforeGroup: Invokes once before starting execution of test in group for each group


  • @AfterSuite: Invokes once after entire suite


  • @AfterTest: Invokes once after entire xml test node


  • @AfterGroup:Invokes once after all test in group for each group


  • @AfterMethod:Invokes after each Testcase/Scenario


Refer Gherkin with QAF






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53991190%2fcucumber-jvm-after-with-appium-driver%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.



    When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:



    #will reuse driver session for close browser after all testcase configured under xml test node
    selenium.singletone=true
    #will teardown after each scenario/testcase
    selenium.singletone=Method
    #will reuse driver session for group
    selenium.singletone=Groups


    If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.



    Moreover, you can use all TestNG listener and annotations. For example:





    • @BeforeMethod:Invokes Before each Testcase/Scenario


    • @BeforeSuite: Invokes once before entire suite


    • @BeforeTest: Invokes once before each xml test node for each xml test node in configuration


    • @BeforeGroup: Invokes once before starting execution of test in group for each group


    • @AfterSuite: Invokes once after entire suite


    • @AfterTest: Invokes once after entire xml test node


    • @AfterGroup:Invokes once after all test in group for each group


    • @AfterMethod:Invokes after each Testcase/Scenario


    Refer Gherkin with QAF






    share|improve this answer




























      0














      You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.



      When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:



      #will reuse driver session for close browser after all testcase configured under xml test node
      selenium.singletone=true
      #will teardown after each scenario/testcase
      selenium.singletone=Method
      #will reuse driver session for group
      selenium.singletone=Groups


      If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.



      Moreover, you can use all TestNG listener and annotations. For example:





      • @BeforeMethod:Invokes Before each Testcase/Scenario


      • @BeforeSuite: Invokes once before entire suite


      • @BeforeTest: Invokes once before each xml test node for each xml test node in configuration


      • @BeforeGroup: Invokes once before starting execution of test in group for each group


      • @AfterSuite: Invokes once after entire suite


      • @AfterTest: Invokes once after entire xml test node


      • @AfterGroup:Invokes once after all test in group for each group


      • @AfterMethod:Invokes after each Testcase/Scenario


      Refer Gherkin with QAF






      share|improve this answer


























        0












        0








        0







        You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.



        When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:



        #will reuse driver session for close browser after all testcase configured under xml test node
        selenium.singletone=true
        #will teardown after each scenario/testcase
        selenium.singletone=Method
        #will reuse driver session for group
        selenium.singletone=Groups


        If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.



        Moreover, you can use all TestNG listener and annotations. For example:





        • @BeforeMethod:Invokes Before each Testcase/Scenario


        • @BeforeSuite: Invokes once before entire suite


        • @BeforeTest: Invokes once before each xml test node for each xml test node in configuration


        • @BeforeGroup: Invokes once before starting execution of test in group for each group


        • @AfterSuite: Invokes once after entire suite


        • @AfterTest: Invokes once after entire xml test node


        • @AfterGroup:Invokes once after all test in group for each group


        • @AfterMethod:Invokes after each Testcase/Scenario


        Refer Gherkin with QAF






        share|improve this answer













        You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.



        When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:



        #will reuse driver session for close browser after all testcase configured under xml test node
        selenium.singletone=true
        #will teardown after each scenario/testcase
        selenium.singletone=Method
        #will reuse driver session for group
        selenium.singletone=Groups


        If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.



        Moreover, you can use all TestNG listener and annotations. For example:





        • @BeforeMethod:Invokes Before each Testcase/Scenario


        • @BeforeSuite: Invokes once before entire suite


        • @BeforeTest: Invokes once before each xml test node for each xml test node in configuration


        • @BeforeGroup: Invokes once before starting execution of test in group for each group


        • @AfterSuite: Invokes once after entire suite


        • @AfterTest: Invokes once after entire xml test node


        • @AfterGroup:Invokes once after all test in group for each group


        • @AfterMethod:Invokes after each Testcase/Scenario


        Refer Gherkin with QAF







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 4 at 20:07









        user861594user861594

        2,90131931




        2,90131931
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53991190%2fcucumber-jvm-after-with-appium-driver%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith