我和maven一起经营着sonarqube.
我用以下方式安装它.使用brew,我安装mysql和sonar.
当我运行时,我得到7个严重的错误,但88个测试的代码覆盖率为零

当我使用IntelliJ的工具运行它时,我得到以下结果.(不是零!)

这是我直接检查Jacoco结果的时候.在$base_direc/target/jacoco/index.html

Edit2:我已编辑~/.m2/settings.xml
添加
<properties>
<sonar.host.url>http://localhost:9000/</sonar.host.url>
</properties>
Run Code Online (Sandbox Code Playgroud)
编辑/usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.properties
补充道sonar.host.url=http://localhost:9000/
编辑/usr/local/etc/sonar-scanner.properties补充说 -sonar.host.url=http://localhost:9000/
以上述所有方式运行应用程序并且结果相同,即,我可以看到Jacoco结果但不在声纳中.
是否有可能如果发现错误声纳拒绝进行代码覆盖?!
请参阅以下链接 - GitHub讨论如何分离集成测试和单元测试
结果,我尝试了这个 -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
<exclude>**/IT*.java</exclude>
<exclude>**/*IT.java</exclude>
<exclude>**/*ITCase.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这在某种程度上有效.意思是,surefire不执行集成测试,而Failsafe不执行单元测试.
但是,当我运行时,mvn verify或者mvn integration-test,也使用了肯定的插件.
必需结果:运行时mvn integration-test,不应运行单元测试.
以下三张图片适用于 mvn verify
整合测试:
单元测试:
下图是我跑的时候 mvn test
我创建了一个abc.scm文件,并尝试在 Ubuntu 的终端中使用“ guild compile ”、“ scm ”和“ guile ”命令将其编译为二进制文件(或任何编译为的 guile 方案)。
对于“ guild compile abc.scm ”,我得到的输出“写为‘/home/tarunmaganti/.cache/guile/ccache/2.0-LE-8-2.0/home/tarunmaganti/abc.scm.go’ ”我找到了文件并像这样运行 - “ ./abc.scm.go ”表示权限被拒绝。
当我使用“ chmod 755 ”或“ chmod 777 ”授予必要的权限时,出现类似 - “ bash: ./abc.scm.go: cannot execute binary file: Exec format error ”的错误。
“ scm what-file-name.scm ”只是打开scm解释器。
" guile 任何文件名.scm什么都不做。
官方 GNU/Guile Scheme 的链接不是很有帮助。
请帮我。我想创建一个 guile 方案脚本文件。编译它并将其作为 C/C++ 程序运行。是否可以?如果无法编译,我想知道,如何至少运行GNU/guile 方案或MIT-Scheme的脚本文件。
{非常感谢逐步介绍,我仍然是使用 Ubuntu 和 Scheme 的初学者。}
提前致谢。
我已经设置ngrok并运行它,将它指向任何东西。但是当我向 提供的链接发出请求时ngrok,我被要求进行身份验证。
我尝试了我的计算机用户名和密码,以及我注册 ngrok 的 ID,但它们都不起作用。
我在他们的官方文档中找不到有关如何处理此问题的任何正确信息。客户端 API Ngrox 身份验证没有帮助。
AssertJ有isEqualToIgnoringGivenFields和isEqualToComparingFieldByFieldRecursively.
但是,我无法通过忽略某些字段来递归地比较两个对象.根据这个讨论,它必须在开发中.
如何仍然让我的断言的返回值以递归方式进行比较,但忽略了一些字段.是否可以在任何其他库中使用或者我可以以某种方式使用它AssertJ?
我了解到,在集成测试中使用实际的数据库会大大降低它们的速度。因此,我必须使用内存数据库,这可能会大大提高集成测试的速度。
我正在使用Springboot进行应用程序开发。如何配置PostgreSQL以进行测试?内存数据库中是否有任何与PostgreSQL语法高度兼容的数据库?
如果没有,我应该如何执行集成测试。
testing postgresql integration-testing in-memory-database spring-boot
考虑以下情况...
public boolean someMethod(List<SomeType> list) {
for(SomeType someObject: list) {
if(aMethod(someObject.getId())) {
return false;
}
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
我想someObject.getId()重复捕捉。如果我使用这样的东西......
...
@Captor
ArgumentCaptor<Long> longArgumentCaptor; //Assuming ID is Long
...
when(aMethod(longArgumentCaptor.capture()).thenReturn(true);
assertThat(x.someMethod(Arrays.asList(new SomeType(65L),new SomeType(734L)))).isTrue();
assertThat(longArgumentCaptor.getValue()).isEqualTo(734L); //<--
...
Run Code Online (Sandbox Code Playgroud)
ArgumentCaptor 仅捕获最后一个值。
但是,我想验证每个值。为此,我需要存储它们。如何捕获每次迭代?
函数如何存储在变量中?
据MDN称
在JavaScript中,函数是第一类对象,因为它们可以像任何其他对象一样具有属性和方法.它们与其他对象的区别在于可以调用函数.简而言之,它们是Function对象.
假设这个场景,
var fn = function () {};
fn.attr = 3;
console.log(fn); //prints function() {}
console.log(Object.keys(fn)); //prints ["attr"]
Run Code Online (Sandbox Code Playgroud)
如果一个函数是一个对象,它不应该具有键和值类型,其中函数存储在属性中并且解释器不显示该属性?类似于C++样式的运算符重载或Javascript本身中的数组/对象表示.我的意思是说函数(或数组)只是以不同方式处理的对象吗?这可能意味着匿名函数存储在具有隐藏属性的对象中.
总之,函数(或数组)的基础工作是什么?他们是专门治疗的吗?或者它们只是一些隐藏属性的语法糖,在()使用时会被调用?
我想解压多个文件,
使用此答案,我找到了以下命令。
find -name '*.zip' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;
如何通过上述命令使用 GNU Parallel 解压缩多个文件?
编辑 1:根据用户Mark Setchell提出的问题
文件在哪里?
所有的 zip 文件通常都在一个目录中。
但是,根据我的假设,该命令会根据 find 命令中给出的深度递归/非递归地查找所有文件。
文件是如何命名的?
abcd_sdfa_fasfasd_dasd14.zip
你通常如何解压缩一个?
unzip abcd_sdfa_fasfasd_dasd14.zip -d abcd_sdfa_fasfasd_dasd14
我理解Streams是懒惰的,直到在流上调用终端方法.我所知道的是,在调用终端方法之后,所有中间方法都按其调用的顺序执行.
但是通过以下程序,我无法理解流是如何工作的.这是代码,我试过了.
import java.util.*;
import java.util.stream.*;
class TestEagerLazy
{
public static void main(String[] args) {
ArrayList<Integer> a = new ArrayList<>();
a.add(4);a.add(5);a.add(8);
a.add(7);a.add(3);a.add(65);
a.add(87);a.add(2);a.add(12);
a.add(58);a.add(42);
Stream<Integer> st = a.stream().filter(b->{System.out.println("Tested: " + b);return (b%2)==0;});
Spliterator<Integer> it = st.spliterator();
System.out.println("\n\nIterator Results:");
while(it.tryAdvance((j)->System.out.println("iter: "+j)));
System.out.println("Last Statement");
}
}
Run Code Online (Sandbox Code Playgroud)
我期望在流的spliterator上假设tryAdvance的输出如下:
Iterator Results:
Tested: 4
Tested: 5
Tested: 8
Tested: 7
Tested: 3
Tested: 65
Tested: 87
Tested: 2
Tested: 12
Tested: 58
Tested: 42
iter: 4
iter: 8
iter: 2
iter: 12
iter: 58
iter: …Run Code Online (Sandbox Code Playgroud) java ×4
unit-testing ×3
interpreter ×2
maven ×2
testing ×2
arguments ×1
assertj ×1
bash ×1
compilation ×1
gnu-parallel ×1
guile ×1
header ×1
jacoco ×1
java-8 ×1
javascript ×1
junit ×1
localhost ×1
mit-scheme ×1
mockito ×1
postgresql ×1
scheme ×1
sonarqube ×1
spring-boot ×1
unzip ×1
webserver ×1