我正在尝试建立一系列触发空手道场景的测试。我对功能文件所做的更改仅偶尔由Gatling进行。例如,在下面的功能文件代码中,运行前四个项目(包括注释掉的“ relationships”行):
Feature: This feature attempts to load the main tabs in sequence for the purposes of performance testing via gatling
Background: Create the investigation and job first
# Get api url from karate-config.js
* url baseUrl
# This configures the http headers to use admin user for running the tests
* callonce read('classpath:common/headers/admin-headers.feature')
* def investigaitonId = 150
* def jobId = 51
Scenario: Twitter investigation with 1 selector
Given path 'investigations', investigaitonId
When method get
Then status 200
Given path 'jobs', jobId
When method get
Then status 200
Given path 'investigations', investigaitonId, 'actors'
When method get
Then status 200
#Given path 'investigations', investigaitonId, 'relationships'
#When method get
#Then status 200
Given path 'investigations', investigaitonId, 'entities'
When method get
Then status 200
Given path 'investigations', investigaitonId, 'events'
When method get
Then status 200
Given path 'investigations', investigaitonId, 'activities'
When method get
Then status 200
Given path 'investigations', investigaitonId, 'activities-media'
When method get
Then status 200
其余的不是。查看所附的运行结果屏幕: enter image description here
POM以供参考:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.version>3.6.0</maven.compiler.version>
<karate.version>0.9.4</karate.version>
<junit5.version>5.5.1</junit5.version>
<masterthought.version>4.9.0</masterthought.version>
<gatling.plugin.version>3.0.2</gatling.plugin.version>
<gatling.charts.version>3.2.1</gatling.charts.version>
<scala.version>2.15.2</scala.version>
</properties>
我怀疑每次进行更改时,诸如编译文件之类的内容都不会刷新或重新编译。
答案 0 :(得分:1)
您的pom.xml
中肯定缺少某些内容。请将您的设置与此项目进行比较:https://github.com/intuit/karate/tree/develop/examples/gatling
如果*.feature
文件没有自动复制到target/test-classes
文件夹-您将遇到这种情况。
答案 1 :(得分:1)
使用以下命令已解决此问题:
mvn clean test-compile gatling:test