Should Coded UI tests be written in Linear or Structured format?


  • Hello, 

    It is my understanding that certain UI test automation solutions can be either linear or structured in terms of how test cases are developed.

    • Linear tests being those that play back actions as in A > B > C > D
    • Structured tests being those that play back actions as in A > if condition, then > B > else > C

    What is the ideal way of developing coded UI tests? So far I have not been able to find anything regarding Structured test case development in Visual Studio Coded UI tests. Help is appreciated.


    Wednesday, October 30, 2013 5:15 PM


  • Cesar,

    It really depends on your situation.

    If you are talking about project-level test organization, convention generally says that all tests should be independent of one another, in order to test specific functionality. But, if you have a situation where it is necessary for you to verify that a set of tests execute as desired in a specific order, you can look into Ordered Tests.

    If you are talking about organization within a test, that also depends. Linear tests are far more predictable: they are essentially the same a automated scripts that include step-by-step verification of a given set of results. With structured tests, though, you are often able to uncover more subtle bugs that wouldn't be possible in a linear test--but that comes at the expense of reliability.

    I use both in my solution with fair results. What I will say is that, if you make use of structured tests, you need to develop a way to manage your assertions and maintain a trail of where you are in the application. I do this with a number of static utility classes and a centralized assertion class that I pass my TestContext to whenever a failure occurs.


    Thursday, October 31, 2013 1:10 AM