Every tool has some Good Practices to be followed be it scripting, variables, nomenclature,managing the global variables or functions etc.
The Best practices could be recommended by the tool vendor or the testing community develops one out of experiences.
What According to you are good practices one must follow in QTP(or any other Automation Tool). let me start the tread here. Do you think always keeping global varaibles and less persistent data is a good practise?
Hi,
As per my knowledge and with internet knowledge i have some of the below defined standards.
1. You should write your code as per the coding standards so that the code will be maintainable and understandable.
2. Proper comments should be added to the code
3. Don't write long ( in terms on number of lines) scripts or functions. You should break down a big functionality to few small functionalities and write functions to accomplish those small functionalities.
4. Avoid hard coding.. Use parameters and supply the data.
5. Try to make functions generalized by applying parameterization. Don't write functions in such a way that the function will be useful with particular data only. Replace the hard coded values with parameters.
6. Use proper error handling
7. Identify the navigation and verification points in all the test cases that are to be automated and identify the common navigation and verification. So that once you develop the common functions you can call them from other scripts/functions/ test cases.
8. Design a framework to organize your functions (navigation, verification, etc.)
9. Take help from developers in designing the framework or in coding.
Permalink Reply by V P on February 5, 2010 at 4:53pm
No.., According to my opinion, try to reduce the use of Global variables. With respect to the memory usage, the global variables utilitise a very good amount of memory space, eventually it leads to the slow speed of running applications.
1. Proper naming convension to variable and functions
2. Free the objects from memory pool
3. Proper code indentation. ( this will help to improve code readability)