Installation, testing and introduction of Linux testing software Attribute

Source: Internet
Author: User

This is a tool used to test the system stability. It is mainly done by testing several testing programs with high resource consumption at the same time. Whether these programs can be opened can be controlled independently, the following describes how to install and test the Linux testing software Attribute.


I. Installation of Linux testing software Attribute


Free, open-source unit testing software.
You only need to run the installer according to all the default settings.
NUNIT: http://www.nunit.org/
Nunit addin: http://sourceforge.net/projects/nunitaddin/


Ii. Linux testing software DLL Testing


1: Create a Class Library PROJECT,
2: Add a reference to the DLL to be tested,
3: Add NUnit. Framework. dll reference
4: Add using NUnit. Framework to the beginning of the file.
5: before the class to be tested, add: [TestFixture]
6: Add [Test] before the method to be tested.
7: start the NUNIT-GUI, create a PROJECT, add and execute the new Class Library PROJECT.


Iii. Introduction to Linux testing software Attribute

1: TestFixture: This Attribute must be added before each class to be tested.
Note: The class to be tested must have a public default constructor (or no constructor is defined)

2: Test: This Attribute must be added before the function to be tested in each Test class.
Note: The method with Test attribute must be public, return void, and no input parameter. If these rules are not met, the method is not listed in the Test Runner GUI.

And the method is not executed when the Unit Test is executed.

3: Introduction to TestFixtureSetUp and TestFixtureTearDown
These two functions are mainly used in TestFixture, which provides TestFixtureSetUP before a group of functions are executed for any test run) and TestFixtureTearDown after the last test is executed ). Each TestFixture only

There can be a TestFixtureSetUp method and a TestFixtureTearDown method. If you use more than one TestFixtureSetUp and TestFixtureTearDown methods, you can compile the method but do not execute it. Note that

TestFixture can have one TestFixtureSetUp and one SetUp, or one TestFixtureTearDown and one TearDown method.
TestFixtureSetUp and TestFixtureTearDown are not convenient to use the SetUp and TearDown methods.
Generally, SetUp and TearDown attributes are used.

4: Introduction to SetUp and Teardown Attributes
When writing Unit Tests, you sometimes need to make preparations or aftercare before or after each test method is executed. Of course, you can write a private method and

Start with or end with this special method. Alternatively, you can use the SetUp and Teardown Attributes we will introduce to achieve the same purpose. As the two Attributes names mean, there are Setup

The method of Attribute will be executed by test Runner before each Test method in TextFixture is executed, and the method with Teardown Attribute will be executed after each test method is executed

Run the Test Runner command. Generally, Setup Attribute and Teardown Attribute are used to prepare required objects (objects), such as database connection.

5: Attribute description
TestFixture: This Attribute must be added before each class to be tested.
Test: This Attribute must be added before the function to be tested in each Test class.
TestFixtureSetUp: run only once in a test class and before running all test cases
SetUp: Run before each test case
ADD: Test Case 1
TearDown: Run after each test case
SetUp: Run before each test case
Sub: Test Case 2
TearDown: Run after each test case
TestFixtureTearDown: runs only once in a test class and after all test cases are run.
ExpectedException: detects and throws an exception.
[Test]
[ExpectedException (typeof (InvalidOperationException)]
[Test, ExpectedException (typeof (InvalidOperationException)]
Ignore: temporarily Ignore some tests
Ignore ("Not ready to test this yet ");

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.