Professional Documents
Culture Documents
NAVTechDays 2018 Workshop 2 - Writing Your Own Automated Tests
NAVTechDays 2018 Workshop 2 - Writing Your Own Automated Tests
6 years
56 years
2 year no sports
24 years, 3 times father
enchanté
6 years
Introduction – And You
Name
Company
NAV
Testing
Expectations
Introduction - And You
http://lvvws#.northeurope.cloudapp.azure.
com
Preparations – Azure VM
first_name last_name VM VM (landing page)
Davíð Baldursson 201 http://lvvws201.northeurope.cloudapp.azure.com
César Costa 202 http://lvvws202.northeurope.cloudapp.azure.com
Pablo Espartero López 203 http://lvvws203.northeurope.cloudapp.azure.com
Simon Fischer 204 http://lvvws204.northeurope.cloudapp.azure.com
Hannes Geske 205 http://lvvws205.northeurope.cloudapp.azure.com
Christof Huysmans 206 http://lvvws206.northeurope.cloudapp.azure.com
Lina Jancyte 207 http://lvvws207.northeurope.cloudapp.azure.com
Natalie Karolak 208 http://lvvws208.northeurope.cloudapp.azure.com
Sebastian Klaus 209 http://lvvws209.northeurope.cloudapp.azure.com
Jussi-Pekka Litmanen 210 http://lvvws210.northeurope.cloudapp.azure.com
Gabriele Oriti 211 http://lvvws211.northeurope.cloudapp.azure.com
Timothy Pauwels 212 http://lvvws212.northeurope.cloudapp.azure.com
Michael Platl 213 http://lvvws213.northeurope.cloudapp.azure.com
Matthias Rabus 214 http://lvvws214.northeurope.cloudapp.azure.com
Hauke Schuldt 215 http://lvvws215.northeurope.cloudapp.azure.com
Morten Sørensen 216 http://lvvws216.northeurope.cloudapp.azure.com
Tommy Svendsen Møballe 217 http://lvvws217.northeurope.cloudapp.azure.com
Pieter Verbeke 218 http://lvvws218.northeurope.cloudapp.azure.com
Joey Zuber 219 http://lvvws219.northeurope.cloudapp.azure.com
Matthew Zygmunt 220 http://lvvws220.northeurope.cloudapp.azure.com
Scope
Scope
• How to change your mindset to include writing automated tests into your
development process
•Testability Framework
•Standard libraries
Agenda
Morning Afternoon
Test Design
Why automated testing
a business justification
Everyone expects
Even when they
what you do, to be
don’t know what
perfect first time
they really want
every time
Then your
And that even if
expected to
you did write the
remember, every
original code!
last detail, forever
Many more deployment cycles than
historically
• Monthly CU’s need implementing more regularly
as ‘fixes’
• No choice on Tenerife Saas platform with limited
time to prepare
And our world is Annual & now Biannual Full Version
changing updates force refactoring
testing • Development
overran (its not a
precise science)
development
phase
• Sales didn’t factor
in the need to test
• Develop fast & fix
it in next release,
(Microsoft style?)
• Preparation of
But How?
• When you have little extra time
• And clients demand ever more productivity
it’s not hard –
build it once –
it’s just a small
use forever
new skill
it’s easy!
01 02 03 04 05 06 07
More reliable Defined signed More Run whenever it Its definitive Unintended use Your test library
design with up off use cases permutations helps without rather than is highlighted to go with your
front test are quickly waiting for data subjective even years later code library
definition possible prep
Repeatable
&
Fast
Testability Framework …
History Purpose
NAV Test Framework (NTF) Testing app code
•UI based automated tests •No load test
•C# •No multiuser execution
•Time consuming
•No config test
Multiple
•Builds per day Running isolated
•Versions •Data created of no importance
•Localization •Only result matters, i.e. success or
failure
Introduction
•In platform
• NAV 2009 SP1
•Headless (at first)
•Approx. 10 times faster
Testability Framework …
… for Dummies
Test Design
Test Design
Architecture Patterns
Setup
Exercise
Verify
Teardown
Test Case Patterns - ATDD
Given
•Setup
When
•Trigger
Then
•Verification
Test Data
aka Fixture or Test Fixture
Test Plan
Test Plan
When deleting a seminar with comments lines these lines should also be
deleted
Test Fixture - Example
[SCENARIO 0008]
When deleting a seminar with comments lines these lines should also be
deleted
// [GIVEN] Seminar Setup with No. Series set for seminar registration
ASSERTERROR
Rollback
Assert Library
Hands-on 2 – Seminar No. Series (0004)
•Create Seminar
•Change No. Field
•Test that error is shown
// [SCENARIO 0004] When changing the No. on seminar and applicable no.
// series does not allow this, an error should be thrown
AssistEdit
[SCENARIO 0201]
// [THEN] Verify that seminar price has changed on header and lines
Hands-on 5 – Seminar Registration (0026)
// [SCENARIO 0026] When a user selects a room on a seminar registration with too
// low capacity (i.e. max. participants) for selected seminar
// user will be asked if room should still be selected and max.
// participants on seminar registration should be adjusted
// [WHEN] User selects room on seminar registration header and select yes in
// confirm
Dos Don’ts
Design tests before app code is ready Do not wait till app code ready to
•Unit Tests and Use Case tests design your tests
Code minimalistic Run in production
Code generic
Test fixture
Version management on test code
Use standard libraries
References
NAV Blogs
•https://msdn.microsoft.com/en- •http://www.fluxxus.nl
us/dynamics-nav/testing-the- •http://thenavblog.com/
application
xUnite Test Patterns
•http://xunitpatterns.com
Four-Phase Test
•https://robots.thoughtbot.com/four-
phase-test
Acceptance Test–Driven
Development
•https://en.wikipedia.org/wiki/Accept
ance_test%E2%80%93driven_develop
ment
Thanx