testng

method dependency in testng.xml

笑着哭i 提交于 2021-02-20 03:36:32
问题 I am trying to add method dependency in testng.xml, but this does not seem to work. could someone suggest, what am i missing here. <suite name="Test Suite for End To End"> <test name="AUT_E2E_01"> <parameter name="browser" value="Chrome" /> <classes> <class name="com.myunit.regressiontests"> <methods> <include name="AutTC03" /> <include name="AutTC11" dependsOnMethods="AutTC03" /> </methods> </class> </classes> </test> </suite> 回答1: Attribute dependsOnMethods is not allowed there (see TestNG

TestNG with Cucumber

那年仲夏 提交于 2021-02-19 08:43:06
问题 I am running cucumber with testNG. CucumberRunner class extends AbstractTestNGCucumberTests and CucumberRunner class is specified in testNG.xml file. If I run a simple TestNG class with testNG.xml then output for testNG results gets displayed in console i.e Total tests run, Failures, Skips as shown below:- Test.java package com.cucumber.test; import org.testng.Assert; public class Test { @org.testng.annotations.Test public void test() { Assert.assertEquals(true, true); } } testNG.xml:- <

ITestResult getTestName() returns null despite of set test name by @Test(testName = “sth”)

纵然是瞬间 提交于 2021-02-19 07:46:26
问题 I set the test name in my test class using annotation: @Test(testName = "sth") and I need to get it from Listener class which implements ITestResult. Method getTestName() returns null but according to http://testng.org/javadocs/org/testng/ITestResult.html#getTestName-- should returns the string. Am I doing sth wrong? Is it possible to get the string set in @Test(testName = "") from Listener class? 回答1: getTestName() may return null in some case. Check no regression test from TestNG if you

Exception while taking screenshot null and FAILED CONFIGURATION: @AfterMethod teardown

拥有回忆 提交于 2021-02-19 05:24:45
问题 I am facing some trouble and got stuck since yesterday; unable to figure out the cause for it. Tried solution of answers here. I created @Test, with sample of code to login and check dashaboard of application. and @AfterMethod, for when Assert is false, should capture a screenshot. If i comment the Aftermethod code it works fine without any issue; It used to run fine w/o any problem earlier. Could you please help me in finding some solution. (it may be very small thing for you.. but pls do

Limiting the number of parallel tests with ThreadCount TestNG

醉酒当歌 提交于 2021-02-19 04:29:08
问题 I have a head scratcher here and I do not know how to handle this. I have several test classes that run via xml. Around 90 test classes, each with about 10+ @Test steps inside them. I have a selenium grid configued, with a maxSession=5 so no more than 5 parallel browser instances can run parallel on a single node. Heres the part I do NOT understand. Lets say I kick off this xml file with all of these test classes, I set my thread-count=10 hoping that 10 tests will kick off at a time. What

Is it possible to pass property file value to testng.xml as parameter value?

我是研究僧i 提交于 2021-02-19 02:03:44
问题 Is it possible to pass property file value to testng.xml as parameter value? Example: test.properties: browser = FIREFOX testng.xml: parameter name = "browser" value = "${test.browser}" 回答1: Yes, this is possible by filtering the testng.xml test resource. Inside your POM, you need to declare a filter poiting to your properties files and override the <testResources> to filter the testng.xml resource. <build> <filters> <filter>path/to/test.properties</filter> <!-- relative to location of POM --

maven surefire: when are we forced to set reuseForks=false?

雨燕双飞 提交于 2021-02-19 01:35:33
问题 In my project when I set reuseForks=true then i have to increase the forkCount to number of test classes. Otherwise, It is throwing illegalargument exception. Also, If I set reuseForks=false then it also work fine. Currently I have following configuration because number of test classes are less than 10. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <reuseForks>true</reuseForks> <forkCount>10<

Starting of the Apache tomcat server before integration test

故事扮演 提交于 2021-02-18 12:38:28
问题 I've been looking for an solution for the last 4 days and raised this question as a bounty but still not getting my answer. Where i've succeeded with the help pf pom.xml file:- a) Starting the tomcat server manually using command i.e mvn tomcat7:run. This command also help me deploying of my war file to tomcat server and starting the server. b) Running my integration tests using testng.xml file configuration on eclipse. Where i'm failed with the help pf pom.xml file:- a) Automatically

Remove tests that were not executed from Allure report

本秂侑毒 提交于 2021-02-17 05:11:40
问题 While running test I use different test-suites (xml files with list of tests to execute). E.g. I need to run smoke-tests so I choose corresponding xml with simplest tests (login/logout; selecting main tabs; check that data is displayed). But in generated allure report there are all test that are in the project (all methods with @Test annotation). And tests that have not been executed have statuses passed , failed ; this information misleading to conclusion that we have tested more than we

记接口测试小里程

為{幸葍}努か 提交于 2021-02-13 18:36:08
  接口测试是测试系统组件间接口的一种测试。接口测试主要用于检测外部系统与系统之间以及内部各个子系统之间的交互点。测试的重点是要检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等。                                                                                           -----------------百度百科   接口测试,属灰盒测试范畴。可能都知道测试类型分黑盒测试,白盒测试,灰盒测试;黑盒测试又名功能测试,功能测试的范围局限于UI层面,主要测试产品的各个功能是否正常,是否如预期的一样。遗憾,通常与预期的需求相差甚远,催生了一系列的测试岗位诞生。   当然,白盒测试则是基于代码进行测试、对一个函数进行测试,颗粒度与黑盒测试形成一个极端对比。那么,对于系统间的子模块与子模块之间的衔接,逻辑依赖、数据交换,接口之间的交互则是灰盒测试,也是接口测试。          类似的图有很多,本图也是在百度进行搜索到的。    “类似的图”说明的有很多,不论是从测试类型、技术角度以及收益角度都是可以说的通的。那么今天的主角便是接口测试(API)测试,可以抛出问题了。。    秉行5w1H原则:      (why)为什么要做接口测试?      (what)接口测试是测什么?