sveltest: A testing language



Similar documents
Introduction to Object-Oriented Programming

How to use the Eclipse IDE for Java Application Development

CS 106 Introduction to Computer Science I

Java Crash Course Part I

Introduction to Java

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Test Driven Development

Fail early, fail often, succeed sooner!

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

Java with Eclipse: Setup & Getting Started

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

J a v a Quiz (Unit 3, Test 0 Practice)

Chapter 1 Java Program Design and Development

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Basics of Java Programming Input and the Scanner class

Tutorial: Getting Started

Java Cheatsheet. Tim Coppieters Laure Philips Elisa Gonzalez Boix

Crash Course in Java

Software. Programming Language. Software. Instructor Özgür ZEYDAN. Bülent Ecevit University Department of Environmental Engineering

How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For

Sample CSE8A midterm Multiple Choice (circle one)

LAB4 Making Classes and Objects

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Installing Java. Table of contents

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays:

CS170 Lab 11 Abstract Data Types & Objects

I. INTRODUCTION. International Journal of Computer Science Trends and Technology (IJCST) Volume 3 Issue 2, Mar-Apr 2015

Programming Languages CIS 443

CS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java

Theory of Compilation

Install Java Development Kit (JDK) 1.8

What Perl Programmers Should Know About Java

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

CSCI 3136 Principles of Programming Languages

Inheritance, overloading and overriding

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin

CSC 551: Web Programming. Spring 2004

WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc.

Java applets. SwIG Jing He

1001ICT Introduction To Programming Lecture Notes

Third AP Edition. Object-Oriented Programming and Data Structures. Maria Litvin. Gary Litvin. Phillips Academy, Andover, Massachusetts

CompSci 125 Lecture 08. Chapter 5: Conditional Statements Chapter 4: return Statement

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

CiaoPP Demo. Pedro López-García 1, Edison Mera 2 and Teresa Trigo 1. ES PASS Barcelona Jun. 26, 2008

Exploring Algorithms with Python

Installing Java (Windows) and Writing your First Program

Java Programming Fundamentals

Konzepte objektorientierter Programmierung

AP Computer Science Static Methods, Strings, User Input

CSC230 Getting Starting in C. Tyler Bletsch

COSC Introduction to Computer Science I Section A, Summer Question Out of Mark A Total 16. B-1 7 B-2 4 B-3 4 B-4 4 B Total 19

Introduction to Programming

Official Android Coding Style Conventions

02 B The Java Virtual Machine

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Semantic Analysis: Types and Type Checking

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor

Computer Programming Tutorial

An Incomplete C++ Primer. University of Wyoming MA 5310

Java Programming Unit 1. Your first Java Program Eclipse IDE

Programmierpraktikum

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

Introduction to Python

Continuous Integration

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

Moving from CS 61A Scheme to CS 61B Java

Creating a Java application using Perfect Developer and the Java Develo...

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

Hands on exercise for

Introducing Variance into the Java Programming Language DRAFT

The C Programming Language course syllabus associate level

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

Lab 1A. Create a simple Java application using JBuilder. Part 1: make the simplest Java application Hello World 1. Start Jbuilder. 2.

JUnit. Introduction to Unit Testing in Java

AP Computer Science Java Subset

CS193j, Stanford Handout #10 OOP 3

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Building Java Programs

Computer Programming I

CSCI E 98: Managed Environments for the Execution of Programs

COS 217: Introduction to Programming Systems

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Programming Assignment II Due Date: See online CISC 672 schedule Individual Assignment

Java course - IAG0040. Unit testing & Agile Software Development

Class 16: Function Parameters and Polymorphism

A Short Introduction to Writing Java Code. Zoltán Majó

Tutorial on Writing Modular Programs in Scala

File class in Java. Scanner reminder. Files 10/19/2012. File Input and Output (Savitch, Chapter 10)

Transcription:

Look familiar?

sveltest: A testing language Kaitlin Huben (Project Manager) Emily Hsia (Language Guru) Josh Lieberman (System Architect) Chris So (System Integrator) Mandy Swinton (Verifier and Validator)

What is sveltest? Object-oriented language with a simple approach to tackle testing code [1]

Why sveltest? Testing is important Other libraries are verbose and convoluted Java: JUnit, Mauve C/C++: CUnit, CppUnit Python: unittest (formerly PyUnit) sveltest is concise and flexible Can test Java, C*, and Python** *Almost done **In progress [2]

Speaking of buzzwords... r a l u d Mo Flexible Simple t s u e b l o R b a t r o Turing-complete P

Speaking of buzzwords... svelte svelt, sfelt (adjective): slender and elegant. sveltest svelt est, sfelt est (adjective): the most svelte.

JUnit sveltest vs Code snippet: Code snippet: import static org.junit.assert.assertequals; main() { import org.junit.test; import org.junit.ignore;... [more imports] @RunWith(JUnit4.class) file truefile = AlwaysTrue.java ; funct truefunct = { main, (j_string[]), truefile}; Short if(truefunct.assert((), true )) public class FooTest { @Test print( I m true! ); Long } public void thisalwayspasses() {...} @Test @Ignore public void thisisignored() {...} } Call: $ java -cp.:/usr/share/java/junit.jar org.junit.runner.junitcore FooTest Call: $./compile.sh truetest.svel $ python truetest.py

Syntactic constructs The usual suspects int, double, boolean, string, arrays if, while, for *Python reserved words are reserved sveltest file funct input output funct.assert()

sveltest idiom 1. Declare the file containing the method you want to test file testfile = path/to/filename-to-test.java ; 2. Declare the method you want to test funct testfunct = { name, (paramtypes), testfile}; 3. Set up input(s) and corresponding output(s) 4. Call assert with combinations of inputs and outputs funct.assert(input, output); Or, do it all at once!

HelloWorld.java public class HelloWorld { public static void main(string[] args) { String name = args[0]; System.out.println( Hello + name); } }

helloworldtest.svel lang = Java; main() { file f = "HelloWorld.java"; funct hello = { main, (j_string[]), f}; input name = world ; output out = Hello world ; if(hello.assert(name, out)) { print("test passed."); } else { print("test failed."); } }

Side-by-side helloworldtest.svel lang = Java; HelloWorld.java public class HelloWorld { public static void main(string[] args) main() { file f = "HelloWorld.java"; { funct hello = { main, (j_string[]), f}; String name = args[0]; input name = world ; System.out.println( Hello + name); } output out = Hello world ; if(hello.assert(name, out)) { print("test passed."); } else { print("test failed."); } } }

helloworldtest.svel lang = Java; main() { file f = "HelloWorld.java"; funct hello = { main, (j_string[]), f}; input name = world ; output out = Hello world ; if(hello.assert(name, out)) { print("test passed."); } else { print("test failed."); } }

Fibonacci.java public class Fibonacci { public static int fib(int n){ if (n == 0){ return 0; else if (n == 1){ else { } } } return 1; } return fib(n-1) + fib(n-2); }

fibtester.svel lang = Java; main() { funct fibfunct = { fib, (j_int), Fibonacci.java }; fibfunct.assert(4, 3, verbose); } Recall: public static int fib(int n)

The verbose flag

Architecture

Architecture

Testing Comprehensive test suite Lexer, parser, and compiler each implemented for on-the-fly testing Can take single lines of code Can take a program at any step (e.g. only lex) The meta-test: testing a sveltest program with another sveltest program! (No, we haven t gotten there yet)

Lexer

Parser

Compiler (verbose)

Compiler-generator tools PLY: Python Lex-Yacc [3]

Development environment Python 2.7.3 PLY 3.4-2build1 Java SE 6 (1.6.0) C99 CLIC Linux Machines/Local Mac/Windows

Runtime Environment sveltest utilizes the user s environment Compiled programs use direct system calls All sveltest programs need Python 2.x to run How to compile and run: $ cd path/to/lib $./compile.sh [-v] path/to/your_svel_program.svel compiler output $ cd path/to/your_svel_program $ python your_svel_program.py

Demo!

Project management [4]

Trello

Git: Commits Whitepaper due Spring break LRM/Tutorial due Realized we were presenting in class

Lots of learning Start early, work often Programming language!= application What worked well: Teamwork! (At least) weekly meetings, standups, or scrums Lots of commits Ambitious goals: if we have time list on Trello What we would have changed: Get full bare-bones compiler kernel running sooner (goal was week of 3/9, didn t happen until 3/30) Higher comfort level with git (mistakes fixed with rebasing caused trouble)

So...why sveltest, again? Testing code should be easy You don t want to end up like these guys You shouldn t need to learn a new library for every language you want to test Our logo is awesome [5]

Thank you! Bonus Pic: Team Bonding!

Repository Our code: https://github.com/sveltest/sveltest Language tutorial: http://sveltest.github.io/tutorial/

Image citations Cover: http://media-cache-ak0.pinimg.com/736x/1c/69/2e/1c692e55506a47fc718a16ee28e8b38b.jpg 1. 2. 3. 4. 5. http://c.tadst.com/gfx/600x400/international-programmer-day.jpg http://sheownsit.com/wp-content/uploads/2013/08/how-flexible-is-your-bi-1.jpg http://media.tumblr.com/tumblr_m5vygkszwp1qhsyf1.jpg (dog) http://sd.keepcalm-o-matic.co.uk/i/i-m-so-awesome-that-you-cannot-keep-calm.png Project Management slide: a. Aho: http://www1.cs.columbia.edu/~aho/simons_aho_1.jpg b. Email: http://before-ido.com/wp-content/uploads/2014/01/email-icon.jpg c. Message: http://www.iphonehacks.com/wp-content/uploads/2013/10/imessage-icon-ios-7.jpg d. Github: http://www.velonuboso.com/made/blog/wp-content/uploads/2013/04/github-logo-transparent. jpg e. Trello: http://blog.trello.com/wp-content/uploads/2011/09/03-trello-300x173.png f. Drive: http://fc01.deviantart.net/fs70/i/2012/136/3/a/google_drive_library_by_gsm2k-d500d7l.png g. Snapchat: http://upload.wikimedia.org/wikipedia/en/5/5e/snapchat_logo.png http://www.the-scoop.co.uk/wp-content/uploads/2013/10/angry-computer.jpg