- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个 Maven POM 文件,当我提供并行执行选项时,我没有在日志中看到任何并行执行的迹象。 XML 调试让我抓狂。有什么想法吗?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xxx.xxxx.testing.ranger</groupId>
<artifactId>ranger-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
<version>1.0.0</version>
</parent>
<artifactId>ranger-api-tests</artifactId>
<name>Ranger API Tests</name>
<description>Ranger API integration tests. Depends on the Ranger test framework project.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.groups />
<surefire.and.failsafe.report.dir>C:/Users/xxx/Documents/Projects/LearnCubeAPIIT/tests/target</surefire.and.failsafe.report.dir>
</properties>
<dependencies>
<!-- Granite Testing framework -->
<dependency>
<groupId>com.xxx.xxxx.testing.ranger</groupId>
<artifactId>ranger-api-it-framework</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.16</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<parallel>classes</parallel>
<threadCount>4</threadCount>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<groups>${test.groups}</groups>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
</configuration>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
运行日志 - http://pastebin.com/WkCDwYzJ
问题 - 当并行执行选项传递给故障安全插件时,日志应该如何确认并行执行测试正在发生?
更新
我注意到当我为 maven 设置调试选项以执行时,我注意到 parallelExecution 被设置为 false
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-surefire-plugin:2.12.4--1057774753
[DEBUG] Included: org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4
[DEBUG] Included: org.apache.maven.surefire:surefire-booter:jar:2.12.4
[DEBUG] Included: org.apache.maven.surefire:surefire-api:jar:2.12.4
[DEBUG] Included: org.apache.maven.surefire:maven-surefire-common:jar:2.12.4
[DEBUG] Included: org.apache.commons:commons-lang3:jar:3.1
[DEBUG] Included: org.apache.maven.shared:maven-common-artifact-filters:jar:1.3
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.8
[DEBUG] Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.9
[DEBUG] Included: org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.1
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-project:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-settings:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-profile:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-model:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.9
[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG] Excluded: junit:junit:jar:3.8.1
[DEBUG] Excluded: org.apache.maven:maven-core:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.9
[DEBUG] Excluded: org.apache.maven:maven-monitor:jar:2.0.9
[DEBUG] Excluded: classworlds:classworlds:jar:1.1
[DEBUG] Excluded: org.apache.maven:maven-toolchain:jar:2.0.9
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:2.12.4--1057774753, parent: sun.misc.Launcher$AppClassLoader@7987aeca]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test' with basic configurator -->
[DEBUG] (s) basedir = /Users/nallagun/Git/testing/Ranger/tests
[DEBUG] (s) childDelegation = false
[DEBUG] (s) classesDirectory = /Users/nallagun/Git/testing/Ranger/tests/target/classes
[DEBUG] (s) disableXmlReport = false
[DEBUG] (s) enableAssertions = true
[DEBUG] (s) forkMode = once
[DEBUG] (s) junitArtifactName = junit:junit
[DEBUG] (s) localRepository = id: local
url: file:///Users/nallagun/.m2/repository/
layout: none
[DEBUG] (s) parallel = classes
[DEBUG] (f) parallelMavenExecution = false
[DEBUG] (s) perCoreThreadCount = true
知道为什么会发生这种情况吗?
谢谢
最佳答案
首先,确保您强制使用特定的 jUnit 提供程序,因为已知旧版本 (<4.7) 具有 issues并发执行。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.16</version>
</dependency>
</dependencies>
</plugin>
您可以使用 forkCount
作为并发执行选项,而不是 parallel
。我发现它更灵活,并且由于每个测试都在其自己的 JVM 中运行,因此并发问题会更少,这些问题可能会使您的测试结果不确定。这些配置适用于 maven-surefire-plugin
和 maven-failsafe-plugin
。
<forkCount>8</forkCount>
<reuseForks>true</reuseForks>
您可以组合使用 forkCount
和 parallel
,但是 forkCount
、reuseForks
等的不同可能组合使得事情比较复杂。从 docs 中注意这一点:
When using reuseForks=true and a forkCount value larger than one, test classes are handed over to the forked process one-by-one. Thus, parallel=classes would not change anything. However, you can use parallel=methods: classes are executed in forkCount concurrent processes, each of the processes can then use threadCount threads to execute the methods of one class in parallel.
我不确定报告是否会告诉您测试是否以并发模式运行,但我知道它们正在运行的方式是使用 top
或 htop
(在 Linux 或 OS X 上)。这是我的测试运行的屏幕截图。您可以看到多个 JVM 正在运行测试并消耗 CPU。此外,我的测试以这种方式运行得更快。
关于java - Maven 故障安全插件不运行并行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19716619/
有人可以解释一下为什么这个脚本不起作用吗? function destroy(ID) { if (confirm("Deleting is a very bad thing! Sure?")
我正在尝试使 WCF Silverlight 故障按此方式工作: MSDN aricle 将 SL 故障添加到我的 Web.config 文件后,我收到以下警告: The element 'behav
这是我要删除的 Haskell 函数 2::Int和 5::Int从列表中: remPrimesFactors25 :: [Int] -> [Int] remPrimesFactors25 [] =
当我想用 ffmpeg 连接和录制两个 mp4 视频时,我遇到了这个问题。我得到的输出是: [concat @ 0x2566e80] DTS 4079 #0:0 (h264 (native) ->
我想在delphi中编写一个程序来模拟以特定速度移动的鼠标指针(类似于AutoIT MouseMove函数)。要么是我的代码错误,要么是 SetCursorPos 在被调用太多次后出现故障。这是我的功
我将“wa、or 和 id”(来自这些州的访问者)设置为重定向到 website1.com - 当我访问该网站时,它会将我重定向到 website1.com(因此它知道我在 WA) 。但如果我将 wa
我们目前正在争论通过 WCF channel 抛出错误与传递指示状态或服务响应的消息是否更好。 故障带有 WCF 的内置支持,您可以使用内置的错误处理程序并做出相应的 react 。然而,这会带来开销
不确定我在这里做错了什么,如果有任何帮助,我们将不胜感激。 尝试创建一个名为“control”的新变量,并在行变量等于这些数字时将其编码为 1,否则编码为 0。 data$control= ifels
我想在应用洞察中记录成功调用的百分比。我看到这篇文章https://learn.microsoft.com/en-us/azure/azure-monitor/app/sampling我认为固定速率采
我正在尝试使用 SVD 和特征分解来使用动态模式分解进行一些数据分析。我遇到了一个简单的问题,即从 Matlab 和 Python 获得不同的结果。我很困惑,不知道为什么 Python 给我错误的结果
This question already has an answer here: mysqli_fetch_assoc() expects parameter / Call to a member
我刚刚开始我的一个实验室,在那里我计算类(class)的 GPA,其信息存储在结构的链接列表中。截至目前,我正在尝试打印所有类(class)信息,以确保它们已正确初始化并添加到链接列表中。 我遇到了一
我正在尝试学习如何使用 visual studio 为 C++ 制作 GUI。但是我在使用 GetWindowText() 函数时遇到了一些问题。它不会将 LPTSTR 标题更改为文本框中的文本,并且
我有一个奇怪的问题。它似乎只出现在测试者的 iPhone 5s 上。它可以在运行最新 iOS (8.3) 的 iPhone 5、6 和 6 plus 上正常运行。 这是代码 -(NSString *)
我正在尝试更新 Core Data 中的一些记录。我正在采取以下步骤来完成它 带谓词的获取函数从核心数据中检索记录 将结果集存储在对象数组中 遍历数组并更新每条记录 调用保存上下文 我遇到了两个问题
我通过 Storyboard设计了 tableView,在一个单元格中我有一个按钮和一个标签。按钮在 Storyboard上有标签 1 和标签在 Storyboard上有标签 2。在 cellForR
我实现了这个方法,当在文本字段中输入了未经授权的字符或已使用的用户名时,向用户发送多个警报 View : func textFieldShouldEndEditing(textField: UITex
伙计们,我在运行程序时遇到了这个非常奇怪的错误。这是重要的代码: 变量(编辑): const short int maxX = 100; const short int maxZ = 100; con
我有这个修改过的 Matrix Javascript 代码,我想摆脱第一次运行的所有与自身重叠的字符串。有人知道我该如何管理吗?另外,我想在我的网页上多次使用此代码,我需要声明新变量,不是吗?但是当我
有谁知道是否有网站(甚至非 Microsoft)有关于 COMExceptions/HRESULTS 的详细信息。 当我尝试在使用 Copy() 函数后保存我的 Excel 工作簿时,我收到此错误:
我是一名优秀的程序员,十分优秀!