diff --git a/_images/avatar-20170726.png b/_images/avatar-20170726.png new file mode 100644 index 0000000..e5460f6 Binary files /dev/null and b/_images/avatar-20170726.png differ diff --git a/_images/azion-logo.png b/_images/azion-logo.png new file mode 100644 index 0000000..bf5f140 Binary files /dev/null and b/_images/azion-logo.png differ diff --git a/theme/azion.css b/theme/azion.css new file mode 100644 index 0000000..c16ba71 --- /dev/null +++ b/theme/azion.css @@ -0,0 +1,305 @@ +/** + * Azion theme for Reveal.js + * + * By Julio Biason, http://presentations.juliobiason.net + */ +@import url(../../lib/font/source-sans-pro/source-sans-pro.css); +section.has-dark-background, section.has-dark-background h1, section.has-dark-background h2, section.has-dark-background h3, section.has-dark-background h4, section.has-dark-background h5, section.has-dark-background h6 { + color: #fff; } + +.reveal section h1.semi-opaque { + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + text-shadow: 2px 2px #000; } + +.reveal section img.company-logo { + height: 1em; + margin-right: 5px; + margin-left: 5px; + margin-top: 0px; + margin-bottom: 0px; + box-shadow: none; } + +/********************************************* + * GLOBAL STYLES + *********************************************/ +body { + background: #F2F5F8; + background-color: #F2F5F8; } + +.reveal { + font-family: "Source Sans Pro", Helvetica, sans-serif; + font-size: 42px; + font-weight: normal; + color: #000; } + +::selection { + color: #fff; + background: #98bdef; + text-shadow: none; } + +::-moz-selection { + color: #fff; + background: #98bdef; + text-shadow: none; } + +.reveal .slides > section, +.reveal .slides > section > section { + line-height: 1.3; + font-weight: inherit; } + +/********************************************* + * HEADERS + *********************************************/ +.reveal h1, +.reveal h2, +.reveal h3, +.reveal h4, +.reveal h5, +.reveal h6 { + margin: 0 0 20px 0; + color: #000; + font-family: "Source Sans Pro", Helvetica, sans-serif; + font-weight: 600; + line-height: 1.2; + letter-spacing: normal; + text-transform: uppercase; + text-shadow: none; + word-wrap: break-word; } + +.reveal h1 { + font-size: 2.5em; } + +.reveal h2 { + font-size: 1.6em; } + +.reveal h3 { + font-size: 1.3em; } + +.reveal h4 { + font-size: 1em; } + +.reveal h1 { + text-shadow: none; } + +/********************************************* + * OTHER + *********************************************/ +.reveal p { + margin: 20px 0; + line-height: 1.3; } + +/* Ensure certain elements are never larger than the slide itself */ +.reveal img, +.reveal video, +.reveal iframe { + max-width: 95%; + max-height: 95%; } + +.reveal strong, +.reveal b { + font-weight: bold; } + +.reveal em { + font-style: italic; } + +.reveal ol, +.reveal dl, +.reveal ul { + display: inline-block; + text-align: left; + margin: 0 0 0 1em; } + +.reveal ol { + list-style-type: decimal; } + +.reveal ul { + list-style-type: disc; } + +.reveal ul ul { + list-style-type: square; } + +.reveal ul ul ul { + list-style-type: circle; } + +.reveal ul ul, +.reveal ul ol, +.reveal ol ol, +.reveal ol ul { + display: block; + margin-left: 40px; } + +.reveal dt { + font-weight: bold; } + +.reveal dd { + margin-left: 40px; } + +.reveal q, +.reveal blockquote { + quotes: none; } + +.reveal blockquote { + display: block; + position: relative; + width: 70%; + margin: 20px auto; + padding: 5px; + font-style: italic; + background: rgba(255, 255, 255, 0.05); + box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); } + +.reveal blockquote p:first-child, +.reveal blockquote p:last-child { + display: inline-block; } + +.reveal q { + font-style: italic; } + +.reveal pre { + display: block; + position: relative; + width: 90%; + margin: 20px auto; + text-align: left; + font-size: 0.55em; + font-family: monospace; + line-height: 1.2em; + word-wrap: break-word; + box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } + +.reveal code { + font-family: monospace; } + +.reveal pre code { + display: block; + padding: 5px; + overflow: auto; + max-height: 400px; + word-wrap: normal; } + +.reveal table { + margin: auto; + border-collapse: collapse; + border-spacing: 0; } + +.reveal table th { + font-weight: bold; } + +.reveal table th, +.reveal table td { + text-align: left; + padding: 0.2em 0.5em 0.2em 0.5em; + border-bottom: 1px solid; } + +.reveal table th[align="center"], +.reveal table td[align="center"] { + text-align: center; } + +.reveal table th[align="right"], +.reveal table td[align="right"] { + text-align: right; } + +.reveal table tbody tr:last-child th, +.reveal table tbody tr:last-child td { + border-bottom: none; } + +.reveal sup { + vertical-align: super; } + +.reveal sub { + vertical-align: sub; } + +.reveal small { + display: inline-block; + font-size: 0.6em; + line-height: 1.2em; + vertical-align: top; } + +.reveal small * { + vertical-align: top; } + +/********************************************* + * LINKS + *********************************************/ +.reveal a { + color: #2a76dd; + text-decoration: none; + -webkit-transition: color .15s ease; + -moz-transition: color .15s ease; + transition: color .15s ease; } + +.reveal a:hover { + color: #6ca0e8; + text-shadow: none; + border: none; } + +.reveal .roll span:after { + color: #fff; + background: #1a53a1; } + +/********************************************* + * IMAGES + *********************************************/ +.reveal section img { + margin: 15px 0px; + background: rgba(255, 255, 255, 0.12); + border: 4px solid #000; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); } + +.reveal section img.plain { + border: 0; + box-shadow: none; } + +.reveal a img { + -webkit-transition: all .15s linear; + -moz-transition: all .15s linear; + transition: all .15s linear; } + +.reveal a:hover img { + background: rgba(255, 255, 255, 0.2); + border-color: #2a76dd; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); } + +/********************************************* + * NAVIGATION CONTROLS + *********************************************/ +.reveal .controls .navigate-left, +.reveal .controls .navigate-left.enabled { + border-right-color: #2a76dd; } + +.reveal .controls .navigate-right, +.reveal .controls .navigate-right.enabled { + border-left-color: #2a76dd; } + +.reveal .controls .navigate-up, +.reveal .controls .navigate-up.enabled { + border-bottom-color: #2a76dd; } + +.reveal .controls .navigate-down, +.reveal .controls .navigate-down.enabled { + border-top-color: #2a76dd; } + +.reveal .controls .navigate-left.enabled:hover { + border-right-color: #6ca0e8; } + +.reveal .controls .navigate-right.enabled:hover { + border-left-color: #6ca0e8; } + +.reveal .controls .navigate-up.enabled:hover { + border-bottom-color: #6ca0e8; } + +.reveal .controls .navigate-down.enabled:hover { + border-top-color: #6ca0e8; } + +/********************************************* + * PROGRESS BAR + *********************************************/ +.reveal .progress { + background: rgba(0, 0, 0, 0.2); } + +.reveal .progress span { + background: #2a76dd; + -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } diff --git a/theme/azion.scss b/theme/azion.scss new file mode 100644 index 0000000..9bffa75 --- /dev/null +++ b/theme/azion.scss @@ -0,0 +1,69 @@ +/** + * Azion theme for Reveal.js + * + * By Julio Biason, http://presentations.juliobiason.net + */ + + +// Default mixins and settings ----------------- +@import "../template/mixins"; +@import "../template/settings"; +// --------------------------------------------- + + +// Include theme-specific fonts +@import url(../../lib/font/source-sans-pro/source-sans-pro.css); + + +// Override theme settings (see ../template/settings.scss) +$backgroundColor: #F2F5F8; +$mainColor: #000; +$headingColor: #000; + +$mainFontSize: 42px; +$mainFont: 'Source Sans Pro', Helvetica, sans-serif; +$headingFont: 'Source Sans Pro', Helvetica, sans-serif; +$headingTextShadow: none; +$headingLetterSpacing: normal; +$headingTextTransform: uppercase; +$headingFontWeight: 600; +$linkColor: #2a76dd; +$linkColorHover: lighten( $linkColor, 15% ); +$selectionBackgroundColor: lighten( $linkColor, 25% ); + +$heading1Size: 2.5em; +$heading2Size: 1.6em; +$heading3Size: 1.3em; +$heading4Size: 1.0em; + +section.has-dark-background { + &, h1, h2, h3, h4, h5, h6 { + color: #fff; + } +} + +.reveal { + section { + h1 { + .semi-opaque { + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + text-shadow: 2px 2px #000; + } + } + + img.company-logo { + height: 1em; + margin-right: 5px; + margin-left: 5px; + margin-top: 0px; + margin-bottom: 0px; + box-shadow: none; + } + } +} + + +// Theme template ------------------------------ +@import "../template/theme"; +// --------------------------------------------- diff --git a/unit-in-unittests-2.html b/unit-in-unittests-2.html new file mode 100644 index 0000000..67aec8e --- /dev/null +++ b/unit-in-unittests-2.html @@ -0,0 +1,443 @@ + + + + + + "Unit" em "Unit Tests" + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+

"Unit" em "Unit Tests"

+
+
+ +
+
+ Me + +
+ +
+
+ +
+ Eu faço perguntas em reuniões que eu não sei nada e reunião explode; não é de propósito + + +
+ +
+ ... mas hoje eu vim botar os filho dos outro no go horse. + + +
+
+ +
+
+ TDD: Where it went wrong +

Ian Cooper: "TDD, where did it all go wrong"

+
+ +
+

Apresentação de Ian Cooper ressoou muito com experiências + feitas com TDD puro e "testes de ponta-a-ponta".

+
+
+ +
+
+

Mas antes...

+
+ +
+

Quem já...

+
    +
  • ... falou de "testes de unidade"?
  • +
  • ... discutiu a "unidade" dos testes de unidade?
  • +
+
+ +
+ Errow +
+ +
+ Errou rude +
+
+ +
+
+

Exemplo

+ +

+class Client:
+    def __init__(self, name):
+        self.name = name
+                        
+
+ +
+

Exemplo

+ +

Novo requisito: "somente aceitar nomes válidos, que tem 2 + palavras ou mais."

+
+ +
+

Exemplo

+ +

SOLID principles:

+
    +
  • SRP - Single Responsability Principle
  • +
  • OCP - Open/closed principle
  • +
  • LSP - Liskov substitution principle (design by contract)
  • +
  • ISP - Interface Segreation Principle
  • +
  • DIP - Dependency Inversion Principle
  • +
+
+ +
+

Exemplo

+ +

+def _multiple_names(name):
+    split_names = name.split(' ')
+    return len(split_names) > 1
+
+def _validate_name(name):
+    if not _multiple_names(name):
+        raise Exception("Invalid name")
+    return name
+
+class Client:
+    def __init__(self, name):
+        self.name = _validate_name(name)
+                        
+
+ +
+

Exemplo

+ +

+import pytest
+
+def test_single_name():
+    assert not _multiple_names('Cher')
+
+def test_multiple_name():
+    assert _multiple_names('Julio Biason')
+                        
+
+ +
+

Exemplo

+ +

+def test_valid_name():
+    _validate_name('Julio Biason')
+
+def test_invalid_name():
+    with pytest.raises(Exception):
+        _validate_name('Cher')
+                        
+
+ +
+

Exemplo

+ +

+def test_client_error():
+    with pytest.raises(Exception):
+        Client(name='Cher')
+
+def test_client():
+    Client(name='Julio Biason')
+                        
+
+ +
+

Exemplo

+ +

+$ pytest client.py
+==== test session starts ====
+rootdir: /home/jbiason/unitt, inifile:
+collected 6 items
+
+client.py ......
+
+==== 6 passed in 0.03 seconds ====
+                        
+
+ +
+

Exemplo

+ +

+$ pytest --cov=client client.py
+==== test session starts ====
+plugins: cov-2.4.0
+collected 6 items
+
+client.py ......
+
+---- coverage: platform linux, python 3.4.3-final-0 ----
+Name        Stmts   Miss  Cover
+-------------------------------
+client.py      25      0   100%
+
+==== 6 passed in 0.11 seconds ====
+                        
+
+ +
+

Exemplo

+ +

"Não podemos perder a Cher, a Xuxa, a Madonna, a Björk e o String como clientes!"

+
+ +
+

Exemplo

+ +

+class Client:
+    def __init__(self, name):
+        self.name = name
+                        
+
+ +
+

Exemplo

+ +

+==== FAILURES ====
+____ test_client_error ____
+
+    def test_client_error():
+        with pytest.raises(Exception):
+>           Client(name='Cher')
+E           Failed: DID NOT RAISE <class 'Exception'>
+
+client.py:37: Failed
+==== 1 failed, 5 passed in 0.63 seconds ====
+                        
+
+ +
+

Exemplo

+ +

+$ pytest  client.py
+==== test session starts ====
+rootdir: /home/jbiason/unitt, inifile:
+plugins: cov-2.4.0
+collected 6 items
+
+client.py ......
+
+==== 6 passed in 0.03 seconds ====
+                        
+
+ +
+

Exemplo

+ +

+$ pytest --cov=client  client.py
+==== test session starts ====
+rootdir: /home/jbiason/unitt, inifile:
+plugins: cov-2.4.0
+collected 6 items
+
+client.py ......
+
+---- coverage: platform linux, python 3.4.3-final-0 ----
+Name        Stmts   Miss  Cover
+-------------------------------
+client.py      24      0   100%
+
+==== 6 passed in 0.12 seconds ====
+                        
+
+ +
+

Exemplo

+ +

Encontre o erro.

+
+
+ +
+
+

TDD

+ +

Kent Beck:

+ +
    +
  • "Run in isolation", nothing more, nothing less.
  • +
  • "Avoid testing implementation details, test behaviours"
  • +
+
+ +
+

TDD

+ +

Discussões como "qual a unidade a ser testada" é que geraram + coisas como BDD e ATDD (Acceptance Test-Driven Development).

+
+ +
+

TDD

+ +

Reddit: Devo escrever testes para a validação interna do Django?

+ +

SIM!

+
+ +
+

TDD

+ +

Nossos testes End-to-End.

+ + +
+ +
+

TDD

+ + The TDD lifecycle +
+ +
+

TDD

+ +

SOLID principles:

+
    +
  • SRP - Single Responsability Principle
  • +
  • OCP - Open/closed principle
  • +
  • LSP - Liskov substitution principle (design by contract)
  • +
  • ISP - Interface Segreation Principle
  • +
  • DIP - Dependency Inversion Principle
  • +
+ +

Funciona para aplicações inteiras; veja VIM vs NeoVim.

+
+
+ +
+

Resumo

+ +
    +
  • Escreva testes que verifiquem requisitos, não a + implementação do requisito
  • +
  • Implementação pode mudar, os testes não deveriam.
  • +
  • Garanta que o teste dependa apenas de si mesmo + e não de outros testes.
  • +
  • Use cobertura (coverage) para identificar código + a ser removido, não para escrever mais testes.
  • +
+
+ +
+
+

Perguntas?

+
+
+
+
+ + + + + + + +