标签: suite

在套件级别上并行运行JUnit测试?

我有一堆在JUnit测试套件中组织的测试.这些测试大大利用硒来测试Web应用程序.因此,对于硒来说,这些测试的运行时间很长.由于套件中的测试类由于测试数据库中的某些重叠而无法并行运行,因此我希望并行运行套件.

JUnit ParallelComputer只能并行执行类或方法级别的测试,JUnit是否有任何标准方法可以使用套件?

如果我只是将套件类传递给junit runner并将计算机配置为在类级别进行并行化,那么它会选择测试类本身,而不是套件.

弗兰克

java parallel-processing junit automated-tests suite

11
推荐指数
2
解决办法
1万
查看次数

android - 访问测试应用程序资产

我在测试应用程序的assets目录中有一个XML文件.我想从我的测试类的套件方法访问此文件.

即,

public static TestSuite suite(){InputStream stream = //返回资产的一些代码}

知道我怎么能这样做吗?我尝试使用Resources.Resources.getSystem().getAssets()但没有运气:-(请帮忙.

约瑟夫,副总统,约瑟夫

xml android unit-testing assets suite

8
推荐指数
2
解决办法
5696
查看次数

junit实现多个跑步者

我一直试图通过创建一个扩展跑步者的suiterunner来创建一个个性化的测试套件.在带有注释的测试套件中,@RunWith(suiterunner.class)我指的是需要执行的测试类.

在测试类中,我需要重复一个特定的测试,为此我正在使用这里提到的解决方案:http://codehowtos.blogspot.com/2011/04/run-junit-test-repeatedly.html.但是因为我创建了一个触发测试类的suiterunner并且在我正在实现的测试类中@RunWith(ExtendedRunner.class),所以抛出了初始化错误.

我需要帮助来管理这两个跑步者,还有什么方法可以将两个跑步者组合起来进行特定测试吗?有没有其他方法可以解决这个问题或任何更简单的方法来继续?

java junit annotations suite junit-runner

7
推荐指数
1
解决办法
2425
查看次数

Junit 4中的参数化套件?

随着@RunWith( Suite.class )我可以组测试类到测试套件和运行它们放在一起.随着@RunWith( Parameterized.class )我可以运行不同的参数相同的测试.我想要的是为不同的参数运行测试套件.有没有办法做到这一点?

java junit suite parameterized

7
推荐指数
1
解决办法
1218
查看次数

Spring 3+当JUnit无法识别时,如何创建TestSuite

我正在使用Spring 3.0.4和JUnit 4.5.我的测试类目前使用Spring的注释测试支持,语法如下:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration (locations = { "classpath:configTest.xml" })
@TransactionConfiguration (transactionManager = "txManager", defaultRollback = true)
@Transactional
public class MyAppTest extends TestCase 

{
 @Autowired
 @Qualifier("myAppDAO")
 private IAppDao appDAO;
    ...
}
Run Code Online (Sandbox Code Playgroud)

我真的不需要行扩展TestCase来运行这个测试.单独运行此测试类时不需要它.我必须添加扩展TestCase,以便我可以在TestSuite类中添加它:

public static Test suite() {
        TestSuite suite = new TestSuite("Test for app.dao");
  //$JUnit-BEGIN$
  suite.addTestSuite(MyAppTest.class);
        ...
Run Code Online (Sandbox Code Playgroud)

如果我省略扩展TestCase,我的测试套件将无法运行.Eclipse会将suite.addTestSuite(MyAppTest.class)标记为错误.

如何将Spring 3+测试类添加到测试套件中?我相信有更好的方法.我是GOOGLED并阅读文档.如果你不相信我,我愿意把你所有的书签作为证据发给你.但无论如何,我更愿意提出建设性的答案.非常感谢.

testing junit spring suite

6
推荐指数
1
解决办法
5054
查看次数

Junit4:运行一套特定的测试方法

有没有办法创建一套测试方法,而不仅仅是测试类?

我想组建一个测试套件,它只运行测试类中的特定测试方法.我没有从我有限的junit知识和搜索网络中看到这样做的方法.

testing junit suite

5
推荐指数
1
解决办法
2770
查看次数

JUnit 4:如何创建套件套件?

在下面运行junit会引发异常.

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import com.prosveta.backend.daoimpl.AllDaoImplTests;

/**
 * Short desc.
 *
 * Longer desc.
 *
 * @author Jean-Pierre Schnyder
 *
 */
@RunWith(Suite.class)
@SuiteClasses({AllDaoImplTests.class,AllServiceImplTests.class})
public class AllBackendTests {
}
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
    at java.lang.Class.getAnnotations(Class.java:3050)
    at org.junit.runner.Description.createSuiteDescription(Description.java:72)
    at org.junit.internal.runners.ErrorReportingRunner.getDescription(ErrorReportingRunner.java:25)
    at org.junit.runner.Runner.testCount(Runner.java:38)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.countTestCases(JUnit4TestClassReference.java:30)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.countTests(RemoteTestRunner.java:487)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:455)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Run Code Online (Sandbox Code Playgroud)

感谢您的回答 !

suite junit4 test-suite

5
推荐指数
2
解决办法
8371
查看次数

每个套件的 boost-test 初始化(非大小写)

我需要初始化一些变量,它们在 BOOST_AUTO_TEST_SUITE 中是“全局的”,因此它们的构造函数将在套件启动时被调用,并且它们的析构函数将在最后一个相应的 BOOST_AUTO_TEST_CASE 完成后被调用

有人知道我该怎么做吗?看起来全局装置不是解决方案......

c++ fixture suite boost-test

5
推荐指数
2
解决办法
3487
查看次数

如何在 NUnit 和 C# 中共享一个 Selenium webdriver 实例?

我想要简单的方法来启动 Selenium webdriver 实例并对其运行各种测试。我正在尝试在 Suite 文件中执行此操作,但它不起作用。实例立即被杀死。有没有其他方法可以做到这一点?

可能我想在此套件中添加更多驱动程序(IE、Chrome),并在可能的情况下单独启动。欢迎任何建议。

namespace NUnit.Tests
{
   public class AllTests
   {
        private static IWebDriver _Driver;

        [TestFixtureSetUp]
        public void SuiteSetUp() 
        {
           _Driver = new FirefoxDriver();
         }

        [TestFixtureTearDown]
        public void SuiteTearDown()
        {
           try
           {
              _Driver.Quit();
           }
              catch (Exception)
           {
                    // Ignore errors if unable to close the browser
            }
         }

         [Suite]
         public static TestSuite Suite
         {
            get
            {
               LoginTest lt = new LoginTest { Driver=_Driver };
               suite.Add(lt);
               AnotherTest at = new AnotherTest { Driver=_Driver };
               suite.Add(at);
               return suite;
             } …
Run Code Online (Sandbox Code Playgroud)

testing selenium nunit webdriver suite

5
推荐指数
1
解决办法
6888
查看次数

TestNG:使用<suite-files>标记运行具有保留顺序的多个套件

我试图从一个整体套件文件运行多个套件.我定义了运行所需的套件并运行"主"套件文件.我已经使用preserve-order按顺序运行每个套件,但行为并不像我期望的那样.似乎它一个接一个地直接运行它们,几乎是平行的.

有没有人知道我可以执行套件的方式,保留订单,理想情况下等待第一套房在第二套房运行之前完成?

我的套件设置如下:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="My test suite" preserver-order=true>
    <suite-files>
        <suite-file path="Test1.xml"></suite-file>
        <suite-file path="Test2.xml"></suite-file>
        <suite-file path="Test3.xml"></suite-file>
    </suite-files>
</suite>
Run Code Online (Sandbox Code Playgroud)

问候,杰克

testng suite

5
推荐指数
1
解决办法
6782
查看次数

在创建套件时如何让Eclipse识别JUnit测试?

当我使用Eclipse创建JUnit测试套件时,它不会检测任何现有测试,并警告"未选择任何测试类".

我从测试类包(test/com /.../ package)开始,选择了包.那里有几个JUnit测试,也是通过相同版本的Eclipse创建的,但没有办法选择它们.

我正在使用JUnit 4.

谢谢!

java eclipse junit suite

4
推荐指数
1
解决办法
3058
查看次数

量角器套件中的每次测试后如何关闭我的浏览器?

我试图将我的测试作为一个套件运行。套件中有三个测试,如何在每次测试后关闭浏览器?

suites:
        {
          one: 'one.js',
          two: 'two.js',
          three: 'three.js'
        };
Run Code Online (Sandbox Code Playgroud)

问题是这个测试中的每一个都是用来加载一个单独的url,每个测试都检查是否加载了正确的url。但是我的测试每次都失败,因为所有的 url 都不一样。

suite protractor

2
推荐指数
1
解决办法
1万
查看次数