The development of test drivers is important

zhaozj2021-02-12  159

The development of test drivers is important

I don't know if you pay attention to such a change, that is, everyone is now talking about XP (EXTreme Programming) extreme programming, but it is still talking about whether the team is currently implementing XP mode development in the project. Minority (domestic). I am glad that my team is a team that makes me passionate, which makes us have the opportunity to uncover the extremely programmed veil with their own actions. (It is undeniable that we are pure novice for XP, implementing XP development, we sometimes have difficulty, sometimes thinking about giving up, using traditional development models (which seems more reasonable), but it's better. There is courage, our non-stop exchange (Communication), exchange, exchange)

"Simple design, Shandi development, pair programming and XP essence (communication, simple, feedback, courage)" These I think that if I use XP to at least reach the shape (huh, if you say this is a xp coat, I don't object, because for new - especially good things, we must first "shape", then ask "God"), but "first test after encoding" I always is the focus in XP mode ( personal opinion:)).

XP emphasizes the development of test-driven development (current domestic bookstore can find one of the "Test-Driven Development: By Example" of the "Test-Driven Development: By Example" of the "Test-Driven Development: BY EXAMPLE" written in XP, you can also http: // placeau in my site. The electronic version of the book is found in Sicool.com, which is for use only), which emphasizes a specific process to:

"Red / Green / Refactor", if you do not implement the development of test drivers in XP, the XP is a beautiful outermer for at least 60% of you.

I emphasized the importance of "testing in the first" in XP because I started with you: I can give a very clear understanding of the test - "That is the post-project work, of course, can also be in the project In the middle stage, start testing, but at least not there is no code, it is absolutely not! ". However, in fact, I touched the wall, and very painful. do you know? In the first small iteration, we can't use the test, facing our (XP emphasized code shared) code (by pairing programming, the current code is at least clean, standard), I don't have a self-confidence, that is Say I can't say that it can always be running, nothing to refactor.

In traditional development modes, what kind of "careful" you need to refactor, you can't imagine! However, why the XP developer can reconstruct the code like "playing", reconstruct the code, reconstruct it? Because they (XP developer) can have enough reason to be able to run through a variety of tests (reconstructed after the code), this self-confidence is from the heart, it makes you more Love Test Love Refactor, love this movement (Love this game! :)).

At present, Struts Hibernate developed in our project, which is involved in the test framework:

1. StrutstestCase is used to simulate the Struts environment to test Action. (It is really interesting, especially for developers who are familiar with Struts). Below is a description of the strutstestcase.sourceForge.Net:

StrutsTestCase for JUnit is an extension of the standard JUnit TestCase class that provides facilities for testing code based on the Struts framework. StrutsTestCase provides both a Mock Object approach and a Cactus approach to actually run the Struts ActionServlet, allowing you to test your Struts code with or without a running servlet engine. Because StrutsTestCase uses the ActionServlet controller to test your code, you can test not only the implementation of your Action objects, but also your mappings, form beans, and forwards declarations. and because StrutsTestCase already provides validation methods, It's quick and easy to write unit test case

2. CACTUS

Test servlet filter, etc.

The following is an explanation of CACTUS (http://jakarta.apache.org/cactus/) official release document:

Cactus Is A Simple Test Framework for Unit Testing Server-Side Java Code (Servlets, EJBS, Tag Libs, Filters, ...).

The INTENT OF CACTUS IS To Lower The Cost of Writing Tests for Server-Side Code. It Uses JUnit and Extends It.

Cactus Implements An In-Container Strategy (See How IT Works).

3. HttpUnit

Used for JSPS testing.

4. The three frameworks mentioned above JUnit (ERICH GAMMA and KENT BECK development are based on JUnit test framework.

Although this article focuses on testing, for "Test First, Code Later" does not explain how to make better implementation and have more deeper explains for the test framework mentioned above, if you are very concerned about the development of test drivers, Or you are now being troubled by such problems, I suggest you read the master Kent Beck's book is not a very thick book (in the first part of this article), I will be based on the use of the project next time. The test framework is organized and the instantiated document is given.

Excerpted from the faint approximately the hometown, the birth of the normal person [http://plateau.sicool.com]

JPLATEAU Wednesday, November 5, 2003, written in Guangzhou

转载请注明原文地址:https://www.9cbs.com/read-6090.html

New Post(0)