Tool for Automation and Testing

Slides:



Advertisements
Similar presentations
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Advertisements

LAB 3 NS2 Preliminaries. Contents TCL/OTCl Fundamentals Creating Network Setting Connections Generating Traffic Inserting Errors Configuring for multicast.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Writing Tcl Scripts (cont.) Outline –Variable Scoping –Strings –Eval –File/Channel I/O –Processes –System Info –Errors –Reflection/Debugging –Libraries.
Introduction to Perl Learning Objectives: 1. To introduce the features provided by Perl 2. To learn the basic Syntax & simple Input/Output control in Perl.
Scripting Languages CS 351 – Programming Paradigms.
Scripting Languages CS351 – Programming Paradigms.
Scripting Languages. Originally, a script was a file containing a sequence of commands that needed to be executed Control structures were added to make.
Writing Tcl Scripts Outline Goal Reading Syntax Data Types
Introduction to Perl Software Tools. Slide 2 Introduction to Perl l Perl is a scripting language that makes manipulation of text, files, and processes.
Guide To UNIX Using Linux Third Edition
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
An Overview of Tcl and Tk John Ousterhout Sun Microsystems Laboratories Tcl/Tk Tutorial, Part I.
Shell Scripting Awk (part1) Awk Programming Language standard unix language that is geared for text processing and creating formatted reports but it.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
Introduction to Perl Practical Extraction and Report Language or Pathologically Eclectic Rubbish Lister or …
Introduction to NS2 -Network Simulator- -Prepared by Changyong Jung.
2008 Bangkok, Thailand Scripting Tools, languages and the Shell intERLab at AIT Network Management Workshop March – Bangkok, Thailand.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 13: An Introduction to C++
CIS 218 Advanced UNIX1 CIS 218 – Advanced UNIX (g)awk.
Scons Writing Solid Code Overview What is scons? scons Basics Other cools scons stuff Resources.
Computer Science 101 Introduction to Programming.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Awk Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
Sed, awk, & perl CS 2204 Class meeting 13 *Notes by Mir Farooq Ali and other members of the CS faculty at Virginia Tech. Copyright 2003.
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
Introduction to PHP Advanced Database System Lab no.1.
CS4710 Why Progam?. Why learn to program? Utility of programming skills: understand tools modify tools create your own automate repetitive tasks automate.
Introduction to Unix – CS 21
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
(A Very Short) Introduction to Shell Scripts CSCI N321 – System and Network Administration Copyright © 2000, 2003 by Scott Orr and the Trustees of Indiana.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley
TCL TK. Tcl/Tk C functions can become Tcl commands that are invoked interactively Tk = scriptable, portable user interface –Windows, X (Unix), MacOS,
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
 Stands for Tool Command Language  Used for rapid prototyping, GUIs, and scripted applications  Created by John Ousterhout in 1988 out of frustration.
Department of Electronic & Electrical Engineering Introduction to C - The Development cycle. Why C? The development cycle. Using Visual Studio ? A simple.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
Shell Scripting What is Shell Programming? Putting UNIX commands in a file Seldom used where speed is important Often used to manipulate files To create.
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
Bioinformatics Introduction to Perl. Introduction What is Perl Basic concepts in Perl syntax: – variables, strings, – Use of strict (explicit variables)
LECTURE 2 Python Basics. MODULES So, we just put together our first real Python program. Let’s say we store this program in a file called fib.py. We have.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
An Introduction To Tcl Scripting John Ousterhout Sun Microsystems Laboratories Tcl/Tk Tutorial, Part II.
Perl & TCL Vijay Subramanian, Modified from : perl_basics_06.ppt.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
WebTech Varna 2007 Expect – the unexpected Marian Marinov – System Architect - Siteground.com.
COMP075 OS2 Bash Scripting. Scripting? BASH provides access to OS functions, like any OS shell Also like any OS shell, BASH includes the ability to write.
CST 1101 Problem Solving Using Computers
CIRC Winter Boot Camp 2017 Baowei Liu
CS 330 Class 7 Comments on Exam Programming plan for today:
Computer Science 210 Computer Organization
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
Software Testing Techniques
Lecture 2 Python Basics.
Introduction to Python
Kevin Taylor.
Introduction to Programming the WWW I
Henning Schulzrinne Advanced Programming
TCL/TK Tool Command Language/Tool Kit.
TRANSLATORS AND IDEs Key Revision Points.
Creating your first C program
Advanced Programming Behnam Hatami Fall 2017.
CSE 303 Concepts and Tools for Software Development
Lab 4: Introduction to Scripting
Introduction to Computer Science
Introduction to Perl Learning Objectives:
General Computer Science for Engineers CISC 106 Lecture 03
Presentation transcript:

Tool for Automation and Testing Expect Tool for Automation and Testing

Expect - Introduction Unix automation and testing tool Written by Don Libes Primarily designed as an extension to the Tcl scripting language Useable in interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, ssh, and others.

Expect – TCL* Basics Everything is a command No Fixed Parser Case-Sensitive Explicit Expression Evaluation set a 5  a = 5 set b a+2  b = a+2 set c [expr $a+2]  c = 7 (Note: $ for variable substitution) Simple variables are strings of arbitrary length Real & Int  cast to real Non-numeric string and real/int  cast to string Built in Lists Standard flow control structures (while, if, etc.) String manipulation with Regular Expressions Procedures – arguments can be passed by value or reference *Tool Command Language

Expect – The Programming Language Extension of TCL, so the syntax is TCL syntax Basic command set expect send spawn Interact Regular Expression pattern matching “Glue” to combine separate executables

Expect – Pros / Cons Pros Cons Built on existing system tools, so learning curve is small. Extensive support from corporate entities* *Silicon Graphics, IBM, HP, Sun, Xerox, Amdahl, Tektronix, AT&T, ComputerVision and the World Bank Numerous ports to other programming languages (Perl, Python, java, etc.) Cons Only useful for command line scripting Cryptic syntax for those unfamiliar with TCL (When do I use a $ again?) Generally machine dependent tools are run with Expect, so porting scripts cross-platform is not easily supported.

Expect – “Hello World!” Start Expect with “expect” or write the script to a file and run > expect filename send “Hello World!\n” expect “Hi\n” Putting it together Expect “Hi\n” { send “Hi World!\n” }

Expect – More Advanced expect "hi\n" { send "Hi World!\n" } \ "hello\n" {send "Hello World!\n" } \ "bye\n" {send "Bye World!\n" }

Expect - Automation spawn ftp $argv expect "Name" { send "anonymous\r" } \ "name" { send "anonymous\r" } expect "assword:" send "nobody@nobody.com\r" interact

Expect - Others Brute Force security Beer Chess Weather Rogue Hunt

Expect - GnuChess # start things rolling spawn gnuchess set id1 $spawn_id expect "White \\(1\\) :" send "random\r" send "depth 6\r" send "go\r" # read_first_move expect -re "My move is : (.*)\n" set id2 $spawn_id send "depth 5\r" send $expect_out(1,string) while {1} { expect { -i $id2 -re "is : (.*)\n" { send -i $id1 $expect_out(1,string) } -i $id1 -re "is : (.*)\n" { send -i $id2 $expect_out(1,string)

Expect - Questions