Overview: Motivation Automated testing for quality assurance - - PowerPoint PPT Presentation

overview motivation
SMART_READER_LITE
LIVE PREVIEW

Overview: Motivation Automated testing for quality assurance - - PowerPoint PPT Presentation

Hey guys, were making a new language! k-AWK (kay-awk) k. The Testing Language Albert Cui, Karen Nan, Michael Raimi, Mei-Vern Then Overview: Motivation Automated testing for quality assurance Test-driven development


slide-1
SLIDE 1

k-AWK (kay-awk)

Albert Cui, Karen Nan, Michael Raimi, Mei-Vern Then

The Testing Language

“Hey guys, we’re making a new language!” “k.”

slide-2
SLIDE 2

Overview: Motivation

  • Automated testing for quality assurance
  • Test-driven development
  • Design software in a robust manner
slide-3
SLIDE 3

Overview: k-AWK

  • Checks for predefined statements within each

struct (asserts)

  • When called or initialized, all assertions

evaluated to true allow program to continue

  • unit features attached to functions check output

in test mode

slide-4
SLIDE 4

Tutorial: Program Execution

  • Extension for k-AWK programs: .k
  • Run make to create code_gen:

$ ./code_gen foobar.k

  • To compile and run, use the test script.

Outputs to stdout and to a .txt file. $ ./run.sh foobar.k

slide-5
SLIDE 5

Tutorial: Asserts

  • Similar to if statements, can only be used in structs
  • Starts with @ symbol, followed by an expression and a block of

statements: @(k < 100) { print(“k is >= 100!”); }

  • Asserts are evaluated whenever a variable in the expression is

changed

  • If k is less than 100, the program continues. If not, the print

statement within the attached block is executed.

slide-6
SLIDE 6

Tutorial: Units

unit:foo(hi):equals(1):accept;

  • Four parts, separated by single colon:

○ unit: indicates the start of the unit test call ○ foo(hi): indicates the function to call and its arguments ○ equals(1): a logical expression that matches its argument to the return value of the function ○ accept: indicates whether or not a test should pass if a true value is returned from the logical expression (above) ■ reject keyword that tells a unit test to fail if the logical expression returns true

slide-7
SLIDE 7

Tutorial: Built-In Functions

  • print(10);

○ Takes in one string or integer argument ○ Prints to stdout

  • exit(“foobar”);

○ Takes in one string argument ○ Prints string to stdout, then exits program

slide-8
SLIDE 8

void main() { print (“Hello, world! k-Awk says hi); }

  • must have main function of type void, takes no

arguments

  • uses built-in print function to print string to stdout

Example Programs: hello_world.k

slide-9
SLIDE 9

Example Programs: gcd.k

  • One function, called by main with unit test
  • Functions must be defined before main to

be used

  • Unit tests call other functions

○ Prints whether the test passes or fails, with calls and values

slide-10
SLIDE 10

Example Programs: 99_bottles.k

  • Main calls function with int value

○ Function creates instance of struct ■ Runs struct and uses assert to decrement

  • Prints out statements specified in asserts,

prints outcome of unit test

slide-11
SLIDE 11

Language Implementation

slide-12
SLIDE 12

Lessons Learned

  • Prioritize:

○ Too much time spent on the pretty printer

  • Move decisively but consider future implications
  • Better breakdown of project into smaller chunks
  • Smaller, more incremental goals