Download presentation
Presentation is loading. Please wait.
Published bySarah Keele Modified over 10 years ago
1
Automated Testing Ted Driggs (tdriggs)
2
What Verify program behavior without human interaction Programmatically load and run test code on a wide array of systems 2
3
Why 3
4
4
5
1.Bugs are bad 2.Programs are big 3.Tests are boring 5
6
METHODS Types of automated testing 6
7
Test Harnesses A test harness is a program which executes test cases. Most unit-testing frameworks are test harnesses. 7
8
Test Harnesses The average test harness follows a pattern like the one at right. There is a single method which is called when test execution starts: This might be opening a connection to a database. For each test, setup and cleanup methods are run. These methods ensure that each test runs from a consistent state and that test failures are atomic. Once the tests are all run, the class cleanup method is run. This method ensures the class does not leave the system in an inconsistent state. 8
9
Data-Driven Tests Use configuration files to pass data to test methods. Frequently XML, but not always 9
10
Data-Driven Tests 4 This will be read by a factory class and transformed 5 into an object and will höpefully find lots of bugs. At left is the XML for a data-driven test using TAEF (the T est A uthoring and E xecution F ramework). Each test row is treated like a test from the previous test harnesses. 10
11
TOOLS Existing software 11
12
Java The premiere unit testing frame- work for Java is jUnit. Supported by a very good Eclipse plugin, jUnit was one of the first successful test harnesses. 12
13
C# and.NET C# is a newer language, but the similarity to Java means similar test capabilities. There are two options: nUnit, which is a port of jUnit for.NET, and the newer Microsoft Visual Studio Unit Test Framework. The former was widely used until recently, but the expanded feature set of the latter means it is likely to become dominant. 13
14
Javascript The most widely-used option for a unit-tests is JsUnitTest, which is based on Prototype.js. 14
15
Python In keeping with Pythons batteries included philosophy, the language comes with the unittest module. It behaves very similarly to the ones shown previously. 15
16
RECOMMENDED USE Source Control Integration 16
17
Source Control Tests are only good as long as they are actually being used. Source control can verify that new code passes existing automation. 17
18
Source Control WriteSubmitTestCommit 18
19
Source Control WriteSubmitTestCommit 19
20
Bad Ideas Test-driven development Opt-in testing (devs will not remember) 20
21
SUMMARY Final Remarks 21
22
Benefits Prevents feature regressions Limits risk of refactoring Increases tests code coverage Makes life easier for developer and tester 22
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.