Introduction to Coded Step Components in Telerik Test Studio
Telerik Test Studio allows a user to write code for the complex tests or tests that cannot be handled by its record and playback. Along with the ability to write code for your test step, Test Studio also offers several different features that facilitate and helps in designing tests by writing code. There are several different components that help user during coding, in this tutorial we will have a brief introduction to these components.
Code-Behind File
When you add a coded step to your test, you are actually defining methods in a code-behind file. We have already discussed the code-behind file in details in the following post.
http://original.toolsqa.com/telerik-test-studio/add-edit-coded-step/
When a user uses step builder to add a coded step or converts an existing step in to coded step a code behind file is added just below the current test. Double click on the code behind file will open coded step.
In the code behind file, Telerik has access to all the run time object that is required for the test. The user can add several methods in the code behind file and can call these methods by adding coded steps to the test and then selecting the required method from the drop down in the test step.
Standalone Coded file
A standalone code file helps the user in creating utility class that can be used to define some common methods or reusable functions. It can also contain helper class that can help in offering enhanced functions to your test that can be used effectively while handling complex scenarios.
A standalone file can be added to an existing project by right-clicking on the project and then selecting “Add New Code File” from the right click menu. Standalone code file is placed just below your test project.
- A standalone code file will contain test project name as the namespace.
- The methods in the standalone file can be accessed from any coded step across the project.
We will discuss Standalone Coded file in detail in our next tutorial.
Compiling your Project
Test Studio allows you to compile your project before you execute them. Compiler helps in identifying errors that could occur during compilation such as incorrect keyword, incomplete/wrong syntax etc. This helps in identifying the issues even before you execute your project/test.
Test Studio offers a dedicated “Compile” button. The user can use this button to compile project after making any changes to their code.
Clicking on the compile button will begin the compilation. Test Studio builds project dll in the bin folder (by default) and if there is any error in the build, it will be displayed in the output panel.
And if there is no error then the Build will be sucessull and “Build Succeeded” will be displayed in the compiler.
Using Output Panel
The output panel is present in the middle at the bottom of the Test Studio. It displays log messages that have been recorded by test studio during execution. It also displays build error that may occur during compilation of the project.
Output panel has three tabs, namely Syntax Error, Compiler and Source Control. All these three tabs display information based on the information type.
The Syntax Error tab shows syntax error. This runtime error helps in locating the exact area where the problem persists.
Compiler as we have already discussed shows compiler issues or Build Success/ failure message
Source control displays information against source control activities. I.e. if you are checking-in or checking-out your scripts in TFS.