TestNG running on different threads when using timeout, Is there a possibility we can use same thread












0















I am trying to create a threadLocal webdriver.



Trying to initialize and login into over application in @BeforeClass.



@test is having functionality. This test is working properly but whenever i use @test(timeOut=1200) it is getting failed due to timeOut's in Testng run on a different thread.



But whenever there is a timeOut in the @test(timeOut=1200) TestNG is creating Two new thread for the @beforeclass and @test.



Is there a possibility that it will run in a single thread.



I have tried TestNG-7.0.0-beta1 with -Dtestng.thread.affinity=true JVM agrument.
But it stills fails to fulfill my requirement.



Thanks,
balraj










share|improve this question

























  • Can you try this @Test(timeOut=1000) // specify time in milliseconds

    – Manoj Kengudelu
    Nov 14 '18 at 12:50











  • sorry manoj that is not what i required anyways thanks for the help

    – balraj dacha
    Nov 15 '18 at 9:10
















0















I am trying to create a threadLocal webdriver.



Trying to initialize and login into over application in @BeforeClass.



@test is having functionality. This test is working properly but whenever i use @test(timeOut=1200) it is getting failed due to timeOut's in Testng run on a different thread.



But whenever there is a timeOut in the @test(timeOut=1200) TestNG is creating Two new thread for the @beforeclass and @test.



Is there a possibility that it will run in a single thread.



I have tried TestNG-7.0.0-beta1 with -Dtestng.thread.affinity=true JVM agrument.
But it stills fails to fulfill my requirement.



Thanks,
balraj










share|improve this question

























  • Can you try this @Test(timeOut=1000) // specify time in milliseconds

    – Manoj Kengudelu
    Nov 14 '18 at 12:50











  • sorry manoj that is not what i required anyways thanks for the help

    – balraj dacha
    Nov 15 '18 at 9:10














0












0








0








I am trying to create a threadLocal webdriver.



Trying to initialize and login into over application in @BeforeClass.



@test is having functionality. This test is working properly but whenever i use @test(timeOut=1200) it is getting failed due to timeOut's in Testng run on a different thread.



But whenever there is a timeOut in the @test(timeOut=1200) TestNG is creating Two new thread for the @beforeclass and @test.



Is there a possibility that it will run in a single thread.



I have tried TestNG-7.0.0-beta1 with -Dtestng.thread.affinity=true JVM agrument.
But it stills fails to fulfill my requirement.



Thanks,
balraj










share|improve this question
















I am trying to create a threadLocal webdriver.



Trying to initialize and login into over application in @BeforeClass.



@test is having functionality. This test is working properly but whenever i use @test(timeOut=1200) it is getting failed due to timeOut's in Testng run on a different thread.



But whenever there is a timeOut in the @test(timeOut=1200) TestNG is creating Two new thread for the @beforeclass and @test.



Is there a possibility that it will run in a single thread.



I have tried TestNG-7.0.0-beta1 with -Dtestng.thread.affinity=true JVM agrument.
But it stills fails to fulfill my requirement.



Thanks,
balraj







selenium-webdriver testng testng-dataprovider testng-eclipse






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 11:17







balraj dacha

















asked Nov 14 '18 at 12:33









balraj dachabalraj dacha

64




64













  • Can you try this @Test(timeOut=1000) // specify time in milliseconds

    – Manoj Kengudelu
    Nov 14 '18 at 12:50











  • sorry manoj that is not what i required anyways thanks for the help

    – balraj dacha
    Nov 15 '18 at 9:10



















  • Can you try this @Test(timeOut=1000) // specify time in milliseconds

    – Manoj Kengudelu
    Nov 14 '18 at 12:50











  • sorry manoj that is not what i required anyways thanks for the help

    – balraj dacha
    Nov 15 '18 at 9:10

















Can you try this @Test(timeOut=1000) // specify time in milliseconds

– Manoj Kengudelu
Nov 14 '18 at 12:50





Can you try this @Test(timeOut=1000) // specify time in milliseconds

– Manoj Kengudelu
Nov 14 '18 at 12:50













sorry manoj that is not what i required anyways thanks for the help

– balraj dacha
Nov 15 '18 at 9:10





sorry manoj that is not what i required anyways thanks for the help

– balraj dacha
Nov 15 '18 at 9:10












1 Answer
1






active

oldest

votes


















0














As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.



But this behavior is applicable only for the @Test method and not for




  • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)

  • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations


[ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].



This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914






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%2f53300354%2ftestng-running-on-different-threads-when-using-timeout-is-there-a-possibility-w%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














    As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.



    But this behavior is applicable only for the @Test method and not for




    • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)

    • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations


    [ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].



    This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914






    share|improve this answer




























      0














      As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.



      But this behavior is applicable only for the @Test method and not for




      • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)

      • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations


      [ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].



      This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914






      share|improve this answer


























        0












        0








        0







        As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.



        But this behavior is applicable only for the @Test method and not for




        • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)

        • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations


        [ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].



        This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914






        share|improve this answer













        As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.



        But this behavior is applicable only for the @Test method and not for




        • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)

        • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations


        [ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].



        This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 18 '18 at 6:46









        Krishnan MahadevanKrishnan Mahadevan

        8,63531643




        8,63531643






























            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%2f53300354%2ftestng-running-on-different-threads-when-using-timeout-is-there-a-possibility-w%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

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python