Mais conteúdo relacionado SpecFlow ❤ Xamarin (and Xamarin ❤ SpecFlow too!) - MonkeyFest 2017 Singapore, 23/09/20171. SpecFlow ❤ Xamarin
(and Xamarin ❤ SpecFlow too!)
MonkeyFest 2017 –
Global Xamarin Summit
23/09/2017
Gáspár Nagy
coach • trainer • bdd addict • creator of specflow
@gasparnagy • gaspar@specsolutions.eu
2. Copyright © Gaspar NagyCopyright © Gaspar Nagy
bdd addict
given.when.then
CAUTION!
on the stage
Gáspár Nagy
coach, trainer and bdd addict
creator of SpecFlow
gaspar@specsolutions.eu
https://specsolutions.eu
@gasparnagy
3. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Check out our new book!
• A BDD book for everyone (PO, BA, dev,
tester)
• Practical guide
• Demonstrates good collaboration
techniques, illustrated by concrete
examples
Find it on Leanpub through
http://bddbooks.com!
4. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Agenda
• Software Quality
• Test Automation
• Behavior Driven Development (BDD) with SpecFlow
5. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Why quality is so important
for mobile development?
6. Copyright © Gaspar NagyCopyright © Gaspar Nagy
TestMissionQuadrant
testabilityeasier hard
qualityimportantcritical
Financial
Frameworks
Trivial
mobile apps
Microservices
SPA
Mobile
apps
Enterprise
AppsConference
Session Demos
Desktop
Apps
Dev Tools
8. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Source: http://istqbexamcertification.com/what-is-software-quality/
What is software quality – ISTQB
9. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Defining software quality is not easy…
…we still try to measure it though
10. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Measuring software quality
• Number of bugs – contradicting measure: either good product or bad QA
• Number of tests – hard to determine the right amount of tests; can lead to test
gold-plating
• Test coverage (% of lines) – loosely correlates to quality; devs like gaming
• Code metrics – important factor, but not enough for quality
• Production issues – good, but too late
11. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Quality is about confidence
My best way to measure quality is to regularly ask the team
how they feel…
12. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Testing is a tool for gaining confidence about
software quality
14. Copyright © Gaspar NagyCopyright © Gaspar Nagy
TestAutomation
Pyramid
Test Automation Pyramid: Mike Cohn – Succeeding with Agile
Pic: http://gasparnagy.com/2017/02/balancing-scenarios-and-unit-tests-case-study-with-specflow/
15. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Defining quality based on the Maslow’s
pyramid (Gojko Adzic)
Source: https://gojko.net/2012/05/08/redefining-software-quality/
16. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Defining quality based on the Maslow’s
pyramid (Gojko Adzic)
Source: https://gojko.net/2012/05/08/redefining-software-quality/
17. Copyright © Gaspar NagyCopyright © Gaspar Nagy
A classification of quality aspects
Functional
• Works as
expected
• Expectations
are good
• Expectations
are
documented
Usability
• Secure
• Fast
• Convenient
• Pretty
• Consistent
• Predictable
Strategic
• Architecture
• Code quality
• Easy to
integrate
• Flexible
18. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Happy
path
Automatedtestsfora
specificscenario
Test Automation Pyramid: Mike Cohn – Succeeding with Agile
Pic: http://gasparnagy.com/2017/02/balancing-scenarios-and-unit-tests-case-study-with-specflow/
Specific
ScenarioTesting gap
Functional
Usability
Strategic
Specific
Scenario
Service-UI
connection
19. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Happy
path
Differentkindoftestson
thetestingpyramid
Test Automation Pyramid: Mike Cohn – Succeeding with Agile
Pic: http://gasparnagy.com/2017/02/balancing-scenarios-and-unit-tests-case-study-with-specflow/
Specific
Scenario
Service-UI
connection
Functional
Usability
Strategic
Smoke
test
Edge
case
Timeout
handling
Argument
check
21. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Functional quality tests:
How do I ensure the expected behavior?
22. Copyright © Gaspar NagyCopyright © Gaspar Nagy
[HttpPost]
public ActionResult Answer(int answer)
{
TriviaEntities db = new TriviaEntities();
var question = db.FindQuestion(CurrentQuestion);
if (question.Type == QuestionType.Easy)
{
db.AddScore(question, user, 10);
}
else
{
db.AddScore(question, user, 50);
}
var model = new GameModel
{ Score = db.GetScore(question, user) };
return View(model);
}
implement
feedback
Agile mini-waterfall
24. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Scenario: Correct easy answer scores 10
Given I register a team
When I submit a correct easy answer
Then my score should be 10
Discovery
Automation with
Cucumber/SpecFlow
Examples link requirements to software
Formulation
25. Copyright © Gaspar NagyCopyright © Gaspar Nagy
So, what is BDD?
Discovery
Shared understanding is established through
collaboration and structured conversations
Formulation
Examples of system behaviour are documented
as scenarios
Automation
Scenarios are automated to be able to verify the
system’s behaviour
26. Copyright © Gaspar NagyCopyright © Gaspar Nagy
This is an example!
Scenario: Correct easy answer scores 10
Given I register a team
When I submit a correct easy answer
Then my score should be 10
27. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Let’sturnthetesting
pyramid
Test Automation Pyramid: Mike Cohn – Succeeding with Agile
Pic: http://gasparnagy.com/2017/02/balancing-scenarios-and-unit-tests-case-study-with-specflow/
Functional
Usability
Strategic
Happy
path
Specific
Scenario
Service-UI
connection
Smoke
test
Edge
case
Timeout
handling
Argument
check
28. Copyright © Gaspar NagyCopyright © Gaspar Nagy
TestingIceberg!
Test Automation Pyramid: Mike Cohn – Succeeding with Agile
Pic: http://gasparnagy.com/2017/02/balancing-scenarios-and-unit-tests-case-study-with-specflow/
Functional
Usability
Strategic
Happy
path
Specific
Scenario
Service-UI
connection
Smoke
test
Edge
case
Argument
check
Timeout
handling
29. Copyright © Gaspar NagyCopyright © Gaspar Nagy
SpecFlow Basics
Testing the view model
Testing the UI
SpecFlow ❤ Xamarin
https://github.com/gasparnagy/Sample_Xamarin_GeekPizza
30. Copyright © Gaspar NagyCopyright © Gaspar Nagy
SpecFlow ❤ Xamarin
• SpecFlow is a tool to support Behavior Driven Development
• It can be used for Xamarin apps both for “UI” and “Service” tests
• The shared code for the different platforms also reduces testing efforts!
https://github.com/gasparnagy/Sample_Xamarin_GeekPizza
32. Copyright © Gaspar NagyCopyright © Gaspar Nagy
Define your own testing strategy!
• Define your own quality criteria
• Find the right tools for testing the particular aspects
• BDD/SpecFlow can help to make “business-interesting” tests
34. Gáspár Nagy
coach • trainer • bdd addict • creator of specflow
@gasparnagy • gaspar@specsolutions.eu
Thank you!
http://bddbooks.com