Test Framework First Experience
For the first time in this week's software testing class, I learned about the concept of a software testing framework. The software testing framework encompasses a wide range of applications, from automated test frameworks to unit test frameworks and performance testing frameworks. During the last winter vacation, when learning Coursera's online course, it was found that Princeton's unit tests were very powerful, from program correctness to time consuming even memory consuming, and almost every error or flaw in the program was discovered. So, after finishing this week's course, I looked up some of the information and did the knowledge of the unit tests that this essay records.
First, what is the test framework
To understand the testing framework, first of all, the so-called framework has a concept. A framework is a reusable design of a whole or part of a system that is represented as a set of methods for interacting between an abstract component and a component instance, and another definition that the framework is an application skeleton that can be customized by the application developer. The former is from the application aspect, and the latter is the definition which is given from the objective aspect. The same is true for test frameworks, where the ultimate goal of the test framework is to spend a small amount of resources to accomplish as many test tasks as possible, so the test framework is built and the reuse of the framework is the most worthy of a thorough exploration by the tester.
The above gives a more professional definition, I understand the test framework is a tool that can help software testers to test software, can help testers save a lot of time to write repeated test cases.
Second, automated testing tools
Typically, after a test case has been designed and reviewed, the tester performs the test step-by, based on the procedures described in the test case, to obtain a common test procedure for comparing the actual results to the expected results. In order to save manpower, time or hardware resources and improve testing efficiency, the concept of automated testing is introduced.
Automated testing is the use of machines to help testers automate the testing of software.
Therefore, the essence of automated testing is: To test the program with a program. In other words, learning "programming language" is the basis of learning automated testing.
Of course, not all of the project used is suitable for automated testing, and the following conditions must be met:
1) Changes in demand are infrequent;
2) The project cycle is long enough;
3) Automated test scripts can be reused;
Here are some of the scenarios that are typically suitable for automated testing:
1) regression test, repeated a single data entry or keystroke and other test operations resulting in unnecessary time wasted and human waste;
2) In addition, the tester's understanding of the program and the validation of the design document are usually aided by the test automation tools;
3) The use of automated testing tools to facilitate the test report document generation and version consistency;
4) The Automation tool can determine the coverage path of the test case, and determine the coverage of the test case set for the program logic flow and control process.
In the study, I found that not the use of products are suitable for the use of automated testing, some project development cycle is very short, not worth a lot of time to invest in automated testing, some project testing rarely run, the use of automated testing is a waste. Automated testing is the efficiency of making it tedious and iterative.
Now commonly used test framework qtp,winrunner,rational robot and other very professional testing tools, specifically how these test frameworks are used due to the level of limited I did not understand in depth, blindly learning complex test tools is meaningless, After all, automated testing essentially uses program testing programs, exercise programming skills, lay a good foundation is the most important.
Three, Unit testing tools
The definition of unit testing is given in Wikipedia: In computer programming, Unit testing (also known as module testing , Unit testing) is a test work for correctness checking of program modules (the smallest unit of software design). The program unit is the smallest testable part to be applied. In procedural programming, a unit is a single program, function, process, etc. for object-oriented programming, the smallest element is a method, including a base class (superclass), an abstract class, or a method in a derived class (subclass).
Since the object of the unit test is the unit of a program, a function or a method, the importance of unit testing is self-evident: unit testing guarantees the correctness of the program.
Unit testing is also a basic responsibility of programmers, and programmers must maintain a conscientious attitude to the code they write, which is one of the basic professional qualities of a programmer. At the same time, unit testing capability is also a basic ability of programmers, which directly affects the productivity of programmers and the quality of software.
Normally qualified code should have the following properties: Correctness, clarity, standardization, consistency, efficiency, etc. (sorted by priority).
1. Correctness means that the code logic must be correct and capable of achieving the expected functionality.
2. Clarity means that the code must be concise and understandable, with no ambiguity as to the accuracy of the annotations.
3. Normative means that code must conform to the common norms defined by the enterprise or department, including naming rules, code styles, and so on.
4. Consistency refers to the code must be named (such as: the same function of variables as far as possible to use the same identifier), style is consistent.
5. Efficiency refers to the code not only to meet the above properties, but also to minimize the execution time of the code.
After a brief study of the JUnit test usage, I tested a simple Java class, and here is the definition and method of the class.
This class is primarily used to calculate the shortest ancestor path for computing two nodes in a graph shortest ancestral path
Next Test with JUnit
First import the JUnit package: Select Java Project, right-click---> select Properties----> Choose Java Build Path----in the window > click Add Library on the right----> In the pop-up window list, select JUnit----> Next----->junit 4 (I'm using Junit 4)---->finish
So the JUnit 4 package is done, and the next step is to create the test class:
Next Run the test case (select the class you want to test----> right-click---->run as---->junit test)
The following is a test result diagram
Because the SAP test object was created to read the text, the test result failed. In the future I will learn more about how to get test cases to accept command-line arguments.
Software Test learning Note Week 3---Test framework first experience