Loading

Test script


Introduction :

A test script is a set of instructions that is used to test the system under test. Test script is a few lines of code written in some programming language. The system under test is checked if it delivers the expected results. Test script is used in automation testing. Some of the scripting languages are :

  • Javascript
  • Perl
  • Python
  • Ruby
  • Vbscript

Many automation tools generate test scripts without the need to write code. For every test case there is a pre-condition, input data, actions to be taken, verification results, expected results. A test script should be written keeping in mind the sequence of flow of actions. Automation provides a managed way of carrying out testing.

Test case prioritization is important, therefore test cases should be prepared keeping in mind their dependencies. For example in a typical web page we have various components like - login, sign up, book order etc. A noteworthy fact is that the test scripts must be written keeping in mind the test scenarios/test cases. Test scripts are intended for test cases. Let us understand what does a test case mean?

Test Case :

A test case can be thought of as a condition with an expected output. For example a very simple process of online transaction requires a person to register into the system if he is a new user and intends to make any online purchase. If a user is registered with the website then he can make online transactions. So the test cases may be somewhat as follows :

Test Case 1:

REGISTRATION - user fills in his details and clicks the submit button, he should be able to get registered.

Expected result - you are registered successfully.


Test Case 2:

LOGIN - user credentials are authenticated, and the user is able to login to the site. Now here we may have two scenarios - valid input (email and password) or invalid input (email or password).

A test script code is thus written as per the test cases. Below is a sample code for login in selenium.

Public class login_user {

public static void main(String[] args)

{

WebDriver web=new FirefoxDriver();

web.manage().timeouts().implicitlyWait(10,TimeUnit.Seconds);

web.findElement(By.id("email")).sendKeys("Enter user Name");

web.findElement(By.id("password")).sendKeys("Enter your password");

web.findElement(By.id("signin")).click();

web.close();

}

}

Similarly, there are various automation tools available which can be used to perform testing of an application. Another example is Sikuli, which is a GUI automation tool which uses Sikuli script that's based on Python.

A collection of test scripts along with test data that has a test execution engine, are together known as Test Harness.

A sort of matrix is often prepared to refer to the requirements for a test case. A sample test case's matrix is given as below :

Inputs :

Product Mandatory
Component customisation report yes
Domain analysis report yes

Outputs :

Product Mandatory
Test case/requirements traceability Matrix yes
Test script yes

Techniques :

Functional System testing

Roles :

Role Responsibility
Project Team Consult
Test designer/developer Produce

Benefits of test scripting :

  • Testing done using test scripts are reliable as they are written for a purpose and can be run repeatedly for the same set of operations.
  • We can also test how the software responds to the same operations repeatedly.
  • Test scripts can be written for every component that a software system is comprised of, hence testing becomes comprehensive in nature.
  • Automation testing is faster therefore time consumed is less.

Disadvantages :

  • The test script is likely to break if poorly written.
  • We need experts to write test cases, else improper implementation may result in grave consequences.

Guidelines to be followed while writing test scripts :

  • Careful analysis of the requirement specifications.
  • Focusing of automation aspects such as recording or creating test scripts.
  • In automation testing tools, a 'recording' feature is available to create test scripts. In case of test development, a test developer's activities are recorded and this becomes the test scripts.

Conclusion :

Automation is a great way to test a software system as it offers a great ease for carrying out the testing activities. We have the option of customizing a test script as per a given test scenario. It thus allows a tester to view the system under test from every possible dimension and deliver a quality end product.


ThinkSys Advertisement


ThinkSys Advertisement
ThinkSys Advertisement



Get New Content Update
Popular Posts
Dec 07, 2020
Dec 07, 2020
Dec 07, 2020

Advertisement:

ThinkSys Advertisement


LP

App development ad thinksys

Devops