悬赏求教testNG的测试失败重跑功能讲解

最近一直在研究自动化测试的运行失败重跑技术,在网上看到testNG有支持这个功能,
但是资料普遍都没有很大帮助(也许是本人技术太差看不懂牛人写的东西,呵呵),
求大牛指点,能给出testNG比较详细和有解释的重跑例子能够跑通,十分感谢!

1个回答

我已经找到方法解决了,xml里面的不能放到外面

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Seam testNg测试问题

eclipse(3.4) + JBoss tools 生成的seam(jboss-seam-2.1.0.SP1)项目,对新建的action进行测试,action没有东西,测试内容为: public class WelcomeTest extends SeamTest { @Test public void test_welcome() throws Exception { assert true; } } 我只是想让他运行通过,我用的是jdk1.6,但1.6的问题我觉得应该解决了-Dsun.lang.ClassLoader.allowArraySyntax=true 小弟我在google上找了半天,好像没有人遇到过这样的问题,实在不知道该怎么样解决,小弟在此先谢谢了。 [Parser] Running: D:\workspaces\seam-test\temp-testng-customsuite.xml WARN 23-01 18:05:54,281 (UnifiedLoaderRepository3.java:addClassLoader:713) -Tried to add non-URLClassLoader. Ignored WARN 23-01 18:05:56,562 (TxControl.java::302) -[com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using -3f57fe9c:8b6:49799684:0 WARN 23-01 18:05:58,078 (AspectManagerService.java:baseAop:228) -Could not find base-aspects.xml file in the resources of sun.misc.Launcher$AppClassLoader@19821f ERROR 23-01 18:05:59,218 (AbstractController.java:incrementState:755) -Error installing to Start: name=DsDataSourceTemplateInfo state=Create java.lang.IllegalStateException: Unsupported dsType: org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup at org.jboss.resource.deployers.management.DsDataSourceTemplateInfo.start(DsDataSourceTemplateInfo.java:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214) at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69) at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398) at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:69) at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:42) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:874) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506) at org.jboss.embedded.DeploymentScanner.start(DeploymentScanner.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214) at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69) at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398) at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:309) at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:279) at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130) at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96) at org.jboss.embedded.Bootstrap.deployBaseBootstrapUrl(Bootstrap.java:130) at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:142) at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183) at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195) at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11) at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1025) at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:916) at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:398) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:278) at org.testng.SuiteRunner.run(SuiteRunner.java:198) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823) at org.testng.TestNG.runSuitesLocally(TestNG.java:790) at org.testng.TestNG.run(TestNG.java:708) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124) WARN 23-01 18:06:03,796 (SecurityMetadataStore.java:checkDefaultSuckerPassword:311) -WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this. WARN 23-01 18:06:04,062 (ConnectionFactoryJNDIMapper.java:registerConnectionFactory:155) -supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover WARN 23-01 18:06:04,062 (ConnectionFactoryJNDIMapper.java:registerConnectionFactory:161) -supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing FAILED CONFIGURATION: @BeforeSuite startSeam org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} DsDataSourceTemplate -> DsDataSourceTemplateInfo{Configured:**ERROR**} *** CONTEXTS IN ERROR: Name -> Error DsDataSourceTemplateInfo -> java.lang.IllegalStateException: Unsupported dsType: org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559) at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:149) at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183) at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195) at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11) at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1025) at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:916) at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58) ... Removed 15 stack frames SKIPPED CONFIGURATION: @BeforeClass setupClass SKIPPED CONFIGURATION: @BeforeMethod begin SKIPPED CONFIGURATION: @AfterMethod end SKIPPED CONFIGURATION: @AfterClass cleanupClass SKIPPED: test_welcome =============================================== org.domain.seam.test.WelcomeTest Tests run: 1, Failures: 0, Skips: 1 Configuration Failures: 1, Skips: 4 =============================================== =============================================== seam-test Total tests run: 1, Failures: 0, Skips: 1 Configuration Failures: 1, Skips: 5 =============================================== [b]问题补充:[/b] 我的数据源的设置都是eclipse生成的,而且在action中与数据库连接也没问题 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN" "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd"> <datasources> <local-tx-datasource> <jndi-name>seamDatasource</jndi-name> <connection-url>jdbc:mysql://localhost/test</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password></password> </local-tx-datasource> </datasources> 这是我的seam-test-ds.xml文件 [b]问题补充:[/b] 还有我的test文件结构 [b]问题补充:[/b] 是ds的。JBoss中DS建立成功,但我测试用的都是seam自带的嵌入式微容器,貌似不用启动我的JBoss AS吧 [b]问题补充:[/b] 这是我的 src\META-INF\myseam-test-ds.xml <local-tx-datasource> <jndi-name>myseamDatasource</jndi-name> <connection-url>jdbc:mysql://localhost/test</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password></password> </local-tx-datasource> 这是抛出异常的地方 public void start() { /* // The type of the datasource ManagedObjectImpl mo2 = new ManagedObjectImpl(ManagedConnectionFactoryDeploymentGroup.class.getName()); DefaultFieldsImpl dsTypeField = new DefaultFieldsImpl(); setFieldName("datasource-type", dsTypeField); dsTypeField.setDescription("The type of the DataSource"); dsTypeField.setMandatory(true); dsTypeField.setValue("local-tx-datasource"); HashSet<MetaValue> values = new HashSet<MetaValue>(); values.add(SimpleValueSupport.wrap("local-tx-datasource")); values.add(SimpleValueSupport.wrap("no-tx-datasource")); values.add(SimpleValueSupport.wrap("xa-datasource")); values.add(SimpleValueSupport.wrap("no-tx-connection-factory")); values.add(SimpleValueSupport.wrap("tx-connection-factory")); dsTypeField.setLegalValues(values); dsTypeField.setMetaType(SimpleMetaType.STRING); ManagedPropertyImpl dsTypeProp = new ManagedPropertyImpl(mo2, dsTypeField); super.addProperty(dsTypeProp); if(this.dsType != null) dsTypeField.setValue(this.dsType); else this.dsType = (String)dsTypeField.getValue(); */ // DataSource if("local-tx-datasource".equals(dsType)) createLocalTxDsTemplate(); else if("xa-datasource".equals(dsType)) createXaDsTemplate(); else if("tx-connection-factory".equals(dsType)) createTxCfTemplate(); else if("no-tx-datasource".equals(dsType)) createNoTxDsTemplate(); else if("no-tx-connection-factory".equals(dsType)) createNoTxCfTemplate(); else throw new IllegalStateException("Unsupported dsType: " + dsType); } 它应该执行这个吧 if("local-tx-datasource".equals(dsType)) createLocalTxDsTemplate(); 可却抛出了这个异常~貌似这个ds配置文件没有被应用进来 [b]问题补充:[/b] 我在bootstrap\deployers\jca-deployers-beans.xml中找到的 <!-- The template for creating a datasource --> <bean name="DsDataSourceTemplate" class="org.jboss.resource.deployers.management.DsDataSourceTemplate"> <property name="info"><inject bean="DsDataSourceTemplateInfo"/></property> </bean> <bean name="DsDataSourceTemplateInfo" class="org.jboss.resource.deployers.management.DsDataSourceTemplateInfo"> <constructor> <parameter>DsDataSourceTemplate</parameter> <parameter>A template for *-ds.xml deployments</parameter> <parameter>org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup</parameter> </constructor> </bean> 根据DsDataSourceTemplateInfo类的构造器可以看出,只是简单的把org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup这个当作字符串传递给dsType public DsDataSourceTemplateInfo(String name, String description, String datasourceType) { super(name, description); this.dsType = datasourceType; } 所以我把传进去的参数改成<parameter>local-tx-datasource</parameter> 却出现另一个问题了。。 WARN 24-01 15:51:33,468 (UnifiedLoaderRepository3.java:addClassLoader:713) -Tried to add non-URLClassLoader. Ignored WARN 24-01 15:51:34,687 (TxControl.java:<clinit>:302) -[com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using -3f57fe9c:852:497ac886:0 WARN 24-01 15:51:35,500 (AspectManagerService.java:baseAop:228) -Could not find base-aspects.xml file in the resources of sun.misc.Launcher$AppClassLoader@19821f WARN 24-01 15:51:39,859 (SecurityMetadataStore.java:checkDefaultSuckerPassword:311) -WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this. WARN 24-01 15:51:40,015 (ConnectionFactoryJNDIMapper.java:registerConnectionFactory:155) -supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover WARN 24-01 15:51:40,015 (ConnectionFactoryJNDIMapper.java:registerConnectionFactory:161) -supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing ERROR 24-01 15:51:41,421 (AbstractController.java:incrementState:755) -Error installing to Real: name=vfsfile:/D:/workspaces.bak/myseam-test/bin/ state=PostClassLoader mode=Manual requiredState=Real org.jboss.deployment.DeploymentException: Error during install jboss.jca:service=ManagedConnectionFactory,name=myseamDatasource at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:52) at org.jboss.system.ServiceController.install(ServiceController.java:277) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:98) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:874) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506) at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127) at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289) at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15) at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1025) at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:916) at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:398) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:278) at org.testng.SuiteRunner.run(SuiteRunner.java:198) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823) at org.testng.TestNG.runSuitesLocally(TestNG.java:790) at org.testng.TestNG.run(TestNG.java:708) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124) Caused by: java.lang.IllegalStateException: jboss.jca:name=myseamDatasource,service=ManagedConnectionFactory is already installed. at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:525) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398) at org.jboss.system.ServiceController.doInstall(ServiceController.java:641) at org.jboss.system.ServiceController.install(ServiceController.java:271) ... 38 more WARN 24-01 15:51:42,687 (JBossTimerServiceFactory.java:restoreTimerService:113) -TIMER SERVICE IS NOT INSTALLED FAILED CONFIGURATION: @BeforeSuite startSeam org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** CONTEXTS IN ERROR: Name -> Error vfsfile:/D:/workspaces.bak/myseam-test/bin/ -> java.lang.IllegalStateException: jboss.jca:name=myseamDatasource,service=ManagedConnectionFactory is already installed. at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559) at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128) at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289) at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15) at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1025) at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:916) at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58) ... Removed 15 stack frames SKIPPED CONFIGURATION: @BeforeClass setupClass SKIPPED CONFIGURATION: @BeforeMethod begin SKIPPED CONFIGURATION: @AfterMethod end SKIPPED CONFIGURATION: @AfterClass cleanupClass SKIPPED: test_welcome 可是我不知道这样改对不对?还有这是什么意思jboss.jca:name=myseamDatasource,service=ManagedConnectionFactory is already installed.

TestNG的testcase组织以及测试数据重用问题

我是一个TestNG和Selenium新手,现在准备使用TestNG+Selenium对一个邮件系统做自动化功能测试,有几 个问题想请教大家。 1.邮件系统有这样几个测试用例:1).Login;2)SendMail;其中SendMail需要首先登录才能进行邮件发送。我 使用@dataprovider来提供数据,并将测试数据存放在XML中。我将SendMail和Login独立写的,也就是说 SendMail中不涉及Login处理。测试Login时有三组测试数据,SendMail有4组测试数据(在该测试数据中不 涉及Login相关数据)。 在这个场景下,我希望测试SendMail功能时,首先调用Login登录进去(此处只使用Login三组测试数据中的 正常登录的那一组),然后调用SendMail测试对应的4组数据,我该如何组织测试数据和这两个测试用例。 2.在测试SendMail功能时,只需要测试发送端发送成功还是需要再登录到收件人查看收件人是否正确收到所 发的邮件,这样SendMail才算通过? 谢谢大家!

hibernate+spring+testng测试,事务遇异常不回滚

直接上代码: @Transactional(transactionManager="transactionManager") @Rollback(false) @ContextConfiguration(locations = {"classpath:datasource-hibernate.xml"}) public class TestHibernate extends AbstractTransactionalTestNGSpringContextTests{ 上面类注解 spring事务配置: ``` <tx:annotation-driven transaction-manager="transactionManager"/> <bean id="userHDao" class="com.tx.test.dao.UserHDao"> <property name="sessionFactory" ref="sessionFactory"/> </bean> ``` 现在情况是只有添加@Rollback(false)才不会回滚,否则全部回滚,我想实现的是遇到异常就回滚,否则就不回滚,求指教

maven junit testng 问题

maven构建的环境下,测试使用的是testNG。由于想看测试的覆盖率,于是装了个djunit插件(djunit基于junit)。 现象是:testNG运行ok,但是用junit或者djunit运行报错: junit.framework.AssertionFailedError: No tests found in XXXX(package-name) 我的测试文件是这么写的: import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import XXX.TsTypeMapping; import XXX.common.test.base.AbstractTestBase; public class TestTsTypeMapping extends AbstractTestBase { @BeforeClass public static void beforeClass() throws Exception { ... } @Test public void testTsTypeMapping() { ... } } 其中,class名以TestXXX开始,没问题;测试方法testXXX也没问题; class AbstractTestBase 是extends TestCase的应该也没问题; @Test也标记了 以上4点都满足junit的标准的 ps:我另外一个project里面也是这么测试的,testclass去extends AbstractTestBase,testNg和junit,djunit都可以跑的很流畅。现在的project里的testclass和之前的project的testclass 都是extends同一个AbstractTestBase的 希望指点究竟是哪里出了问题,应该怎么修改才既可以testNg也可以junit测试。 (我怀疑是maven的pom设置,但是不知道怎么设置。)

testng,excel与xml问题,或者怎么把excel转化成testng能识别的xml格式?

testng执行自动化测试,可以用xml,或用excel提供数据,执行testng时,第一步是把数据的格式都转化成xml格式,如:test[TestNG] Running:C:\Users\xu\AppData\Local\Temp\testng-eclipse--979724775\testng-customsuite.xml,请问testng组件具体是怎么将excel转化成xml的? 或者怎么把excel转化成testng能识别的xml格式?

TestNG将data provider定义在其他的class中,最终的执行结果直接Skip了

问题描述:根据TestNG官方文档说明,可以将data Provider 定义在其他的类中,只需要将data provider的方法定义为静态方法,同时在引用data provider的时候指定dataProviderClass属性值即可,我按照这个流程进行操作,最后的运行结果却不是pass,而是skip,希望各位友人帮忙解答一下。 TestForDataProvider.java代码如下 ``` package com.testngdemo; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; class StaticProvider{ @DataProvider(name = "data1") public static Object[][] createData1(){ return new Object[][]{ {"heting", new Integer(23)}, {"zhougang", new Integer(31)} }; } } public class TestForDataProvider { @Test(dataProvider = "data1", dataProviderClass = StaticProvider.class) public void test1(String name, Integer age) { System.out.println(name + "的年纪:" + age + "岁"); } } ``` testng.xml文件内容如下 ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="suite1"> <test name="test1"> <classes> <class name="com.testngdemo.TestForDataProvider"></class> </classes> </test> </suite> ``` 执行结果如下 ![图片说明](https://img-ask.csdn.net/upload/201610/09/1476004202_657905.png) 官方文档如下: ![图片说明](https://img-ask.csdn.net/upload/201610/09/1476004268_164299.jpg)

错误: 找不到或无法加载主类 org.testng.TestNG

问题:在命令行运行“java org.testng.TestNG testng.xml”总是报错“错误: 找不到或无法加载主类 org.testng.TestNG”,网上帖子翻了好多但是都不能解决问题 配置了classpath之后“java -classpath "%classpath%:C:\Users\morris\.m2\repository\org\testng\testng\6.10\testng-6.10.jar" org.testng. TestNG testng.xml”还是同样的报错

java+selenium+testng脚本调试

driver.dropListSelectByxpath(xpath, text)这是什么意思知道的大神们请告知下 抱拳了 大牛们!

在eclipse中在线安装TestNG插件后,没有testng选项,很多方法都试过了

在eclipse中在线安装TestNG插件后,没有testng选项,很多方法都试过了,求大神给解决啊方法,最好有详细过程,或者是安装过程中要注意什么,在线等,谢啦 ![view界面](https://img-ask.csdn.net/upload/201509/01/1441078632_788117.png) ![new界面](https://img-ask.csdn.net/upload/201509/01/1441078674_872414.png)

Jenkins + TestNg 的一些疑问

如题 我要实现 本地提交代码到git后 使用Jenkins 构建发布 生成测试报告, 其中一些测试套件 是需要用到此项目启动之后的服务,现在我pom中用的maven-surefire-plugin 这个插件 启动就会测试 我跳过测试之后 包可以发布到tomcat上去但是 测试报告没有了就 我在windows系统下安装了Jenkins 并 启动了虚拟机装了tomcat jdk8的环境 问题是 1 现在这个流程有没有问题 2 这个测试报告怎么样才可以生成 3 如何检测是否tomcat已经部署完成了 希望有经验的指导下。

jenkins生成测试报告失败

今天第一次使用jenkins,搞了个Java代码测试,在jenkins用junit测试,成功生成了xml测试报告文件,但是却 报了这样一个错误,请问这是什么原因导致的?该怎么解决,求大神赐教,感激不尽 第一次执行时报的错误信息:Step ‘Publish JUnit test result report’ failed: None of the test reports contained any result 后来每次执行都报这个:ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did tests run? 但是每次都有生成一个XML文件

testng 套件取值为空,apikey 和tellphone都为null

/** * Created by duanchangliang on 16/6/27. */ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TestGenerator; import com.yunpian.sdk.common.Config; import com.yunpian.sdk.model.*; import com.yunpian.sdk.service.*; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.*; import java.util.*; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import static org.testng.Assert.assertEquals; @RunWith(Parameterized.class) public class SmsTest { //private String getTellphone; public static YunpianRestClient client; // YunpianRestClient client = new YunpianRestClient(); @BeforeClass public void init() { client = new YunpianRestClient("your apikey"); } @Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"单条发送短信","18868212479","【测试内容】请提供",0,"发送成功","aa1c3eec10d5d52d560028833eee41b4" } }); } /*** * 第一个测试用例名称 * 第二、三个是为传参 * 第四、五个是为预期结果 * 第六个为apikey * */ @Parameter(value = 0) public String testcase; @Parameter(value = 1) public String tellphone; @Parameter(value = 2) public String smsmsg; @Parameter(value = 3) public int smscode; @Parameter(value = 4) public String backmsg; @Parameter(value = 5) public String apikey; @Test public void testSendSms() throws UnsupportedEncodingException{ YunpianRestClient client = new YunpianRestClient(apikey); SmsOperator smsOperator = client.getSmsOperator(); System.out.println("apikey值为:" + apikey); System.out.println("用户手机号为:" + tellphone); // 单条发送 ResultDO<SendSingleSmsInfo> r1 = smsOperator.singleSend(tellphone, smsmsg); System.out.println(r1); int code = r1.getData().getCode(); String msg = r1.getData().getMsg(); assertEquals(code, smscode); assertEquals(msg,backmsg); System.out.print(code); } }

testng-xslt-1.1.2美化报告中,ant build.xml时报错

transform: [xslt] Processing G:\workspace\irobot\irobot\test-output\auto\testng-results.xml to G:\workspace\irobot\irobot\test-output\auto\xsltresult.html [xslt] Loading stylesheet G:\workspace\irobot\irobot\test-output\testng-results.xsl [xslt] G:\workspace\irobot\irobot\test-output\testng-results.xsl:411: Fatal Error! Failed to create output file file:////./test-output/auto//style.css Cause: java.io.IOException: 系统找不到指定的路径。 [xslt] Failed to process G:\workspace\irobot\irobot\test-output\auto\testng-results.xml BUILD FAILED G:\workspace\irobot\irobot\build.xml:49: Fatal error during transformation using G:\workspace\irobot\irobot\test-output\testng-results.xsl: Failed to create output file file:////./test-output/auto//style.css; SystemID: file:/G:/workspace/irobot/irobot/test-output/testng-results.xsl; Line#: 411; Column#: -1 望大神们帮忙看看,谢谢!

selenium 脚本在windows下正常运行,但是在linux下的jenkins运行报错。

[2017-03-06 18:19:04] [INFO] RetryCount=0 [2017-03-06 18:19:04] [INFO] SourceDir=src/main/java/com/test/testcases [2017-03-06 18:19:04] [INFO] SourceEncoding=UTF-8 [2017-03-06 18:19:04] [INFO] 当前操作系统是:[Linux] [2017-03-06 18:19:04] [INFO] 启动测试浏览器:[chrome] [2017-03-06 18:19:04] [ERROR] 浏览器不能正常工作,请检查是不是被手动关闭或者其他原因 java.lang.IllegalStateException: The driver is not executable: /var/lib/jenkins/workspace/seltest/res/driver/chrome/linux/chromedriver at com.google.common.base.Preconditions.checkState(Preconditions.java:518) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:127) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:118) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:302) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124) at main.java.com.test.utils.SelectBrowser.selectExplorerByName(SelectBrowser.java:60) at main.java.com.test.utils.SeleniumUtil.launchBrowser(SeleniumUtil.java:54) at main.java.com.test.base.BaseParpare.startTest(BaseParpare.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105) at org.testng.TestRunner.privateRun(TestRunner.java:744) at org.testng.TestRunner.run(TestRunner.java:602) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144)

DateSource无法注入的问题,求教

数据源配置如下: <!-- 配置数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/sampledb" p:username="root" p:password="123" /> <!-- 配置Jdbc模板 --> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" p:dataSource-ref="dataSource" /> 报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.smart.service.UserServiceTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

testngpp单元测试使用mock打桩函数导致用例crash

测试用例的实现: TEST(test mocker) { int ret; MOCKER(notexist1).expects(once()).with(spy(ret)); plat_test1(2,4); ASSERT_EQ(4,ret); } 被调用函数实现: int notexist1(int num){ } int plat_test1(int num1, int num2){ int ret2; ret2 = notexist1(num2); if ( ret2 == num2 ){ return 0; }else{ return 1; } } 运行测试用例就提示: [ CRASHED ] TestU.h:96: test crashed unexpectedly. 搞了很多次都这样,实在不知道要怎么办了,求大神指点

JAVA,Mybatis插入报断言错误

FAILED: insertCoinPresentRecord java.lang.AssertionError at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:981) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObjectNoType(SQLServerPreparedStatement.java:926) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:935) at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:169) at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:70) at com.sun.proxy.$Proxy100.setObject(Unknown Source) at org.apache.ibatis.type.ObjectTypeHandler.setNonNullParameter(ObjectTypeHandler.java:31) at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:50) at org.apache.ibatis.type.UnknownTypeHandler.setNonNullParameter(UnknownTypeHandler.java:45) at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:50) at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:81) at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80) at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62) at com.sun.proxy.$Proxy98.parameterize(Unknown Source) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) at com.sun.proxy.$Proxy22.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) at com.sun.proxy.$Proxy97.insertCoinPresentRecord(Unknown Source) at com.seasaw.member.dao.CoinPresentRecordDaoTest.insertCoinPresentRecord(CoinPresentRecordDaoTest.java:52) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:170) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212) at org.testng.internal.Invoker.invokeMethod(Invoker.java:707) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) 插入语句单元测试的时候报了个这个错误出来,新手不是很理解啊,求助各位大神

Maven中的test测试类ClassNotFoundException

在IDEA上使用quickstart新建一个maven工程,在test中的AppTest中写测试代码执行正常,但是自己新建的test测试类提示”找不到或无法加载主类“。 在不使用quickstart新建一个空白maven工程的时候,出现如上同样的报错。搜索了很久,没找到解决办法, 求指点![图片说明](https://img-ask.csdn.net/upload/201912/17/1576573034_506536.png) ![图片说明](https://img-ask.csdn.net/upload/201912/17/1576573045_752218.png) 执行main方法报错如下 ![图片说明](https://img-ask.csdn.net/upload/201912/18/1576632511_606706.jpg) 感谢@毕小宝 提供的解决思路 另外附上解决方案:[https://blog.csdn.net/Dawn510/article/details/103598714](https://blog.csdn.net/Dawn510/article/details/103598714 "")

appium测试微信公众号出现Could not find package com.android.chrome on the device的问题

1.新手,想在微信上面测试公众号,用的是appium+java,写了测试用例然后run的时候一直报错,没有找到解决方案,求大神指点,在线等!! 2.以下是我的代码: 初始化init类: ``` package appiumDemo; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.android.AndroidDriver; public class InitAppium { public static AndroidDriver launchApp(String deviceName) throws MalformedURLException { // 设置自动化相关参数 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); // 使用哪种移动平台 capabilities.setCapability("platformName", "Android"); // 启动哪种设备,是真机还是模拟器 capabilities.setCapability("deviceName", deviceName); // 如果是模拟器输入Android Emulator 红米note3 db3489d // 不要再次安装apk capabilities.setCapability("noReset", true); // 不用重新签名 capabilities.setCapability("noSign", true); // 设置安卓系统版本 capabilities.setCapability("platformVersion", "7.1"); // 支持unicode键盘,输入中文设置 capabilities.setCapability("unicodeKeyboard", "True"); capabilities.setCapability("resetKeyboard", "True"); // 设置app的主包名和主类名 capabilities.setCapability("appPackage","com.tencent.mm"); capabilities.setCapability("appActivity", "com.tencent.mm.ui.LauncherUI"); ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("androidProcess", "com.tencent.mm:tools"); capabilities.setCapability(ChromeOptions.CAPABILITY, options); AndroidDriver driver = new AndroidDriver(new URL("http://169.254.82.105:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); return driver; } } ``` 测试类代码如下: ``` package appiumDemo; import java.net.MalformedURLException; import org.testng.annotations.Test; import io.appium.java_client.android.AndroidDriver; public class NewTest { private AndroidDriver driver; @SuppressWarnings("static-access") @Test public void f() { InitAppium init=new InitAppium(); try { init.launchApp("c353ce90"); } catch (MalformedURLException e) { e.printStackTrace(); } driver.findElementById("com.tencent.mm:id/azj").click(); } } ``` 3.报错信息 ``` [RemoteTestNG] failed to get TestNG version from class: java.lang.ClassNotFoundException: org.testng.internal.Version [RemoteTestNG] now trying to parse the version from pom.properties [RemoteTestNG] parsing TestNG version at jar:file:/E:/test/Tools/maven/maven-repository/org/testng/testng/6.1.1/testng-6.1.1.jar!/META-INF/maven/org.testng/testng/pom.properties [RemoteTestNG] detected TestNG version 6.1.1 [TestNG] Running: C:\Users\vanchu\AppData\Local\Temp\testng-eclipse-1879104749\testng-customsuite.xml FAILED: f org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find package com.android.chrome on the device (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 9.90 seconds Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z' System info: host: 'DESKTOP-GBO4D78', ip: '169.254.151.82', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_91' Driver info: driver.version: AndroidDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53) at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123) at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source) at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.findFirst(Unknown Source) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:87) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:111) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72) at appiumDemo.InitAppium.launchApp(InitAppium.java:54) at appiumDemo.NewTest.f(NewTest.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.Invoker.invokeMethod(Invoker.java:673) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.runWorkers(TestRunner.java:1178) at org.testng.TestRunner.privateRun(TestRunner.java:757) at org.testng.TestRunner.run(TestRunner.java:608) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158) at org.testng.TestNG.runSuitesLocally(TestNG.java:1083) at org.testng.TestNG.run(TestNG.java:999) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) =============================================== Default test Tests run: 1, Failures: 1, Skips: 0 =============================================== =============================================== Default suite Total tests run: 1, Failures: 1, Skips: 0 =============================================== [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@6e6d5e: 1485 ms [TestNG] Time taken by [TestListenerAdapter] Passed:0 Failed:0 Skipped:0]: 296 ms [TestNG] Time taken by org.testng.reporters.XMLReporter@1f256fa: 109 ms [TestNG] Time taken by org.testng.reporters.EmailableReporter@aa5eb0: 62 ms [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@1ebec15: 8 ms ```

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Intellij IDEA 实用插件安利

1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成(国外统计)。IDEA 的...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

魂迁光刻,梦绕芯片,中芯国际终获ASML大型光刻机

据羊城晚报报道,近日中芯国际从荷兰进口的一台大型光刻机,顺利通过深圳出口加工区场站两道闸口进入厂区,中芯国际发表公告称该光刻机并非此前盛传的EUV光刻机,主要用于企业复工复产后的生产线扩容。 我们知道EUV主要用于7nm及以下制程的芯片制造,光刻机作为集成电路制造中最关键的设备,对芯片制作工艺有着决定性的影响,被誉为“超精密制造技术皇冠上的明珠”,根据之前中芯国际的公报,目...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

百度工程师,获利10万,判刑3年!

所有一夜暴富的方法都写在刑法中,但总有人心存侥幸。这些年互联网犯罪高发,一些工程师高技术犯罪更是引发关注。这两天,一个百度运维工程师的案例传遍朋友圈。1...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

实时更新:计算机编程语言排行榜—TIOBE世界编程语言排行榜(2020年6月份最新版)

内容导航: 1、TIOBE排行榜 2、总榜(2020年6月份) 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。

立即提问
相关内容推荐