Coded steps are the test steps which contain scripts or codes. In coded steps you write codes or scripts. Codes of coded steps will get executed as part of test execution. Coded steps can be very useful to automate testing of a complex unique business requirement which cannot be automated by tool. A good automated test should contain minimal numbers of coded steps.
Why we need coded steps
While automating test there may be many complex scenario which cannot be constructed using tool’s verification builder. In that scenario you may need to write codes to construct complex verification. This code will be executed with overall test as coded step. You may need to write coded steps in following scenario
- Automating a complex verification which cannot be constructed by tool.
- Writing Cleanup Steps. For example you may want to clean or delete all the temporary test files before or after executing test. It may be chances that tool might not able automate cleanup task. In this case you may have to write coded step for cleanup task.
- Setting up Test Environment. You may need to set up test environment before executing test. Setting up environment may contain loading external test data, connecting to a dedicated server, loading user profile etc. It may be chances that tool might not able to set up environment for various testing scenario. In this case you may have to write coded step to set up test environment.
- There may be complex test scenario like verifying that whether a particular file got downloaded successfully on file system or not. These types of tests are very tough to be automated by a particular tool. In this case you may have to write coded step to verify file size on file system.
- There may be test scenario in which you need to create test data from multiple data sources. It may be chances that tool might not able to gather or mash up data from various data source. In this case you may have to write coded step to create test data.
Like above there could be many complex test scenarios which cannot be automated by tool. To automate those test scenario you will have to write codes steps.