SlideShare a Scribd company logo
1 of 10
Specs  _ what it is ,[object Object],See the  associated code  for a working example - HelloWorldSpec.scala import  org.specs._ object  HelloWorldSpec  extends   Specification  { "'hello world' has 11 characters"   in  {  "hello world" .size must_== 11 } "'hello world' matches 'h.* w.*'"   in  {  "hello world"  must beMatching( "h.* w.*" ) } } [info] Running specs tests... [info]  [info] Testing scalamelb.specs.HelloWorldSpec ... [info]  specifies  [info]  + 'hello world' has 11 characters [info]  + 'hello world' matches 'h.* w.*' [info]  [info] All tests PASSED.
Specs  _ structure ,[object Object]
The Specs structure:  Specify  system  (with context)   and  examples ,[object Object],NigerianPrinceSpec.scala "A Nigerian prince with access to an email account"   should  { "contact you in relation to his most generous offer"   in  { // exercise the logic and make assertions ... } }
Specs  _ structure ,[object Object]
Systems can't
Specifications can, sort of SnowflakeSpec.scala "A snowflake"   should  {  [info]  A snowflake should "be cold"   in  {  [info]  + be cold "and icy"   in  { … }  [info]  + and icy "and unique"   in  { … }  [info]  + and unique "A snowflake"   should  { "in the desert"   should  { "melt"   in  { … } object  SnowflakeSpec  extends   Specification  { "A snowflake"   isSpecifiedBy   SnowflakeInTheDesertSpec ,  SnowflakeInTheFrideSpec , SnowflakeOnTheTongueSpec }
Specs  _ matchers ,[object Object]
100+ are documented at time of writing  (v1.4.4)
Can write custom matchers. Can be combinatorial. PhoneBillSpec.scala "A phone bill"   should  { "keep a count of calls made"   in  { bill.numberOfCallsMade  must_==  3 "A phone bill"   should  { "include a call to my mother"   in  { bill.callsMade  must contain ("9898 4477") "A phone bill"   should  { "export calls to file"   in  { bill.exportFile  must (beReadable and not(beHidden))
Specs  _ scalacheck ,[object Object]

More Related Content

What's hot

Desenvolvendo em php cli
Desenvolvendo em php cliDesenvolvendo em php cli
Desenvolvendo em php cli
Thiago Paes
 
Four Ways to add Features to Ext JS
Four Ways to add Features to Ext JSFour Ways to add Features to Ext JS
Four Ways to add Features to Ext JS
Shea Frederick
 

What's hot (19)

Elegant APIs
Elegant APIsElegant APIs
Elegant APIs
 
Zen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsZen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst Applications
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging modulePython Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
 
Python Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & GeneratorsPython Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & Generators
 
Desenvolvendo em php cli
Desenvolvendo em php cliDesenvolvendo em php cli
Desenvolvendo em php cli
 
Four Ways to add Features to Ext JS
Four Ways to add Features to Ext JSFour Ways to add Features to Ext JS
Four Ways to add Features to Ext JS
 
Bee Smalltalk RunTime: anchor's aweigh
Bee Smalltalk RunTime: anchor's aweighBee Smalltalk RunTime: anchor's aweigh
Bee Smalltalk RunTime: anchor's aweigh
 
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit DevelopmentExploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
 
Test::Base
Test::BaseTest::Base
Test::Base
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
 
Sencha Touch Intro
Sencha Touch IntroSencha Touch Intro
Sencha Touch Intro
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
 
Ansible Callback Plugins
Ansible Callback PluginsAnsible Callback Plugins
Ansible Callback Plugins
 
Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)
 
MUST CS101 Lab11
MUST CS101 Lab11 MUST CS101 Lab11
MUST CS101 Lab11
 
Java Boilerplate Busters
Java Boilerplate BustersJava Boilerplate Busters
Java Boilerplate Busters
 
AOP in Python API design
AOP in Python API designAOP in Python API design
AOP in Python API design
 

Viewers also liked

Dissolution-method Development-PPT
Dissolution-method Development-PPTDissolution-method Development-PPT
Dissolution-method Development-PPT
Bhanu Prakash N
 
Recent advancement in impurity profiling
Recent advancement in impurity profilingRecent advancement in impurity profiling
Recent advancement in impurity profiling
Piramal Healthcare
 
Analytical method validation
Analytical method validationAnalytical method validation
Analytical method validation
Gaurav Kr
 

Viewers also liked (20)

What is Residual solvent and its identification
What is Residual solvent and its identificationWhat is Residual solvent and its identification
What is Residual solvent and its identification
 
Impurities in DS & DP
Impurities in DS & DPImpurities in DS & DP
Impurities in DS & DP
 
NDA ANDA IND by Anthony Crasto
NDA ANDA IND by Anthony CrastoNDA ANDA IND by Anthony Crasto
NDA ANDA IND by Anthony Crasto
 
Residual Solvent Limit Calculation
Residual Solvent Limit CalculationResidual Solvent Limit Calculation
Residual Solvent Limit Calculation
 
Handling of Out of Specification Results
Handling of Out of Specification ResultsHandling of Out of Specification Results
Handling of Out of Specification Results
 
Dissolution-method Development-PPT
Dissolution-method Development-PPTDissolution-method Development-PPT
Dissolution-method Development-PPT
 
Out of specification shravan
Out of specification shravanOut of specification shravan
Out of specification shravan
 
Impurities
ImpuritiesImpurities
Impurities
 
Recent advancement in impurity profiling
Recent advancement in impurity profilingRecent advancement in impurity profiling
Recent advancement in impurity profiling
 
Dissolution Method Development & Validation
Dissolution Method Development & ValidationDissolution Method Development & Validation
Dissolution Method Development & Validation
 
NDA & ANDA approval
NDA & ANDA approval NDA & ANDA approval
NDA & ANDA approval
 
Impurities in drug substance (ich q3 a)
Impurities in drug substance (ich q3 a)Impurities in drug substance (ich q3 a)
Impurities in drug substance (ich q3 a)
 
Out of specification (oos)1
Out of specification (oos)1Out of specification (oos)1
Out of specification (oos)1
 
ABBREVIATED NEW DRUG APPLICATION (ANDA) by Anthony crasto
ABBREVIATED NEW DRUG APPLICATION (ANDA) by Anthony crastoABBREVIATED NEW DRUG APPLICATION (ANDA) by Anthony crasto
ABBREVIATED NEW DRUG APPLICATION (ANDA) by Anthony crasto
 
Method Development and Method Validation for the estimation of Valganciclovir...
Method Development and Method Validation for the estimation of Valganciclovir...Method Development and Method Validation for the estimation of Valganciclovir...
Method Development and Method Validation for the estimation of Valganciclovir...
 
Analytical method validation by manoj ingale(best ppts)
Analytical method validation by manoj ingale(best ppts)Analytical method validation by manoj ingale(best ppts)
Analytical method validation by manoj ingale(best ppts)
 
analytical method validation
analytical method validationanalytical method validation
analytical method validation
 
analytical method validation and validation of hplc
analytical method validation and validation of hplcanalytical method validation and validation of hplc
analytical method validation and validation of hplc
 
Analytical method validation
Analytical method validationAnalytical method validation
Analytical method validation
 
ANDA filing
ANDA filingANDA filing
ANDA filing
 

Similar to Specs Presentation

JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
patricklee
 
Build Lightweight Web Module
Build Lightweight Web ModuleBuild Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
 
Falcon初印象
Falcon初印象Falcon初印象
Falcon初印象
勇浩 赖
 

Similar to Specs Presentation (20)

Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011
 
JavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly BracesJavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly Braces
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Jsp And Jdbc
Jsp And JdbcJsp And Jdbc
Jsp And Jdbc
 
Build Lightweight Web Module
Build Lightweight Web ModuleBuild Lightweight Web Module
Build Lightweight Web Module
 
Falcon初印象
Falcon初印象Falcon初印象
Falcon初印象
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
 
Drools BeJUG 2010
Drools BeJUG 2010Drools BeJUG 2010
Drools BeJUG 2010
 
Domain Specific Languages In Scala Duse3
Domain Specific Languages In Scala Duse3Domain Specific Languages In Scala Duse3
Domain Specific Languages In Scala Duse3
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Python - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave ParkPython - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave Park
 
Maker All - Executive Presentation
Maker All - Executive PresentationMaker All - Executive Presentation
Maker All - Executive Presentation
 
Spring Capitulo 05
Spring Capitulo 05Spring Capitulo 05
Spring Capitulo 05
 
Jquery 1
Jquery 1Jquery 1
Jquery 1
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Xenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesXenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practices
 
Xenogenetics
XenogeneticsXenogenetics
Xenogenetics
 
On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 

Specs Presentation

  • 1.
  • 2.
  • 3.
  • 4.
  • 6. Specifications can, sort of SnowflakeSpec.scala "A snowflake" should { [info] A snowflake should "be cold" in { [info] + be cold "and icy" in { … } [info] + and icy "and unique" in { … } [info] + and unique "A snowflake" should { "in the desert" should { "melt" in { … } object SnowflakeSpec extends Specification { "A snowflake" isSpecifiedBy SnowflakeInTheDesertSpec , SnowflakeInTheFrideSpec , SnowflakeOnTheTongueSpec }
  • 7.
  • 8. 100+ are documented at time of writing (v1.4.4)
  • 9. Can write custom matchers. Can be combinatorial. PhoneBillSpec.scala "A phone bill" should { "keep a count of calls made" in { bill.numberOfCallsMade must_== 3 "A phone bill" should { "include a call to my mother" in { bill.callsMade must contain ("9898 4477") "A phone bill" should { "export calls to file" in { bill.exportFile must (beReadable and not(beHidden))
  • 10.
  • 11. Default of 100 arbitrary test input values per statement
  • 12. For all n (where n >=0) √n² must equal n SquareRooter.scala object SquareRooterSpec extends Specification with ScalaCheck { "A Square Rooter" should { "find the originally squared value (as long as it wasn't negative)" in { // forAll { (n: Int) => scala.Math.sqrt(n*n) == n } must pass // fails on -1 forAll { n: Int => n >= 0 ==> (scala.Math.sqrt(n*n) == n) } must pass
  • 13.
  • 15. each Example SetupAndTeardown.scala object SetupAndTeardown extends Specification { doBeforeSpec{ println( "Specification setup" ) } doFirst{ println( "System setup" ) } doBefore{ println( "Example setup" ) } … doAfter{ println( "example teardown" ) } doLast{ println( "System teardown" ) } doAfterSpec{ println( "Specification teardown" ) } }
  • 16.
  • 17. They come with a warning – expect the unexpected if shared and mutated in different Systems within the Specification. And don't feed after midnight. ThreadedLists.scala var listOfStrings:List[ String ] = Nil val withThreeValues = beforeContext { listOfStrings = "bob" :: "harry" :: "dorothy" :: Nil } "A list of three Strings" ->-(withThreeValues) should { "be of three strings long" in { listOfStrings.length must_== 3 } }
  • 18.
  • 19.
  • 20. External (a case class extending SystemContext) MonkeyKing.scala object MonkeyKingSpec extends Specification with SystemContexts { /* Demonstrates explicit, internal system context. See example for more. */ "The monkey king under attack" should { val monkeyKingUnderAttack = systemContext { new MonkeyKing ( true ) } "summon warriors from his ear hairs" .withA(monkeyKingUnderAttack) { monkeyKing => monkeyKing.summonsWarriorsFromEarHair must beTrue
  • 21.
  • 22.
  • 23. Instinct class StackSpec extends Spec with ShouldMatchers { describe( "A newly created Stack" ) { val stack = new Stack[Any] it( "should be empty" ) { stack should be ('empty) } } } class ANewlyCreatedStack { val stack = new Stack[Any] @Specification def shouldBeEmpty = { expect that stack.depth isEqualTo 0 } }