locked
Coded UI: Launch a test case from another test case RRS feed

  • Question

  • Hi

    I wonder if it is possible to launch a Coded UI test case from inside another Coded UI test case.

    BR Stefan

    Friday, March 8, 2013 1:22 PM

Answers

  • Hello Stefen,

    Now I know your scenario. I have tried a coded UI test project which is similar wit yours. I find that the TestInitialize method and TestCleanup method of “Log In” won’t be executed when you call the test method of “Log In” in the TestInitialize method or a test method of “Add Cart”.

    So I am afraid that you can’t do like what you have done. Maybe you can give up the TestInitialize method of “Log In” and put what you want to do into the test method of “Log In” in order to perform something in TestInitialize method of “Log In” in “Add Cart”. If no help, not coding expert, I am afraid that I don’t have other good solutions for this issue.

    If you think that having the TestInitialize method of “Log In” execute in the TestInitialize method of “Add Cart” is important to you, you could submit this feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    The Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Monday, March 18, 2013 12:40 AM
    Wednesday, March 13, 2013 2:31 AM

All replies

  • Hello Stefan,

    Thank you for your post.

    Not sure your coded UI test scenario. I have created a coded UI test with two Coded UI Test methods. I can call one coded UI test method in another Coded UI test method successfully.

    If I have misunderstood anything, please feel free to let me know.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 11, 2013 8:20 AM
  • Hi Amanda! Thanks for your answer.

    My intention was to be able to call test cases recursively. That means that if I have a TC (eg "Log In") as a pre-condition to another test case (let´s say "Add cart"), then I want to be able to call this test case in the Init method of the "Add cart" method. Naturally I want the Log in test case to run as an ordinary Coded UI test case with Init , Clean Up, etc..

    BR Stefan



    Monday, March 11, 2013 9:44 AM
  • Hello Stefan,

    I assume that you mean that you have two coded UI test class for Log in test case and Add Cart test case in the same coded UI test project.

    If so, you can call the Log In test method of the corresponding test class in the TestInitialize method of Add Cart test class like this:

    If two test case are on different test class of different coded UI test project, you need to add reference to Log In coded UI test project in Add Cart coded UI test project, define a namespace of Log In coded UI test project in Add Cart test class and then you can call Log In test method in the TestInitialize method of Add Cart test class like the code above.

    Hope it can help you.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 12, 2013 2:27 AM
  • Hi Amanda

    I have two Coded UI classes in my project, one "Add Cart" and one "Log In". Each of them have their own Init, TestMethod and Clean up. The problem is that, if I call the CodedUITestMetod for "Log In" in the Init method of "Add Cart", then the Init of "Log In" won’t be executed. This is why I would like to be able to launce the test cases recursively.

    BR Stefan



    Tuesday, March 12, 2013 1:08 PM
  • Hello Stefen,

    Now I know your scenario. I have tried a coded UI test project which is similar wit yours. I find that the TestInitialize method and TestCleanup method of “Log In” won’t be executed when you call the test method of “Log In” in the TestInitialize method or a test method of “Add Cart”.

    So I am afraid that you can’t do like what you have done. Maybe you can give up the TestInitialize method of “Log In” and put what you want to do into the test method of “Log In” in order to perform something in TestInitialize method of “Log In” in “Add Cart”. If no help, not coding expert, I am afraid that I don’t have other good solutions for this issue.

    If you think that having the TestInitialize method of “Log In” execute in the TestInitialize method of “Add Cart” is important to you, you could submit this feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    The Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Monday, March 18, 2013 12:40 AM
    Wednesday, March 13, 2013 2:31 AM