Unit test using CSUnit (1)

zhaozj2021-02-11  214

Unit test using CSUnit (1)

First, install CSUnit

Second, create a new project and create a class to be tested: ///

////////// /// preparation for the test CSUnit Test method /////////// /// I hope to return /// Introduction value public bool myfunc (bool flag) {RETURN flag;}}

Third, create a test class

Add CSUNIT's reference, and create a category for testing, visibility is public, and must meet one of the following two conditions: 1, must end with Test; 2, plus properties: [TestFixTure]; add test Method, method visibility is public, and must satisfy one of the following two conditions: 1, must begin with Test; 2, plus attributes: [TEST] and then add test code in the method, the last code is as follows:

Public class forcsUnittest ()} public void testmyfunc () {forcSUnit csunit = new forcsunit (); assrt.true (true == csunit.myfunc (true);}}

Fourth, generate the executable of the project

5. Add the generated executable in CSUNITRUNNER

Sixth, final, run!

Is there any need to give me email: na57@ynu.edu.cn

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

New Post(0)