Testing in Scala - Helion
ISBN: 978-14-493-6033-7
stron: 166, Format: ebook
Data wydania: 2013-01-24
Księgarnia: Helion
Cena książki: 55,24 zł (poprzednio: 64,99 zł)
Oszczędzasz: 15% (-9,75 zł)
If you build your Scala application through Test-Driven Development, you’ll quickly see the advantages of testing before you write production code. This hands-on book shows you how to create tests with ScalaTest and the Specs2—two of the best testing frameworks available—and how to run your tests in the Simple Build Tool (SBT) designed specifically for Scala projects.
By building a sample digital jukebox application, you’ll discover how to isolate your tests from large subsystems and networks with mocking code, and how to use the ScalaCheck library for automated specification-based testing. If you’re familiar with Scala, Ruby, or Python, this book is for you.
- Get an overview of Test-Driven Development
- Start a simple project with SBT and create tests before you write code
- Dive into SBT’s basic commands, interactive mode, packaging, and history
- Use ScalaTest both in the command line and with SBT, and learn how to incorporate JUnit and TestNG
- Work with the Specs2 framework, including Specification styles, matchers DSLs, and Data Tables
- Understand mocking by using Java frameworks EasyMock and Mockito, and the Scala-only framework ScalaMock
- Automate testing by using ScalaCheck to generate fake data
Osoby które kupowały "Testing in Scala", wybierały także:
- Superinteligencja. Scenariusze, strategie, zagro 66,67 zł, (14,00 zł -79%)
- Poradnik design thinking - czyli jak wykorzysta 48,28 zł, (14,00 zł -71%)
- Kosymulacja. Elastyczne projektowanie i symulacja wielodomenowa 38,39 zł, (11,90 zł -69%)
- F# 4.0 dla zaawansowanych. Wydanie IV 96,45 zł, (29,90 zł -69%)
- Systemy reaktywne. Wzorce projektowe i ich stosowanie 65,31 zł, (20,90 zł -68%)
Spis treści
Testing in Scala eBook -- spis treści
- Testing in Scala
- Preface
- Audience
- Organization of This Book
- About the Book
- Test-Driven Development
- Conventions Used in This Book
- Using Code Examples
- How to Contact Us
- Acknowledgments
- 1. Setup
- Setup in Mac OS X, Mac OS X Lion, and Linux
- Setup in Windows
- Using SBT
- SBT Folder Organization
- The Build File
- About Our Examples
- Creating Our Examples Using TDD, ScalaTest, and SBT
- 2. Structure and Configuration of Simple Build Tool (SBT)
- Directories in SBT
- The Importance of Good Infrastructure
- Triggered Executions
- What If I Need an Extra Repository?
- Format of Dependencies Line
- Updating Changes from the Build File
- Bringing Some Sources and Documentation
- Running SBT
- From the Shell
- Interactive Mode
- Basic Tasks
- Using the Scala Interpreter
- Knowing Your History
- Conclusion
- 3. ScalaTest
- Setting up ScalaTest in SBT
- Matchers
- Types of Matchers
- Simple matchers
- String matchers
- Relational operator matchers
- Floating-point-matchers
- Reference matchers
- Iterable matchers
- Seq and traversable matchers
- Map matchers
- Compound matchers
- Property matchers
- java.util.Collection matchers
- MustMatchers
- Types of Matchers
- Exception Handling
- Informers
- GivenWhenThen
- Pending Tests
- Ignoring Tests
- Tagging
- Running Tags From the Command Prompt
- Running Tags in SBT
- Specifications
- FunSpec
- WordSpec
- FeatureSpec
- FreeSpec
- FlatSpec
- JUnitSuite
- TestNGSuite
- Fixtures
- Anonymous Objects
- Fixture Traits
- OneInstancePerTest
- Before and After
- 4. Specs2
- Setting Up Specs2 in SBT
- Unit Specification
- Matchers
- Simple Matchers
- String Matchers
- Relational Operator Matchers
- Floating-Point Matchers
- Reference Matchers
- Iterable Matchers
- Seq and Traversable Matchers
- Map Matchers
- XML Matchers
- Partial Function Matchers
- Other Matchers
- Acceptance Specification
- Chaining Tests
- Given/When/Then
- Data Tables
- Tagging
- Fixtures
- 5. Mocking
- EasyMock
- EasyMock with ScalaTest
- Mockito
- Mockito with Specs2
- Order verification
- Mockito with Specs2
- ScalaMock
- Mocking Traits
- Mocking Classes
- Mocking Singleton Objects
- Mocking Companion Objects
- Mocking Functions
- Mocking Finals
- EasyMock
- 6. ScalaCheck
- Properties
- Constraining Properties
- Grouping Properties
- Custom Generators
- Arbitrary
- Labeling
- ScalaCheck with ScalaTest
- Generators
- ScalaCheck with Specs2
- Colophon
- Copyright