Forum Discussion

denioflavio's avatar
denioflavio
Occasional Contributor
12 years ago
Solved

Organizing Test Scripts


Hi everybody!


 


I would like to receive some tips about how could I do to organize my scripts.


What I mean is:


I have a lot of test cases. Should I group them into a single script, or it's better to keep each test case in a especific script (file). 


What´s the best practice about these questions?


 


Best regards.


Dênio

  • I think it's best to consider how you would organize any set of programs. Current thinking is to break up just about anything into reusable packages of around 10 lines, and assemble these into larger script units, building size as you go.  The scripts get too long to follow if they are too big.  My practical limit is how much code I can see on my screen at a time, so that I see everything that I am working on at once rather than having to rely on my memory. Scripts are organized by subdirectories.  One script file can also contain a number of sub scripts.  I put a numbered index of what scripts are in a file in a header at the top of the file and number the scripts so I can quickly go down through a file and find what I am looking for.



    I also have a MiscFunctions file that has scripts common  to all other functions and various specialized MiscFunctions that server related groups of files.  The key is to not repeat yourself in coding.

2 Replies

  • I think it's best to consider how you would organize any set of programs. Current thinking is to break up just about anything into reusable packages of around 10 lines, and assemble these into larger script units, building size as you go.  The scripts get too long to follow if they are too big.  My practical limit is how much code I can see on my screen at a time, so that I see everything that I am working on at once rather than having to rely on my memory. Scripts are organized by subdirectories.  One script file can also contain a number of sub scripts.  I put a numbered index of what scripts are in a file in a header at the top of the file and number the scripts so I can quickly go down through a file and find what I am looking for.



    I also have a MiscFunctions file that has scripts common  to all other functions and various specialized MiscFunctions that server related groups of files.  The key is to not repeat yourself in coding.
  • sastowe's avatar
    sastowe
    Super Contributor
    No one else has chimed in, so I will give it a try. Organization is a matter that is directly related to the goals of the testing. I can't see a best practice that is universally appropriate. That said, I will try to explain what I do and why.



    First of all, I have a great many object mappings and MSAA mappings and the like that are necessary to work with my application under test. I make sure these are in the Default Project Properties so that I don't have to edit them when I add a new project.



    I have one project suite for the application under test and the corresponding utilities that I use to support my automated testing efforts. Under that I have a project zzzSuiteCommon. I append the zzz just to ensure that it is alphabetically at the bottom of my list of projects. In that project, I put project items that I can and want to share. I share my TestedApps and name mapping there, and clearly common reusable script procedures.



    I have a project for each functional area of the application under test. For example, I might have a project for orders and another for fullfilment if I was writing a shopping cart and fullfilment product.



    In Test Items, there are a few things that drive how I organize my tested apps.


    • All test cases that use the same setup are grouped together under one test item group. Each test case has a test item under that.


    • Each test case that I want as a node in the Log file is a Test Item in the test items project tab. I could Append and Pop folders in code, but this is simpler.


    • I consider how I want execution to stop in the event that a test fails or errors. This helps me determine what I want in the test items tab of the project.




    Don't know if this helps...