1 Overview
- Introduction package elements
- packages
- package
- exclude
- include
2. Background
- ready
- Automatically generated file testng.xml
- We have a basic understanding of the structure of testng.xml
- problem
- How to test range bound
- Suppose I have a lot of test cases
- I want to perform all the time
- Or a part of the implementation
- Suppose I have a lot of test cases
- How to test range bound
3. Environment
- here
- idea
- 2018.2
- idea
- Profiles
- testng.xml
- Test Package Structure
- com.test01.Test1
- com.test02.Test2
- com.test03.Test3
- Promise
- Configuration file, I only interception suite following sections
4. Scene
1. Scenario 1: I want to perform all the test classes
- Outline
- Perform all the test classes
Profiles
<suite name="All Test Suite"> <test verbose="2" preserve-order="true" name="test 1"> <packages> <package name="com.test01" /> <package name="com.test02" /> <package name="com.test03" /> </packages> </test> </suite>
- Explanation
- packages
- Outline
- The root element of the package
- Nature
- Is a container class elements
- Tell testng, this package are the following
- Feel such a design, it may be for efficiency
- package, class, different mechanism group performed
- Loss of performance toggling
- So try to focus together
- Is a container class elements
- Outline
- package
- Outline
- Package elements
- Nature
- Specifies the package to be executed
- Attributes
- name
- Name of the test class
- name
- other
- use
- Need several packages, write directly on the line several packages
- use
- Outline
- packages
2. Scenario 2: package to perform a bit more, I can not be lazy
- Outline
- Perform all the test classes
- I want to be lazy
Profiles
<suite name="All Test Suite"> <test verbose="2" preserve-order="true" name="test 1"> <packages> <package name="com.*" /> </packages> </test> </suite>
- Explanation
- package
- Outline
- This uses regular
- with.*
- Regular
- With regular matches the package name
- note
- testng no wildcard
- No wildcard
- testng no wildcard
- Regular
- Outline
- package
3. Scenario 3: package to perform a little bit more, but I do not want to execute all packages
- Outline
- Most test execution
- But there is always such class, I do not want to perform
Profiles
<suite name="All Test Suite"> <test verbose="2" preserve-order="true" name="test 1"> <packages> <package name="com.*" > <exclude name="com.test03" /> </package> </packages> </test> </suite>
- Explanation
- exclude
- Outline
- Blacklist mechanism
- List in the package will not be executed
- Blacklist mechanism
- Outline
- exclude
4. Scenario 4: package to perform a little bit more, but I do not want to execute all packages
- Outline
- Perform a small number of test
- And the last point it seems there are so different
- Perform a small number of test
Profiles
<suite name="All Test Suite"> <test verbose="2" preserve-order="true" name="test 1"> <packages> <package name="com.*" > <include name="com.test03" /> </package> </packages> </test> </suite>
- Explanation
- include
- Outline
- Whitelist mechanism
- Will perform whitelist package
- other
- In the same package, it is best not to mix and exclude
- Whitelist mechanism
- Outline
- include
ps
- Documentation and Reference
- File
- Official Documents
- To be honest it is a page
- Pull the tail from scratch
- Things are talked about, but only when a dictionary to check
- You need some basic job
- But how to do basic
- Better things still did not speak
- Things are talked about, but only when a dictionary to check
- Official Documents
- books
- testng beginner's guide
- Good book
- 13-year basis
- no Chinese
- Good book
- testng beginner's guide
- dtd
- testng.xml the dtd file
- Outline
- xml description file
- No problem correctness
- After all, this is in accordance with testng to resolve the
- Comment on relatively clear
- And reference may be complementary to the official website or
- Of course, it looks a bit of trouble
- Dtd required to know the syntax
- content
- element
- Meaning elements
- Properties of the elements
- Child of the element
- element
- Outline
- testng.xml the dtd file
- File