小编hoc*_*kto的帖子

Surefire 重新运行失败的测试不起作用

我想重新运行一个我知道会失败的测试,因为我正在尝试测试 Surefire 参数以重新运行失败的测试。我尝试使用这两个命令运行 Maven 它们都没有按预期工作

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails test
Run Code Online (Sandbox Code Playgroud)

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails surefire:test
Run Code Online (Sandbox Code Playgroud)

这是其中的一部分 pom.xml

<dependency>
    <groupId>org.apache.maven.surefire</groupId>
    <artifactId>surefire-api</artifactId>
    <version>2.19.1</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.53.1</version>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
Run Code Online (Sandbox Code Playgroud)

我原以为 Surefire 会在失败后重新启动测试,但 Maven 只是抛出此错误,我知道如何解决,但我希望重新运行测试。

<dependency>
    <groupId>org.apache.maven.surefire</groupId>
    <artifactId>surefire-api</artifactId>
    <version>2.19.1</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.53.1</version>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
Run Code Online (Sandbox Code Playgroud)

java testing surefire maven maven-surefire-plugin

7
推荐指数
3
解决办法
8433
查看次数

一个线程比另一个线程慢,即使它们做同样的事情

我只是通过尝试创建一些小程序来学习多线程,我发现了一个特定的东西,我不知道为什么它是这样的.

我有两个课程,他们都数到20亿,最后他们打印出时间来完成它.它们位于不同的文件中.第一个可以在大约2秒内完成(它会更快,但我也在那里做其他的东西),和新的线程(新的Runnable())

在主要课程中要慢得多,花了大约8秒才能完成.你可以解释一下原因吗?这是代码.谢谢.

public class First implements Runnable {

private long startTime, endTime;
public static double count = 0;

@Override
public void run() {
    startTime = System.currentTimeMillis();

    for (int count = 0; count <= 2000000000L; count++);

    endTime = System.currentTimeMillis();
    System.out.println(endTime - startTime); //it is done in about 2seconds
  }
 }


public class Threads {

   public static void main(String[] args){

         First f = new First();
         f.run();

     new Thread(new Runnable() {

        @Override
        public void run() {

            long startTime, endTime;
            double count; …
Run Code Online (Sandbox Code Playgroud)

java multithreading

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

ui:param - 传递方法参数

我有两个 xhtml 文件,一个包含另一个。我已经知道如何将控制器和要调用的方法传递给对话框,我不确定是否可能,是将参数/对象实际传递给将被调用的方法。我尝试了类似的方法,但是 Eclipse 告诉我这部分有语法错误

actionListener="#{bean[confMethod(param1, param2)]}"

但它没有任何问题

actionListener="#{bean[confMethod]}"

文件1.xhtml:

<ui:composition>
.....
    <ui:include src="/jsf/include/dg_confirm.xhtml">
        <ui:param name="bean" value="#{myController}" />
        <ui:param name="question" value="Are you sure?" />
        <ui:param name="confMethod" value="myMethod" />
        <ui:param name="param1" value="#{otherController.param1}" />
        <ui:param name="param2" value="#{urlToFollow}" />
    </ui:include>

</ui:composition>
Run Code Online (Sandbox Code Playgroud)

和对话框

dg_confirm.xhtml

....
<p:commandButton value="Yes" oncomplete="PF('dlg_conf').hide();" actionListener="#{bean[confMethod(param1, param2)]}" ajax="false"/>
.....
Run Code Online (Sandbox Code Playgroud)

问题:是否可以在 JSF 中以某种方式传递方法的参数?

jsf el

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

CSS相对(到什么?)的位置

我正在制作一个网站,它只有几行,我只是制作了它的结构,看看它的样子,直到现在我还以为我理解CSS中的"相对"位置是什么意思.这是我的HTML和CSS代码.如果您看一下CSS,您将在#about div中看到

position: relative;
top: 13%;
Run Code Online (Sandbox Code Playgroud)

#portfolio中

position: relative;
top: 0;
Run Code Online (Sandbox Code Playgroud)

但它不在#wrap div之上.如果我将其位置改为绝对位置,它将位于顶部.所以我的问题是:#portfolio div是相对于什么的?我认为它应该是相对于我认为它应该是相对于包装更改它的顶部位置.(对不起关于这篇文章的格式化,如果你会很好地格式化它会更好,它会很棒,我试过但它太可怕了)

链接到HTML和CSS

css

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

标签 统计

java ×2

css ×1

el ×1

jsf ×1

maven ×1

maven-surefire-plugin ×1

multithreading ×1

surefire ×1

testing ×1