小编use*_*793的帖子

maven单元测试代码覆盖率

在eclipse中我使用EcLEmma来查看单元测试代码的覆盖范围.工作得很好.因此,我尝试使用maven的jacoco插件从maven构建中看到相同的报告,甚至更好地使用特定的配置文件或站点周期.一切都失败了

所有建议的解决方案对我来说都不起作用

获得unist测试代码覆盖率报告(使用surefire)的最佳方法是什么?[编辑]为了更加灵活,为什么jacoco为我失败了....因为我得到了由于缺少执行数据而跳过JaCoCo执行

来自物业中的pom

    <jacoco.it.execution.data.file>${project.build.directory}/coverage-reports/jacoco-it.exec</jacoco.it.execution.data.file>
    <jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.ut.execution.data.file>
Run Code Online (Sandbox Code Playgroud)

在Build部分

        <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.jacoco</groupId>
                                    <artifactId>jacoco-maven-plugin</artifactId>
                                    <versionRange>${jacoco.version}</versionRange>
                                    <executions>
                                        <!-- Prepares the property pointing to the JaCoCo runtime agent 
                                            which is passed as VM argument when Maven the Surefire plugin is executed. -->
                                        <execution>
                                            <id>pre-unit-test</id>
                                            <goals>
                                                <goal>prepare-agent</goal>
                                            </goals>
                                            <configuration>
                                                <!-- Sets the path to the file which contains the execution 
                                                    data. -->
                                                <destFile>${jacoco.ut.execution.data.file}</destFile>
                                                <!-- Sets the name of the property containing the settings for 
                                                    JaCoCo runtime agent. …
Run Code Online (Sandbox Code Playgroud)

java unit-testing maven jacoco

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

如何在KQL中正确使用in for字符串列表

以下代码有效

let names = dynamic(['Windows Installer', 'Software Protection']);

ConfigurationChange
| where Computer like "SRV"
| where SvcPreviousState  == "Running"
| where SvcState == "Stopped"
// | where SvcDisplayName in (names)
| order by TimeGenerated
Run Code Online (Sandbox Code Playgroud)

正如注释掉的那样,我只想检查 SvcDisplayName 的列表。

根据文档,这应该有效,但确实会抱怨

: Failed to resolve table or column or scalar expression named 'names'
Run Code Online (Sandbox Code Playgroud)

我如何正确使用 SvcDisplayName 列表?

kql

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

Node JS从文件加载JSON数组

一个json文件已经创建了漂亮的打印

[
  {
    "name": "c",
    "content": 3,
    "_prototype": "item"
  },
  {
    "name": "d",
    "content": 4,
    "_prototype": "item"
  }
]
Run Code Online (Sandbox Code Playgroud)

我可以用那个读取文件

var fs = require('fs');
var arrayPath = './array.json';

function fsReadFileSynchToArray (filePath) {
    var data = JSON.parse(fs.readFileSync(filePath));
    console.log(data);
    return data;
}

var test  = arr.loadFile(arrayPath);
console.log(test);
Run Code Online (Sandbox Code Playgroud)

但输出顺序相反

[]
[ { name: 'c', content: 3, _prototype: 'item' },
  { name: 'd', content: 4, _prototype: 'item' },]
Run Code Online (Sandbox Code Playgroud)

显然第二个输出显示为第一个.我实际上使用了同步文件读取来避免这种空数据.有没有办法真正确保JSON文件在继续之前完全读入数组?

[update] arr是一个使用的模块

function loadFile(filePath){
    var arrLines = [];
    fs.stat(filePath, function(err, stat) {
        if(err == null) …
Run Code Online (Sandbox Code Playgroud)

javascript json node.js

4
推荐指数
3
解决办法
9240
查看次数

Kibana 致命错误:[elasticsearch.url]:缺少此键的定义

在 ubuntu 18.04 for kibana 上安装和启动没问题,但我发现这个

FATAL  Error: [elasticsearch.url]: definition for this key is missing
Run Code Online (Sandbox Code Playgroud)

在 /var/log/kibana/kibana.stderr

我有这个

server.port: 5601
server.host: "192.168.56.51"
elasticsearch.url: http://localhost:9201
Run Code Online (Sandbox Code Playgroud)

在 /etc/kibana/kibana.yml 中,当我在机器上执行 wget http://localhost:9201时,我得到了预期的 index.html

kibana 会抱怨的任何明显原因?

[更新] 同时,我重新安装了整个安装,并且由于某种原因它可以工作。然而在许多论坛中,peaple 有同样的问题,所以在安装过程中可能会有一个陷阱。

elasticsearch kibana

4
推荐指数
2
解决办法
4344
查看次数

方括号内的bash grep文本

我尝试从 linux bash 上的日志文件中 grep 文本。文本在两个方括号内。

例如在:

32432423 jkhkjh [234] hkjh32 2342342
Run Code Online (Sandbox Code Playgroud)

我正在寻找234

通常应该找到它

 \[(.*?)\]
Run Code Online (Sandbox Code Playgroud)

但不是与

|grep \[(.*?)\]
Run Code Online (Sandbox Code Playgroud)

使用 grep 进行正则表达式搜索的正确方法是什么

regex bash grep

3
推荐指数
2
解决办法
6065
查看次数

用于 Dotnetcore 函数的 Visual Studio 2019 应用程序参数

我在 VS 2019 中构建了一个 donetcore 函数,它在没有任何提示的情况下失败了

它在启动期间提到 有关详细输出,请使用 --verbose 标志运行 func。

但是每个应用程序参数都会导致错误:未知参数 --verbose

我如何使用参数进行更好的调试?

参数

visual-studio

3
推荐指数
1
解决办法
1123
查看次数

对于字符串isin list的Pandas否定选择给出了错误的结果

根据这里的其他帖子,这应该只带回四个域中的两个

import pandas as pd
df = pd.DataFrame({'Domain':['info.de','onfi.ru','kcast.fr','stack.cn']})

tld_1 =['.de', '.cn']
tld_2 =['info', 'stack']

df[~df['Domain'].isin(tld_1)]
df[~df['Domain'].isin(tld_2)]
Run Code Online (Sandbox Code Playgroud)

但它带回来了

 Domain
0   info.de
1   onfi.ru
2  kcast.fr
3  stack.cn
Run Code Online (Sandbox Code Playgroud)

知道为什么以及如何正确选择包含列表中条目的域名?

提前感谢任何提示.

python string substring series pandas

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

Azure B2C 用户流不显示任何应用程序

刚刚在 Azure B2C 中注册了第一个应用程序和第一个用户流。

为了检查流程,我单击“运行用户流程”,但弹出窗口中的所有字段和下拉菜单都是空的。

下拉列表中是否至少应该注册一个应用程序?

azure-ad-b2c

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

Python模块'对象不可调用

这是一个python的新问题......文件结构就是这样

./part/__init__.py
./part/Part.py
./__init__.py
./testCreation.py
Run Code Online (Sandbox Code Playgroud)

当运行python3 testCreation.py我得到一个

part = Part() TypeError: 'module' object is not callable
Run Code Online (Sandbox Code Playgroud)

没有抱怨进口.所以我想知道问题是什么!

也来自Java,如果组织python的类在包含子路径或模块的程序包中更好(可省略init .py文件),可以发表一些评论吗?

python

0
推荐指数
1
解决办法
9331
查看次数

枚举 GetCustomAttributes 不显示任何内容

在这个简单的类中,我尝试覆盖 ToString() 以显示所有自定义属性。

public class TryMe
{
    public TryMe(int id, List<String> tests)
    {
        ID = id;
        Tests = tests;
    }
    public int ID { get; set; }
    public List<String> Tests { get; set; }

    public override string ToString()
    {
        string me = "";
        var attributes = this.GetType().GetCustomAttributes();

        foreach (var attribute in attributes)
        {
            me = me + attribute.ToString() + ",";
        }
        return me;
    }
}
Run Code Online (Sandbox Code Playgroud)

它不显示任何值或错误。

不是IDTests自定义属性吗?如果类变大,是否有任何简单的枚举?

c#

0
推荐指数
1
解决办法
33
查看次数