1 Overview
- class-related elements
- classes
- class
- methods
- exclude
- include
2. Background
- ready
- Understanding of the package and its sub-elements
- problem
- I just want to test a few specific class
- I would like to do filtering methods of the class
3. Environment
- here
- idea
- 2018.2
- idea
- Profiles
- testng.xml
- Test Package Structure
- com.test01.Test1
- method101
- method102
- com.test02.Test2
- method201
- method202
- com.test03.Test3
- method301
- method302
- com.test01.Test1
- Promise
- Configuration file, I only interception suite following sections
4. Scene
1. Scene 1: perform certain class
- Outline
- Perform some test classes
- Of course, the use of this package can also be achieved with include
- Perform some test classes
Profiles
<classes> <class name="com.test01.Test1"/> <class name="com.test02.Test2"/> <class name="com.test03.Test3"/> </classes>
- Explanation
- classes
- Outline
- The root element of class
- Nature
- Container element
- Nothing property itself
- As a parent element class elements
- Container element
- note
- A test there can be only one
- More will complain
- A test there can be only one
- Outline
- class
- Outline
- Earth elements
- Nature
- Test class information
- Attributes
- name
- The class name
- other
- And there, behind say
- name
- Outline
- classes
- doubt
- Question 1: I would like to test a lot of class time
- plan 1
- Use package
- Scenario 2
- With one element of class
- class name attribute does not support regular
- and so...
- Feel a little unreasonable
- Well, we say that the next question
- plan 1
- Question 1: I would like to test a lot of class time
2. Scenario 2: I want to perform a certain test class method
- Outline
- Perform some test classes
- Specify the exact method
Profiles
<classes> <class name="com.test01.Test1"> <methods> <include name="method.*"/> <exclude name="method.*2"/> </methods> </class> </classes>
- Explanation
- methods
- Outline
- The root element method
- But there is no way a child element
- Nature
- A container
- Outline
- include & exclude
- Outline
- This was said in the package, not to say
- They certainly support regular
- Outline
- methods
5. issue
1. Question 1: a class also appear in multiple class elements in
- Scenes
- The same class
- Appeared several times in class
- result
- Performed only once
2. Question 2: Methods include and exclude
- Scenes
- Same method
- The include and exclude multiple control
- result
- The same package
- The same operation is performed once at most
- include and exclude have the time, exclude high priority
- The same package
3. Question 3: class conflict and package
- Scenes
- Class is a package exclude
- Classes are classes include
- result
- After the first class package
- Normal execution
- After the first classes packages
- It will be problems
- packages must be in front of classes
- These elements, a test can be only one
- It will be problems
- If both include
- Normal execution
- Not repeat
- After the first class package
6 Conclusion
- A suite where there can be multiple test
- A test, the only one groups, packages, classes
- And there was order
- groups, packages, classes 里
- include and exclude elements or good judgment
- But across the element, then
- exclude front element may fail
- include multiple elements does not result in the test multiple times
ps
- The number of contradictory elements across operational, feel the need to think about
- Cross-test have not considered it