售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Testing with F#
Table of Contents
Testing with F#
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. The Practice of Test Automation
Testing as a practice
Black or white box testing
Manual testing
Test automation
Style check
Static analysis
Unit testing
Integration testing
System testing
Building trust
The purpose of testing
When not to test
Testing with intent
Asserting written code
Contracts versus tests
Designing code to be written
Writing tests for regression
Executable specifications
Summary
2. Writing Testable Code with Functional Programming
Purely functional
Immutability
Immutable data structures
Built-in immutable types
Tuple
List
Sequence
Creating an immutable type
Writing testable code
Active patterns
Higher order functions
Partial application
Continuations
Expressiveness through functional programming
Imperative programming
Declarative programming
Tail call optimization
Parallel execution
Summary
3. Setting Up Your Test Environment
F# Interactive
Loading external references
Testing with Visual Studio
NUnit
xUnit
Comparing MSTest, NUnit, and xUnit
Tools and frameworks
FsUnit
ReSharper test runner
xUnit.net
Executing a test suite outside Visual Studio
MSTest
NUnit
xUnit
FAKE
Continuous integration
Git Hooks
TeamCity
Summary
4. Unit Testing
Structuring your tests
Arrange, act, assert
Separate project versus inline tests
FsUnit
Assertions
Custom assertions
Unquote
Assertions
Testing in isolation
Vertical slice testing
Finding the abstraction level
Public interface
Private functions
Test doubles
Dependency injection
Functional injection
Currying
Higher order functions
Stubbing with Foq
Mocking
Dealing with databases
Summary
5. Integration Testing
Good integration tests
Layer-for-layer testing
Top down testing
External interface testing
Your first integration test
Setting up and tearing down databases
Brownfield database setup
Really large databases
Speeding up integration testing
Testing in parallel
Testing stored procedures
Data-driven testing
Testing web services
Web service type provider
Summary
6. Functional Testing
Specifications
Setting up TickSpec
Executable specifications
Combinatorial examples
Web-browser-based testing
Selenium
PhantomJS
Canopy
CSQuery
Regression testing
Summary
7. The Controversy of Test Automation
Bugs or defects
Bugs
How to avoid them
Defects
How to avoid them
The difference between bugs and defects
The cost of quality
Quality index
The software craftsman
Not all code is created equal
Being a pragmatic programmer
Good enough
Technical debt
The false security of code coverage
Measuring the delta of code coverage
Test-driven development
Red, green, refactor
Aversions to test-driven development
Test first development
Fixing bugs
API design
Testing or fact-checking
Replacing the tester with automation
Summary
8. Testing in an Agile Context
Building a bridge or tending to a garden
The broken iron triangle
Visualizing metrics
The Kanban board
Predictability
Testing
What it means to be done
Mitigating risks
Known unknowns
Unknown unknowns
Automation
Testing in agile
Summary
9. Test Smells
Tests that break upon refactoring
Tests that break occasionally
Tests that never break
Tests that are too complex
Tests that require excessive setup
Developers not writing tests
Testing is a waste
Management won't let us
We don't know where to start
Our code is hard to test
It's a thing about culture
Summary
10. The Ten Commandments of Test Automation
Testing behavior, not implementation
Using ubiquitous language in your test name
Asserting only one thing in your test
Don't mock the Mockingbird
Always refactor your SUT
Your test should never be more than 10 lines of code
Always test in isolation
Controlling your dependencies
Your test is a ninja
The test is not complex
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜