Download presentation
Presentation is loading. Please wait.
Published byClinton Carpenter Modified over 9 years ago
1
Data-Driven Transaction Based Unit Tests Engin Yorgancıoğlu Volkan Sevinçok Turkey
2
2 Why automate unit tests? Automation of unit tests allows regression testing, by which functionality and quality can be continuously tracked.
3
3 What is DTUT? DTUT “Data-Driven Transaction-Based Unit Test” helps fast test development with increased test-case maintainability in applications based on similar architectures to that of application-under-test.
4
4 What do we mean by “transaction” ? “Transaction” in this context refers to the specific transactional operations of the architecture used in the application-under-test, rather than database transactions.
5
5 About Application-Under-Test /1 The application’s architecture similar to Microsoft’s Enterprise Development Reference Architecture (EDRA) Uses ASP.NET and C# on Microsoft Visual Studio 2008 using Oracle 10g database
6
6 About Application-Under-Test /2 This architecture mainly operates on Request and Response objects communicated through pipelines. Requests are generated upon user interactions with the interface.
7
7 About Application-Under-Test /3 Transaction objects process the incoming request They generate a Response object to send to the UI Data-access layer classes are created by using an O/R mapping tool
8
8 The Application Framework
9
9 DTUT Framework /1 Writing unit tests for each smallest unit was unfeasible due to business constraints. We take transaction classes as our “test units”.
10
10 DTUT Framework /2 Writing trivial unit-tests: as simple as inserting a row in the test database. Transaction-level unit tests: Achieving high coverage quickly Intensifying unit tests in critical areas of the system.
11
11 DTUT Framework /3 Uses reflection to execute all transactions in a generic way. Test cases added as rows to test database. Connects to this database and retrieves these rows one by one and executes them.
12
12 DTUT Framework /4 DTUT have wider coverage than the simplest unit tests, but they still remained more focused than integration-level ones. Code Generation For Framework To further speed up the process, a code generation tool is designed and implemented. The generator produces the test class and creates the test data table in which test cases will added.
13
13 DTUT Framework Usage and Testing Process /1 Test suite design: The design is made so that it involves positive and negative test cases. Test class and test-data table generation: The test class(es) for the specified unit and table(s) to hold test data are created using the generator tool. Forming test cases: Each designed test case is entered in the test-data tables as a row.
14
14 DTUT Framework Usage and Testing Process /2 Running tests: The tests are run using Visual Studio Team System 2008. Reporting: Visual Studio reports successful and failed tests visually. Each test can be tracked down to its data rows and the reasons for unexpected results can be found easily. If a defect is discovered, it is entered into the defect- tracking system.
15
15 Sample metrics (AUT) Lines of Code : 859,897 Total screens: 780 Total database tables: 820 Methods/Class : 3.2 Average Complexity : 3.05
16
16 Sample metrics (Testing) 4500 Unit Tests with DTUT: 10 developers x 3 Months For testing a sample entity; Without DTUT: 18 methods in 560 LoC With DTUT Framework: 2 methods in 50 LoC 18 rows was created in test database where each row corresponded to a test method.
17
17 The team’s approach to testing Project manager Software project manager Developers
18
18 DTUT Framework v2 Why need the second version? How different is it?
19
19 DTUT Framework v3 Future work
20
20 Advantages DTUT Generation reduces trivial unit test generation time to a simple user-interface selection effort and inserting rows to the test. This enables rapid creation of unit-tests which is especially important for testing projects that have sizeable amounts of existing untested code.
21
21 Limitations DTUT is that its applicable domain covers only projects based on similar frameworks working on.NET architecture, and adhering to certain naming conventions (because of reflection).
22
22 Conclusion As with all frameworks, DTUT framework can be useful in its own defined scope and domain. Although it is not a silver bullet, it can facilitate rapid production and standardization of unit tests.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.