当前位置: 首页 > 知识库问答 >
问题:

我没有得到空手道中的JUnit HTML报告

薄瑞
2023-03-14

我已经按照空手道文档中的步骤创建了一个项目,我运行了默认的archifect中给出的示例测试用例,我的用例通过了,但我没有得到任何报告

<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>

<groupId>com.poc.karate</groupId>
<artifactId>interacKarate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <maven.compiler.version>3.6.0</maven.compiler.version>
</properties>    

<dependencies>    
    <dependency>
        <groupId>com.intuit.karate</groupId>
        <artifactId>karate-junit4</artifactId>
        <version>0.2.7</version>
        <scope>test</scope>
    </dependency>       
</dependencies>

<build>
    <testResources>
        <testResource>
            <directory>src/test/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </testResource>
    </testResources>
    <plugins>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <configuration>
            <argLine>-Dfile.encoding=UTF-8</argLine>
            </configuration>
     </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <compilerArgument>-Werror</compilerArgument>
            </configuration>
        </plugin>
    </plugins>        
</build>       
package examples.users;

import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;

@RunWith(Karate.class)
public class UsersRunner {

}

我的功能文件是

场景:获取所有用户,然后按id获取第一个用户

方法get Then状态200时给定路径'users'

  • DEF first=响应[0]

给定路径'users',方法get Then status 200时的first.id

场景:创建一个用户,然后通过id获取它

  • def user=“”“{”name“:”test user“,”username“:”testuser“,”email“:”test@user.com“,”address“:{”street“:”have name“,”suite“:”apt.123“,”city“:”electri“,”zipcode“:”54321-6789“}}”“

给定url'https://html" target="_blank">jsonplaceholder.typicode.com/users'并请求user When方法post Then status 201

  • def id=response.id
  • 打印“创建的id为:”+id

我还错过了什么?

共有1个答案

曾华翰
2023-03-14

这是一个空手道的真正旧版本,我肯定你是在遵循过时的指导。我建议您遵循快速入门:https://github.com/intuit/karate#quickstart

mvn archetype:generate \
-DarchetypeGroupId=com.intuit.karate \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=0.8.0 \
-DgroupId=com.mycompany \
-DartifactId=myproject
 类似资料:
  • 问题内容: 我正在尝试让空手道DSL报告工作,这被证明是一个挑战,因为我的团队使用Circle CI而不是Jenkins。黄瓜报告似乎仅对詹金斯有用。 我在这里查看了此文档: https://github.com/intuit/karate/tree/master/karate-demo#example-report https://github.com/jenkinsci/cucumber-re

  • 我的加特林模拟课, 我的get-user.feature档案, 当我运行模拟类,下面的控制台日志我得到: 注意:这里我在34毫秒内得到响应,但是选通无法生成报告。下面是我收到的错误消息 错误: openwhisk:Gatling失败:进程已退出,但出现错误:255(退出值:255)- 但如果我运行相同的模拟文件,只需在功能文件中进行如下更改 然后,盖特林生成报告。请帮帮我,根本原因是什么。

  • 我跟随空手道文档并将Junit HTML报告复制粘贴到浏览器中。然而,输出是纯文本的,看起来与视频中描述的完全不一样。我尝试了两个不同的浏览器,Firefox57.0.2和Chrome62.0,都给出了相同的输出。输出附于此。 注意:我按照文档中的说明使用@RunWith(karate.class)将.feature文件作为Junit测试运行。下面是Runner类的示例代码。 导入org.juni

  • 我不得不错误地运行maven-clean命令,并清理目标报告文件夹。现在,如果我构建并运行我的功能文件,就会出现以下错误。我如何解决这个问题? 顺便说一句,我使用的是空手道版本0.9.0(尽管它可能并不依赖于此) 此外,如果导致以下问题,我该如何清理报告文件夹?

  • 我们正在探索用于移动应用测试的空手道。在应用程序的某些部分,我们需要滚动下拉选择选项,或者需要使用TouchActions按下后退按钮。空手道中是否有一种方法来实现TouchActions或ScrollinToView。 谢哈,谢谢

  • 但是,当看到html报告时,这一个显示5分钟的执行时间,在控制台里说是2.5分钟。 我们在sunfire报告中发现,特性son、调用web服务的步骤延迟了30 ms,但调用此特性son的步骤也有30 ms。60毫秒也是如此。 > 呼叫(feature Son.feature)30ms 对不起,我的英语不好。谢谢你的帮助