How to pause XCUITest for manual Simulator manipulation?












3















I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?



Right now I'm just doing this:



class QDBUITestHost: XCTestCase {

override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}

override func tearDown() {}

func testHosting() {
let app = XCUIApplication()
app.buttons["Select Group"].tap()
app.sheets.buttons["com-mist-qdb-1"].tap()
app.buttons["Host"].tap()
sleep(600) // This is an ugly hack
}

}


So, is there a better way to do this, rather than to just sleep(600)?










share|improve this question


















  • 2





    Add breakpoints in the XCUITest...

    – emreoktem
    Nov 11 '18 at 23:43






  • 1





    The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

    – Alex Ioja-Yang
    Nov 21 '18 at 10:35








  • 2





    I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

    – Gero
    Nov 21 '18 at 10:50











  • This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

    – JBL
    Nov 26 '18 at 14:02
















3















I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?



Right now I'm just doing this:



class QDBUITestHost: XCTestCase {

override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}

override func tearDown() {}

func testHosting() {
let app = XCUIApplication()
app.buttons["Select Group"].tap()
app.sheets.buttons["com-mist-qdb-1"].tap()
app.buttons["Host"].tap()
sleep(600) // This is an ugly hack
}

}


So, is there a better way to do this, rather than to just sleep(600)?










share|improve this question


















  • 2





    Add breakpoints in the XCUITest...

    – emreoktem
    Nov 11 '18 at 23:43






  • 1





    The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

    – Alex Ioja-Yang
    Nov 21 '18 at 10:35








  • 2





    I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

    – Gero
    Nov 21 '18 at 10:50











  • This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

    – JBL
    Nov 26 '18 at 14:02














3












3








3








I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?



Right now I'm just doing this:



class QDBUITestHost: XCTestCase {

override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}

override func tearDown() {}

func testHosting() {
let app = XCUIApplication()
app.buttons["Select Group"].tap()
app.sheets.buttons["com-mist-qdb-1"].tap()
app.buttons["Host"].tap()
sleep(600) // This is an ugly hack
}

}


So, is there a better way to do this, rather than to just sleep(600)?










share|improve this question














I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?



Right now I'm just doing this:



class QDBUITestHost: XCTestCase {

override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}

override func tearDown() {}

func testHosting() {
let app = XCUIApplication()
app.buttons["Select Group"].tap()
app.sheets.buttons["com-mist-qdb-1"].tap()
app.buttons["Host"].tap()
sleep(600) // This is an ugly hack
}

}


So, is there a better way to do this, rather than to just sleep(600)?







ios swift xcode xcuitest






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 '18 at 20:31









eivindmleivindml

3141723




3141723








  • 2





    Add breakpoints in the XCUITest...

    – emreoktem
    Nov 11 '18 at 23:43






  • 1





    The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

    – Alex Ioja-Yang
    Nov 21 '18 at 10:35








  • 2





    I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

    – Gero
    Nov 21 '18 at 10:50











  • This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

    – JBL
    Nov 26 '18 at 14:02














  • 2





    Add breakpoints in the XCUITest...

    – emreoktem
    Nov 11 '18 at 23:43






  • 1





    The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

    – Alex Ioja-Yang
    Nov 21 '18 at 10:35








  • 2





    I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

    – Gero
    Nov 21 '18 at 10:50











  • This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

    – JBL
    Nov 26 '18 at 14:02








2




2





Add breakpoints in the XCUITest...

– emreoktem
Nov 11 '18 at 23:43





Add breakpoints in the XCUITest...

– emreoktem
Nov 11 '18 at 23:43




1




1





The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

– Alex Ioja-Yang
Nov 21 '18 at 10:35







The whole point of UITests is to automate UI testing. If you need to interfere with it, you either didn't set them up fully or it's work in progress and might as well test manually. As others said, you can use breakpoints but if you need 10 minutes wait, I suspect you're running a few changes while putting the test in standby, so manual testing and once you know what you're trying to achieve set up your accessibilityIdentifiers on all the components?

– Alex Ioja-Yang
Nov 21 '18 at 10:35






2




2





I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

– Gero
Nov 21 '18 at 10:50





I second Alex's notion in general, but want to point something out in addition. Whether by a sleep(x) or a breakpoint, you completely halt the test process, which is probably not a good idea (as it contains some behind-the-scenes stuff to track the app that's being tested, e.g. it checks for the app to become idle, as indicated by the logs). That might make the entire process not just a bad approach, but also fickle. Maybe you want to edit the question to explain why you want to do that? Perhaps this gives you a better way out of a, perhaps only perceived, problem you try to solve.

– Gero
Nov 21 '18 at 10:50













This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

– JBL
Nov 26 '18 at 14:02





This feels like an XY problem, that might be sovled in a better way if you could give more details as to what exactly you need this pause for. This could be useful to reach a point where your whole suite is automated, which would be kinda required if you want to have your code regularly and automatically tested (on a CI server for example).

– JBL
Nov 26 '18 at 14:02












1 Answer
1






active

oldest

votes


















0














There is a xctwaiter framework.



You can use expectations to wait the results. They are very flexible.



let result = XCTWaiter().wait(for:[expectation], timeout: 10)



How to use an expectation you can see in the documentation. An example.






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%2f53252948%2fhow-to-pause-xcuitest-for-manual-simulator-manipulation%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














    There is a xctwaiter framework.



    You can use expectations to wait the results. They are very flexible.



    let result = XCTWaiter().wait(for:[expectation], timeout: 10)



    How to use an expectation you can see in the documentation. An example.






    share|improve this answer




























      0














      There is a xctwaiter framework.



      You can use expectations to wait the results. They are very flexible.



      let result = XCTWaiter().wait(for:[expectation], timeout: 10)



      How to use an expectation you can see in the documentation. An example.






      share|improve this answer


























        0












        0








        0







        There is a xctwaiter framework.



        You can use expectations to wait the results. They are very flexible.



        let result = XCTWaiter().wait(for:[expectation], timeout: 10)



        How to use an expectation you can see in the documentation. An example.






        share|improve this answer













        There is a xctwaiter framework.



        You can use expectations to wait the results. They are very flexible.



        let result = XCTWaiter().wait(for:[expectation], timeout: 10)



        How to use an expectation you can see in the documentation. An example.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 22:12









        VyacheslavVyacheslav

        14.1k962122




        14.1k962122






























            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%2f53252948%2fhow-to-pause-xcuitest-for-manual-simulator-manipulation%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