Please stay healthy!

Remote Lectures

All Meetings

Schedule here:

Revised Project Proposals

Daniel's Feedback

Loraine's Feedback

Schedule here:

Please schedule a group meeting!

very soon

Containers

Can we run applications with a GUI?

Can a docker run a windows application on linux?

Like this Virtual Machine..

Host System

Container

VM

VM

Container kernel needs to match host system.

WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine (VM).

So why is Docker cool?

much more lightweight than VirtualMachines

runs on cloud services

it can scale!

Docker Swarm

Kubernetes

FROM ubuntu:18.04

MAINTAINER Daniel Haehn version: 0.1


ADD converter.cc converter.cc

RUN apt-get update
RUN apt-get install -y g++
RUN g++ -o converter converter.cc

ENTRYPOINT ["./converter"]

Dockerfile

$ docker pull haehn/cs410converter
$ docker run -it haehn/cs410converter
$ pip install trako
$ python setup.py sdist
$ twine upload dist/trako-0.3.1*

Testing

Testing means checking code for bugs..

Manual Testing

Automatic Testing

Explanatory Testing

Unit Testing

Chapters 7, 8, 9

Integration Testing

System Testing

System Tests

Testing Pyramid

Unit Tests

test individual functions

def inc(x):
    return x + 1
def test_inc():
    assert inc(4) == 5
def test_inc3():
    assert inc('a') == 'b'
def test_inc2():
    assert inc(-1) == 0

throws exceptions

def test_inc4():
    assert inc('a') == 'a1'
# assert(a == b)

if not a==b:
  throw Error()
import sys

def inc(x):
    
    return x+1
    
largestInt = sys.maxint

print ( largestInt )

print ( inc( largestInt ) )

Python handles it!

Test Driven Development

JUnit

pytest

$ pytest
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y
cachedir: $PYTHON_PREFIX/.pytest_cache
rootdir: $REGENDOC_TMPDIR
collected 1 item

test_sample.py F                                                     [100%]

================================= FAILURES =================================
_______________________________ test_answer ________________________________

    def test_answer():
>       assert inc(3) == 5
E       assert 4 == 5
E        +  where 4 = inc(3)

test_sample.py:6: AssertionError
========================= short test summary info ==========================
FAILED test_sample.py::test_answer - assert 4 == 5
============================ 1 failed in 0.12s =============================
# content of test_sample.py
def inc(x):
    return x + 1


def test_answer():
    assert inc(3) == 5
#include <cassert>

int main()
{
  assert(1==2);
  std::cout << "Will never be reached.";
}

Integration Testing

def test_some_method(parameter):
  '''
  '''

  # return true or false
def test_setup():
  '''
  '''

  # connect to database
  # or span server
def test_teardown():
  '''
  '''

  # delete temporary files
  # or close database connection

1. Setup

2. Test

3. Teardown

System Testing

Test of the full product

End-to-end Testing

Blackbox Testing

Whitebox Testing

Internals

Externals without knowledge

about what is going on inside

UI Testing

from selenium import webdriver

def test_google():
  
  driver = webdriver.Chrome()
  driver.maximize_window()
  driver.get("https://google.com")

  searchtext = driver.find_element_by_id("searchtext")
  searchtext.send_keys("CS410")
  
  submitbutton = driver.find_element_by_id("submit")
  submitbutton.click()
  
  driver.save_screenshot("/tmp/shot.png")
  

UI Testing

Control a web-browser

Functions, Classes

Arrays, Vectors

Templates

GIBBS Cluster

Cython

Run our C++ code in Python using Cython

and compare timing against NumPy

Analyze a bunch of numbers and calculate min, max, mean, stddev.

Templates

Generic Programming

Type-Independent

"Blueprint"

Advanced!

CS410 Lecture 23

By Daniel Haehn

CS410 Lecture 23

Slides for CS410 Software Engineering at UMass Boston. See https://cs410.net!

  • 421