Preface: really write PHP code also has 3 years of time, barely a php programmer, but the bottom of my heart has not been emboldened. All say Test-driven development, but what is unit testing in my program development? This basic Programmer's literacy isIt is not clear, the lesson from the bitter, the decision of these basic knowledge and skills to have some understanding and mastery. otherwise, has been us
Unit TestUnit testing is a test that is used to verify correctness of a module, a function, or a classFor example, testing for abs in PythonEnter a positive number: such as 1, 2, 3, return value unchangedEnter negative numbers: For example-1,-2,-3, the return value is itself reversedInput 0: For
Android junit unit test, androidjunit
Classification of software testing* Black box testing* Test the logical business* White box testing* Test logic method
Based on test Granularity* Method test: function
During development, we need to perform unit tests on some functions and start activity to test some small functions. This is a bit of a fuss.
We can use the android unit test tool
This article is just an introduction to the effect of brick throwing.
Instrumentation has no interface and can be started.
The following
? @success_count + 1: @failure_count + = 1 puts result? "SUCCESS": "Failure" End Summary End def summary puts "\n#{@tests. Keys.size} Tests, #{@success_count} SUCCESS, #{@failure_count} failure "End end
If we "need" to use this framework to perform the initial test, we will get the following output:
Some test
-Should be true SUCCESS
-should show, expression can be true SUCCESS
-should be failing d
] (); printmessage (Test + "Success", "#080" ); If (Hasteardown) {tests. teardown ();} successcount ++ ;} Catch (E) {printmessage (Test + "Failed:" + E. message, "#800" ) ;}} Printmessage ( "Test Result:" + testcount + "tests," + successcount + "success," + (testcount-successcount) + "failures", "#800" );}
The running result is the same as that of the third
Chai: Should be the current set of popular assertion libraries, support TDD (assert), BDD (expect, should) two styles of assertion libraryvar chai = require (' Chai 'var// typef assert = = = = ' object '// To expand the Obejct.prototype
another open source contribution from Should.js:TJ
Another assertion library of the Expect.js:BDD style, based on Should.js, is the mini version of the BDD library
ASSERT (node comes with core module): Assertion module that can be used in
Recently, I have carefully practiced Java projects such as unit test Struts2 and Spring. Today I specifically wrote the actions and services of the Unit Test Struts2Spring project.
I have already written a lot of code for unit tes
Unit testing can help us locate the module and the unit that is having problems accurately and quickly.The object of the unit test is a function, which must have the output (even if it is an abnormal output) so that the unit test
situation is starting to go bad. I've spent too much time trying to figure out the system's errors by debugging code, but most of the anomalies have been captured and the process continues to run, causing me to waste a lot of time. At least in some cases, I was fortunate enough to solve the problem by logging the wrong log.
What is Sqlunit
Sqlunit is a unit test tool for regression
A recent study of the Jasmine framework has yielded considerable benefits. Based on a company colleague's documentation, here are some of the features of the Jasmine framework.
One: Introduction
The Jasmine Framework is a behavioral-driven development framework for testing JavaScript code that does not rely on any other JavaScript framework, does not require a DOM, and has a very simple and clear syntax.
Second: Scope of application
Because the Jasmine framework does not rely on browsers, DO
Take struts 2.2.1.1 as an example, the struts2-junit-plugin-2.2.1.1.jar in the struts2 release package can be used, which provides two classes: strutstestcase, strutsspringtestcase, provides unit test support for Struts-only applications and Struts + spring integration. The descriptions are as follows.
1. strutstestcase
First, prepare a pure struts2 project, and
written in an XML file. The SQLUnit tool is implemented in Java. The JUnit unit is used to test the pipeline construction and conversion XML test information to connect to the JDBC database, and the results obtained from the database and the expected results in the test cas
IOS unit test in xcodeLuo chaohui (http://blog.csdn.net/kesalin) CC license, reprinted please indicate the source
Xcode has a built-in ocunit unit testing framework, but the best testing framework is ghunit. Through the ghunit + ocmock combination, we can perform more powerful unit
successful and the test results are as follows:Test three: Compound interest calculation time1. The expected return value is 23, the actual value is 23.45, allowing for an error within 1.0.2. Test procedure:This is compound interest calculation:With an allowable error of 1.0, the test succeeds and the test results are
Original blog, reprint please indicate the sourceBlog.csdn.net/hello_hwcPlease pay attention to my ios-sdk detailed columnHttp://blog.csdn.net/column/details/huangwenchen-ios-sdk.html
Test is an indispensable part of a good app. Each app is grouped together by a small set of features. These small functions are composed of a function or a combination of algorithms. A unit
(suite) can be freely agreed. For example, the test cases of a module are centralized into a test package (suite ). Test Cases are used to test functions in a module. The test case function calls the tested function through vario
4. Testing for failed DebugsIt's time to trace the failure of the previous test. Open GAMEBOARD.M, find Cellstateatcolumn:androw: And SetCellState:forColumn:andRow: Methods, you'll see that they all call a checkboundsforcolumn: Androw: The helper method used to detect array boundaries.The method comments in the header file GameBoard.h are as follows:Raises an nsrangeexception if the column or row is out of boundsHowever, if the boundary is exceeded, C
1.Junit annotationsThe difference between Junit3 and JUNIT4. Test: White box, black box test, black box: Many times are black box, standing in the user's point of view to use the function, demand-oriented way, as long as the measurement function how to use.White Box testing: After the code to test, test logic, time, fu
How to name a unit test?
If we want to write down our unit tests, we may need to have a good layout and plan how to create the class and unit test method for unit tests, the following is a brief introduction.1: Separate integratio
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.