SlideShare ist ein Scribd-Unternehmen logo
1 von 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]

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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初印象
勇浩 赖
 

Ähnlich wie 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
XenogeneticsXenogenetics
Xenogenetics
 
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
 
On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

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 } }