TestNG(十五)xml文件實現多線程測試
package com.course.testng.thread; import org.testng.annotations.Test; public class ThreadOnXml { @Test() public void test1(){ System.out.println(); System.out.printf("test1的線程Thread Id: %s%n",Thread.currentThread().getId()); } @Test() public void test2(){ System.out.printf("test2的線程Thread Id: %s%n",Thread.currentThread().getId()); } @Test() public void test3(){ System.out.printf("test3的線程Thread Id: %s%n",Thread.currentThread().getId()); } }
<?xml version="1.0" encoding="utf-8" ?>
<suite name = "thread" parallel="methods" thread-count="2" >
<!--
methodes級別:所有用用例都可以在不同的線程下去執行
thread-count:代表最大并發線程數
xml文件配置這種方式不能指定線程池,只有方法上才可以指定線程池
<test name = "demo1">
<classes>
<class name = "com.course.testng.thread.ThreadOnXml"/>
</classes>
</test>
</suite>




創作不易,轉摘請標明出處。如果有意一起探討測試相關技能可加博主QQ 771268289 博主微信:ding17121598
本文來自博客園,作者:怪圣卡杰,轉載請注明原文鏈接:http://www.rzrgm.cn/dwdw/p/11452925.html
浙公網安備 33010602011771號