- 浏览: 7943410 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (2425)
- 软件工程 (75)
- JAVA相关 (662)
- ajax/web相关 (351)
- 数据库相关/oracle (218)
- PHP (147)
- UNIX/LINUX/FREEBSD/solaris (118)
- 音乐探讨 (1)
- 闲话 (11)
- 网络安全等 (21)
- .NET (153)
- ROR和GOG (10)
- [网站分类]4.其他技术区 (181)
- 算法等 (7)
- [随笔分类]SOA (8)
- 收藏区 (71)
- 金融证券 (4)
- [网站分类]5.企业信息化 (3)
- c&c++学习 (1)
- 读书区 (11)
- 其它 (10)
- 收藏夹 (1)
- 设计模式 (1)
- FLEX (14)
- Android (98)
- 软件工程心理学系列 (4)
- HTML5 (6)
- C/C++ (0)
- 数据结构 (0)
- 书评 (3)
- python (17)
- NOSQL (10)
- MYSQL (85)
- java之各类测试 (18)
- nodejs (1)
- JAVA (1)
- neo4j (3)
- VUE (4)
- docker相关 (1)
最新评论
-
xiaobadi:
jacky~~~~~~~~~
推荐两个不错的mybatis GUI生成工具 -
masuweng:
(转)JAVA获得机器码的实现 -
albert0707:
有些扩展名为null
java 7中可以判断文件的contenttype了 -
albert0707:
非常感谢!!!!!!!!!
java 7中可以判断文件的contenttype了 -
zhangle:
https://zhuban.me竹板共享 - 高效便捷的文档 ...
一个不错的网络白板工具
testng笔记5
1 testng的报表可以自定义,有两种方法实现:
1) listners:实现org.
testng.ITestListener接口,当测试开始,结束,失败跳过,暂停的时候,这些类都会监听到;
2)实现org.
testng.IReporter接口,当整个suite测试结束后,可以获得全部的测试情况
2 先看实现testng.ITestListener接口的例子
首先给出要测试的类如下:
public class SampleTest {
@Test
public void testMethodOne(){
Assert.assertTrue(true);
}
@Test
public void testMethodTwo(){
Assert.assertTrue(false);
}
@Test(dependsOnMethods={"testMethodTwo"})
public void testMethodThree(){
Assert.assertTrue(true);
}
然后实现testng.ITestListener接
public class CustomLogging implements ITestListener{
@Override
public void onTestStart(ITestResult result) {
System.out.println("Test method started: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestSuccess(ITestResult result) {
System.out.println("Test method success: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestFailure(ITestResult result) {
System.out.println("Test method failed: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestSkipped(ITestResult result) {
System.out.println("Test method skipped: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
// Leving blank
}
public void onStart(ITestContext context) {
System.out.println("Test in a suite started: "+context.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onFinish(ITestContext context) {
System.out.println("Test in a suite finished: "+ context.getName()+ " and time is: "+getCurrentTime());
}
public String getCurrentTime(){
DateFormat dateFormat =
new SimpleDateFormat("HH:mm:ss:SSS");
Date dt = new Date();
return dateFormat.format(dt);
}
3 编写自定义reporter
public class CustomReporter implements IReporter {
@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
String outputDirectory) {
//Iterating over each suite included in the test
for (ISuite suite : suites) {
//Following code gets the suite name
String suiteName = suite.getName();
//Getting the results for the said suite
Map<String, ISuiteResult> suiteResults = suite.getResults();
for (ISuiteResult sr : suiteResults.values()) {
ITestContext tc = sr.getTestContext();
System.out.println("Passed tests for suite '" + suiteName + "' is:" + tc.getPassedTests().getAllResults().size());
System.out.println("Failed tests for suite '" + suiteName + "' is:" + tc.getFailedTests().getAllResults().size());
System.out.println("Skipped tests for suite '" + suiteName + "' is:" + tc.getSkippedTests().getAllResults().size());
}
}
}
<suite name="Simple Reporter Suite">
<listeners>
<listener class-name="test.reporter.CustomReporter" />
</listeners>
<test name="Simple Reporter test">
<classes>
<class name="test.sample.SampleTest" />
</classes>
</test>
</suite>
输出:Passed tests for suite 'Simple Reporter Suite' is:1
Failed tests for suite 'Simple Reporter Suite' is:1
Skipped tests for suite 'Simple Reporter Suite' is:1
4 程序中动态编程使用testng
public class SimpleTestngCode {
public void simpleTestNgTest(){
//List of xml suites to be considered for test execution
List<XmlSuite> suites = new ArrayList<XmlSuite>();
//List of classes to be considered for test execution
List<XmlClass> classes = new ArrayList<XmlClass>();
//Defines a simple xml suite with a name
XmlSuite suite = new XmlSuite();
suite.setName("Simple Config suite");
//Defines a xml test for a suite and with a said name
XmlTest test = new XmlTest(suite);
test.setName("Simple config test");
//A single xml class to be considered for execution
XmlClass clz = new XmlClass("test.sample.SampleTest");
classes.add(clz);
//Sets the list of classes to be considered for execution for a test
test.setXmlClasses(classes);
//Adds a single suite to the list suites
suites.add(suite);
//Defining a testng instance
TestNG tng = new TestNG();
//Sets the List of xml suites to be considered for execution
tng.setXmlSuites(suites);
//Runs the configured testng tests.
tng.run();
}
对应的API
XmlSuite Defines a simple XML suite tag of the testng XML
XmlTest Describes a test tag of the testng XML
XmlPackage Describes a package tag in the testng XML
XmlClass Describes a class tag in the testng XML
6 看下如何动态代码中,增加参数
public class ParametrizedTest {
@Parameters({"suite-param-one","test-param-one"})
@Test
public void paramTestOne(String suiteParam,String testParam){
System.out.println("Test One.");
System.out.println("Suite param is: "+suiteParam);
System.out.println("Test param is: "+testParam);
}
@Parameters({"suite-param-two","test-param-two"})
@Test
public void paramTestTwo(String suiteParam,String testParam){
System.out.println("Test Two.");
System.out.println("Suite param is: "+suiteParam);
System.out.println("Test param is: "+testParam);
}
测试类:
public class ParameterizedCode {
public void parameterizedTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
Map<String,String> suiteParams = new HashMap<String,String>();
Map<String,String> testParams = new HashMap<String,String>();
XmlSuite suite = new XmlSuite();
suite.setName("Parameterized suite");
//Defining suite level params and their values
suiteParams.put("suite-param-one", "Suite Param One");
suiteParams.put("suite-param-two", "Suite Param Two");
//Setting the params to the suite
suite.setParameters(suiteParams);
XmlTest test = new XmlTest(suite);
test.setName("Parameterized test");
//Defining test level params and their values
testParams.put("test-param-one", "Test Param One");
testParams.put("test-param-two", "Test Param Two");
//Setting the test level params
test.setParameters(testParams);
XmlClass clz = new XmlClass("test.sample.ParametrizedTest");
classes.add(clz);
test.setXmlClasses(classes);
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
7 include /exclude的API
public void includeExcludeTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Include Exclude Method suite");
XmlTest test = new XmlTest(suite);
test.setName("Include Exclude Method test");
//Test class to be included for test execution
XmlClass clz = new XmlClass("test.sample.IncludeExcludeMethodTest");
//Test methods to be included
XmlInclude methodOne= new XmlInclude("testMethodOne");
XmlInclude methodTwo= new XmlInclude("testMethodTwo");
//Creating a list included methods and adding the methods instances to it
List<XmlInclude> includes = new ArrayList<XmlInclude>();
includes.add(methodOne);
includes.add(methodTwo);
//Setting the included methods for the class
clz.setIncludedMethods(includes);
classes.add(clz);
test.setXmlClasses(classes);
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
8 也可以包含或者排除分组
public void includeExcludeTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Include Exclude Group suite");
XmlTest test = new XmlTest(suite);
test.setName("Include Exclude Group test");
XmlClass clz = new XmlClass("test.sample.IncludeExcludeGroupTest");
classes.add(clz);
test.setXmlClasses(classes);
//Including and excluding groups
test.addIncludedGroup("group-one");
test.addExcludedGroup("group-two");
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
9 依赖测试API
public void dependencyTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Dependency suite");
XmlTest test = new XmlTest(suite);
test.setName("Dependency test");
XmlClass clz = new XmlClass("test.sample.DependencyTest");
classes.add(clz);
test.setXmlClasses(classes);
//Defining an xml dependency where "group-one" depends on "group-two"
test.addXmlDependencyGroup("group-one", "group-two");
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
10 在testng下运行junit
<test junit="true" name="Junit test">
<classes>
<class name="test.sample.junit.JunitSampleTest" />
</classes>
</test>
设置junit="true"就可以了,可以在同一个testsuite中运行junit和testng
<suite name="Junit Testng Suite">
<test junit="true" name="Junit test">
<classes>
<class name="test.sample.junit.JunitSampleTest" />
</classes>
</test>
<test name="Testng test">
<classes>
<class name="test.sample.testng.TestngSampleTest" />
</classes>
</test>
</suite>
11 testng maven的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
其他设置项:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<parallel>tests</parallel>
<threadCount>5</threadCount>
</configuration>
</plugin>
Have a
12 testng结合selenium
public class SampleSeleniumTest {
WebDriver driver;
@BeforeMethod
public void beforeMethod(){
//Initializing the selenium webdriver object
driver = new FirefoxDriver();
}
@Test
public void googleTest(){
//Opening the google page
driver.navigate().to("http://www.google.com");
//Finding the search field and entering text to it.
driver.findElement(By.cssSelector("input[name='q']")).sendKeys("TestNg");
WebDriverWait wait = new WebDriverWait(driver, 30);
//Waiting for the serach list to be populated.
List<WebElement> results=wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("h3.r")));
//Getting the text of the first search result.
String searchResult=results.get(0).getText();
//Verifying the text of first search test result with the expected text
Assert.assertEquals(searchResult,"TestNG - Welcome");
}
@AfterMethod
public void afterMethod(){
//Quitting the browser.
driver.quit();
}
testng.xml:
<suite name="Selenium Suite" parallel="tests" thread-count="2">
<test name="Selenium test - 1">
<classes>
<class name="test.java.org.sample.selenium.SampleSeleniumTest" />
</classes>
</test>
<test name="Selenium test - 2">
<classes>
<class name="test.java.org.sample.selenium.SampleSeleniumTest" />
</classes>
</test>
</suite>
这样的话,同时打开两个firefox去进行测试搜索结果。
1 testng的报表可以自定义,有两种方法实现:
1) listners:实现org.
testng.ITestListener接口,当测试开始,结束,失败跳过,暂停的时候,这些类都会监听到;
2)实现org.
testng.IReporter接口,当整个suite测试结束后,可以获得全部的测试情况
2 先看实现testng.ITestListener接口的例子
首先给出要测试的类如下:
public class SampleTest {
@Test
public void testMethodOne(){
Assert.assertTrue(true);
}
@Test
public void testMethodTwo(){
Assert.assertTrue(false);
}
@Test(dependsOnMethods={"testMethodTwo"})
public void testMethodThree(){
Assert.assertTrue(true);
}
然后实现testng.ITestListener接
public class CustomLogging implements ITestListener{
@Override
public void onTestStart(ITestResult result) {
System.out.println("Test method started: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestSuccess(ITestResult result) {
System.out.println("Test method success: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestFailure(ITestResult result) {
System.out.println("Test method failed: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestSkipped(ITestResult result) {
System.out.println("Test method skipped: "+result.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
// Leving blank
}
public void onStart(ITestContext context) {
System.out.println("Test in a suite started: "+context.getName()+ " and time is: "+getCurrentTime());
}
@Override
public void onFinish(ITestContext context) {
System.out.println("Test in a suite finished: "+ context.getName()+ " and time is: "+getCurrentTime());
}
public String getCurrentTime(){
DateFormat dateFormat =
new SimpleDateFormat("HH:mm:ss:SSS");
Date dt = new Date();
return dateFormat.format(dt);
}
3 编写自定义reporter
public class CustomReporter implements IReporter {
@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
String outputDirectory) {
//Iterating over each suite included in the test
for (ISuite suite : suites) {
//Following code gets the suite name
String suiteName = suite.getName();
//Getting the results for the said suite
Map<String, ISuiteResult> suiteResults = suite.getResults();
for (ISuiteResult sr : suiteResults.values()) {
ITestContext tc = sr.getTestContext();
System.out.println("Passed tests for suite '" + suiteName + "' is:" + tc.getPassedTests().getAllResults().size());
System.out.println("Failed tests for suite '" + suiteName + "' is:" + tc.getFailedTests().getAllResults().size());
System.out.println("Skipped tests for suite '" + suiteName + "' is:" + tc.getSkippedTests().getAllResults().size());
}
}
}
<suite name="Simple Reporter Suite">
<listeners>
<listener class-name="test.reporter.CustomReporter" />
</listeners>
<test name="Simple Reporter test">
<classes>
<class name="test.sample.SampleTest" />
</classes>
</test>
</suite>
输出:Passed tests for suite 'Simple Reporter Suite' is:1
Failed tests for suite 'Simple Reporter Suite' is:1
Skipped tests for suite 'Simple Reporter Suite' is:1
4 程序中动态编程使用testng
public class SimpleTestngCode {
public void simpleTestNgTest(){
//List of xml suites to be considered for test execution
List<XmlSuite> suites = new ArrayList<XmlSuite>();
//List of classes to be considered for test execution
List<XmlClass> classes = new ArrayList<XmlClass>();
//Defines a simple xml suite with a name
XmlSuite suite = new XmlSuite();
suite.setName("Simple Config suite");
//Defines a xml test for a suite and with a said name
XmlTest test = new XmlTest(suite);
test.setName("Simple config test");
//A single xml class to be considered for execution
XmlClass clz = new XmlClass("test.sample.SampleTest");
classes.add(clz);
//Sets the list of classes to be considered for execution for a test
test.setXmlClasses(classes);
//Adds a single suite to the list suites
suites.add(suite);
//Defining a testng instance
TestNG tng = new TestNG();
//Sets the List of xml suites to be considered for execution
tng.setXmlSuites(suites);
//Runs the configured testng tests.
tng.run();
}
对应的API
XmlSuite Defines a simple XML suite tag of the testng XML
XmlTest Describes a test tag of the testng XML
XmlPackage Describes a package tag in the testng XML
XmlClass Describes a class tag in the testng XML
6 看下如何动态代码中,增加参数
public class ParametrizedTest {
@Parameters({"suite-param-one","test-param-one"})
@Test
public void paramTestOne(String suiteParam,String testParam){
System.out.println("Test One.");
System.out.println("Suite param is: "+suiteParam);
System.out.println("Test param is: "+testParam);
}
@Parameters({"suite-param-two","test-param-two"})
@Test
public void paramTestTwo(String suiteParam,String testParam){
System.out.println("Test Two.");
System.out.println("Suite param is: "+suiteParam);
System.out.println("Test param is: "+testParam);
}
测试类:
public class ParameterizedCode {
public void parameterizedTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
Map<String,String> suiteParams = new HashMap<String,String>();
Map<String,String> testParams = new HashMap<String,String>();
XmlSuite suite = new XmlSuite();
suite.setName("Parameterized suite");
//Defining suite level params and their values
suiteParams.put("suite-param-one", "Suite Param One");
suiteParams.put("suite-param-two", "Suite Param Two");
//Setting the params to the suite
suite.setParameters(suiteParams);
XmlTest test = new XmlTest(suite);
test.setName("Parameterized test");
//Defining test level params and their values
testParams.put("test-param-one", "Test Param One");
testParams.put("test-param-two", "Test Param Two");
//Setting the test level params
test.setParameters(testParams);
XmlClass clz = new XmlClass("test.sample.ParametrizedTest");
classes.add(clz);
test.setXmlClasses(classes);
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
7 include /exclude的API
public void includeExcludeTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Include Exclude Method suite");
XmlTest test = new XmlTest(suite);
test.setName("Include Exclude Method test");
//Test class to be included for test execution
XmlClass clz = new XmlClass("test.sample.IncludeExcludeMethodTest");
//Test methods to be included
XmlInclude methodOne= new XmlInclude("testMethodOne");
XmlInclude methodTwo= new XmlInclude("testMethodTwo");
//Creating a list included methods and adding the methods instances to it
List<XmlInclude> includes = new ArrayList<XmlInclude>();
includes.add(methodOne);
includes.add(methodTwo);
//Setting the included methods for the class
clz.setIncludedMethods(includes);
classes.add(clz);
test.setXmlClasses(classes);
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
8 也可以包含或者排除分组
public void includeExcludeTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Include Exclude Group suite");
XmlTest test = new XmlTest(suite);
test.setName("Include Exclude Group test");
XmlClass clz = new XmlClass("test.sample.IncludeExcludeGroupTest");
classes.add(clz);
test.setXmlClasses(classes);
//Including and excluding groups
test.addIncludedGroup("group-one");
test.addExcludedGroup("group-two");
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
9 依赖测试API
public void dependencyTest(){
List<XmlSuite> suites = new ArrayList<XmlSuite>();
List<XmlClass> classes = new ArrayList<XmlClass>();
XmlSuite suite = new XmlSuite();
suite.setName("Dependency suite");
XmlTest test = new XmlTest(suite);
test.setName("Dependency test");
XmlClass clz = new XmlClass("test.sample.DependencyTest");
classes.add(clz);
test.setXmlClasses(classes);
//Defining an xml dependency where "group-one" depends on "group-two"
test.addXmlDependencyGroup("group-one", "group-two");
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();
}
10 在testng下运行junit
<test junit="true" name="Junit test">
<classes>
<class name="test.sample.junit.JunitSampleTest" />
</classes>
</test>
设置junit="true"就可以了,可以在同一个testsuite中运行junit和testng
<suite name="Junit Testng Suite">
<test junit="true" name="Junit test">
<classes>
<class name="test.sample.junit.JunitSampleTest" />
</classes>
</test>
<test name="Testng test">
<classes>
<class name="test.sample.testng.TestngSampleTest" />
</classes>
</test>
</suite>
11 testng maven的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
其他设置项:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<parallel>tests</parallel>
<threadCount>5</threadCount>
</configuration>
</plugin>
Have a
12 testng结合selenium
public class SampleSeleniumTest {
WebDriver driver;
@BeforeMethod
public void beforeMethod(){
//Initializing the selenium webdriver object
driver = new FirefoxDriver();
}
@Test
public void googleTest(){
//Opening the google page
driver.navigate().to("http://www.google.com");
//Finding the search field and entering text to it.
driver.findElement(By.cssSelector("input[name='q']")).sendKeys("TestNg");
WebDriverWait wait = new WebDriverWait(driver, 30);
//Waiting for the serach list to be populated.
List<WebElement> results=wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("h3.r")));
//Getting the text of the first search result.
String searchResult=results.get(0).getText();
//Verifying the text of first search test result with the expected text
Assert.assertEquals(searchResult,"TestNG - Welcome");
}
@AfterMethod
public void afterMethod(){
//Quitting the browser.
driver.quit();
}
testng.xml:
<suite name="Selenium Suite" parallel="tests" thread-count="2">
<test name="Selenium test - 1">
<classes>
<class name="test.java.org.sample.selenium.SampleSeleniumTest" />
</classes>
</test>
<test name="Selenium test - 2">
<classes>
<class name="test.java.org.sample.selenium.SampleSeleniumTest" />
</classes>
</test>
</suite>
这样的话,同时打开两个firefox去进行测试搜索结果。
发表评论
-
复习:强迫线程顺序执行方式
2019-01-03 23:42 1579方法1: 三个线程,t1,t2,t3,如果一定要按顺序执行, ... -
(转)不错的前后端处理异常的方法
2019-01-02 23:16 2019前言 在 Web 开发中, 我们经常会需要处理各种异常, 这是 ... -
info q的极客时间大咖说等资料下载
2018-08-15 08:40 3470info q的极客时间大咖说等资料下载,还有不少思维导图 链 ... -
CXF 客户端超时时间设置(非Spring配置方式)
2018-07-03 22:38 2236import org.apache.cxf.endpoint. ... -
(转)synchronized关键字画像:正确打开方式
2018-06-14 09:25 490https://mp.weixin.qq.com/s/b3Sx ... -
CountDownLatch的例子
2018-06-13 14:10 691public class StatsDemo { ... -
两道面试题,带你解析Java类加载机制
2018-06-12 16:29 611https://mp.weixin.qq.com/s/YTa0 ... -
Spring中获取request的几种方法,及其线程安全性分析
2018-06-11 09:03 671https://mp.weixin.qq.com/s/KeFJ ... -
内部类小结
2018-06-06 10:25 438https://mp.weixin.qq.com/s/hErv ... -
JVM虚拟机小结1
2018-06-04 20:43 5441 jps -l //列出详细的类名和进程ID 2)jps ... -
windows下自带命令行工具查看CPU资源情况等
2018-06-04 12:53 3101微软提供了不少命令行 ... -
(收藏)深入分析Java的序列化与反序列化
2018-05-30 15:21 617https://mp.weixin.qq.com/s/T2Bn ... -
apache common包中的序列化工具
2018-05-30 09:10 1844什么是序列化 我们的 ... -
JAVA8 JVM的变化: 元空间(Metaspace)
2018-05-24 22:30 967本文将会分享至今为至我收集的关于永久代(Permanent G ... -
(转)服务器性能指标(一)——负载(Load)分析及问题排查
2018-05-21 21:03 1363原创: Hollis Hollis 负载 ... -
(转)对象复用
2018-05-20 15:27 863public class Student { priv ... -
mapreduce中入门中要注意的几点
2018-05-06 08:59 674在 mapreduce中,比如有如下的词: I love b ... -
HDFS的基本操作
2018-05-02 21:47 940-mkdir 在HDFS创建目录 ... -
一个不错的开源工具类,专门用来解析日志头部的,好用
2018-05-02 20:00 772一个不错的开源工具类,专门用来解析日志头部的,好用。 http ... -
介绍个不错的RESTFUL MOCK的工具wiremock
2018-04-27 21:02 1907介绍个不错的RESTFUL MOCK的工具wiremock,地 ...
相关推荐
TestNG需要Java Development Kit (JDK) 5或更高版本才能运行。本教程针对希望学习TestNG的软件专业人士,帮助他们理解TestNG的基础概念,提升测试的专业技能。 在开始学习TestNG之前,你需要具备基本的Java编程知识...
TestNG 是一个强大的自动化测试框架,受到 JUnit 和 NUnit 的启发,但在功能和灵活性上有所增强,特别适合进行单元测试、功能测试、端到端测试和集成测试。它需要 JDK 5 或更高版本来运行。TestNG 的设计目标是为...
### TestNG 学习笔记概览 #### 一、JUnit 的局限性与 TestNG 的优势 ##### JUnit 缺陷概述 - **最初的用途限制**:JUnit 最初被设计为一个仅适用于单元测试的框架,但随着时间的发展,其功能已扩展至支持多种类型...
TestNG自动测试框架是当今流行的自动化测试框架之一 它可以帮助自动化测试工程师把精力集中在编写和实施测试用例和测试脚本上,提升软件测试执行和回归测试效率 分成4大模块 第一模块java 基础知识:JDK安装以及环境...
### Selenium+Eclipse+JUnit+TestNG自动化测试学习笔记 #### 一、环境搭建与配置 **1. 安装 JDK** - **版本**: JDK 1.7 - **下载地址**: ...
5. **MySQL数据库**:项目中可能使用MySQL作为关系型数据库,存储用户笔记、账户信息等数据。了解SQL语句的编写和数据库设计原则至关重要。 6. **RESTful API设计**:为了实现前后端分离,项目可能采用了RESTful ...
测试是任何软件项目的重要组成部分,可能会使用JUnit或TestNG进行单元测试,确保每个独立的代码模块都能正常工作。而Spring Boot自带的MockMVC可以用来进行模拟HTTP请求的集成测试。 在部署方面,项目可能使用...
### Java学习笔记要点 #### 一、了解Java ##### 1.1 Java的起源与发展历程 - **起源**: Java 最初是由 Sun 公司在 Green Project 中为了开发 Star7 应用程序而创建的一种编程语言。 - **命名**: 语言的名字来源于 ...
- **spring-test**:提供了对 JUnit 或 TestNG 进行集成测试的支持。 - **junit**:一个常用的单元测试框架。 ### 二、数据库访问 #### Spring JDBC 模块 - **spring-jdbc**:提供了对 JDBC 的封装,使得数据访问...
5. **自动化测试**:随着敏捷开发的普及,自动化测试工具如Selenium、JUnit、TestNG、Appium等的使用变得尤为重要。笔记会介绍如何创建测试脚本,进行回归测试,以及持续集成。 6. **性能测试**:包括负载测试、...
5. `@AfterMethod`注解的方法会在每个测试方法后执行,通常用于清理工作,如关闭浏览器窗口。 **关于TestNG的注解** TestNG的注解如`@BeforeSuite`, `@BeforeClass`, `@BeforeMethod`, `@AfterMethod`, `@...
- 1995 年 5 月 23 日,Sun Microsystems 正式发布了 Java Development Kit (JDK) 1.0a2 版本。 - 随着互联网的快速发展,Java Applet 成为了网页互动技术的重要组成部分。 - **面向对象:** - Java 是一种面向...
Eclipse、IntelliJ IDEA等IDE为Java开发提供了强大的集成环境,Maven或Gradle用于项目构建和依赖管理,Junit、TestNG等支持单元测试。 本Java体系笔记覆盖了从基础知识到高级特性的全面内容,帮助读者建立扎实的...
5. **Web应用架构**:笔记可能讨论了Web应用的常见架构模式,例如MVC(模型-视图-控制器)、三层架构(表现层、业务逻辑层、数据访问层)等,以及如何利用JavaBean在这些架构中发挥作用。 6. **实例分析**:博主...
### Java+JDK6学习笔记知识点详解 #### 一、Java简介 - **起源与历史:** - 最初由Sun公司的Green Project发起,旨在创建一个名为Star7的应用程序编程语言。 - 名称来源于创始人James Gosling窗外的一棵橡树...
5. **测试框架集成**:Selenium可以与JUnit、TestNG等测试框架结合,构建更复杂的测试套件。这样,你可以编写结构化的测试用例,方便管理和执行。 6. **浏览器模拟**:Selenium支持多种浏览器,如Chrome、Firefox、...
5. 自动化测试套件:组织和管理多个测试用例,便于执行整个测试流程,例如JUnit或TestNG。 6. 报告和日志:提供详尽的测试结果,包括通过、失败、错误等信息,有助于问题定位和持续改进。 7. 集成与协作:与版本...
- **Test**:支持测试Spring应用,包括JUnit和TestNG集成。 2. **Spring框架的搭建** 搭建Spring环境首先需要引入必要的依赖库,例如:aopalliance、commons-logging、spring-aop、spring-beans、spring-context...
同时,IDEA也支持JUnit和TestNG等单元测试框架,方便进行测试编写和运行。 9. **插件安装**: IDEA的扩展性极强,可以在"File" -> "Settings" -> "Plugins"中搜索并安装各种插件,以满足特定需求,如Lombok插件、...
5. **数组和集合框架**:数组是存储同类型数据的基础结构,而集合框架(如List、Set、Map接口及其实现类ArrayList、LinkedList、HashSet、HashMap等)则提供了更灵活的数据组织方式。 6. **字符串处理**:Java.lang...