Skip to content

Commit

Permalink
alterando projeto
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogatto committed Oct 9, 2019
1 parent 3bbc96e commit 1cfcfde
Show file tree
Hide file tree
Showing 17 changed files with 210 additions and 132 deletions.
177 changes: 94 additions & 83 deletions fastmovies.iml

Large diffs are not rendered by default.

26 changes: 6 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,33 @@
<artifactId>fastmovies</artifactId>
<version>1.0-SNAPSHOT</version>


<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.0.RC5</karate.version>
<gatling.plugin.version>2.2.4</gatling.plugin.version>
<karate.version>0.9.4</karate.version>
<gatling.plugin.version>3.0.2</gatling.plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit4</artifactId>
<artifactId>karate-gatling</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-gatling</artifactId>
<artifactId>karate-junit4</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>

<!-- Dependências para relatório externo -->
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -79,7 +65,7 @@
<configuration>
<simulationsFolder>src/test/java</simulationsFolder>
<includes>
<include>movie.MovieSimulation</include>
<include>perfomance.MovieSimulation</include>
</includes>
</configuration>
</plugin>
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/karate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ function fn() {
baseUrl: 'http://api-demov3.sensedia.com/dev/fastmovie/',
versionUrlBase: 'v1/'
};
if (env == 'dev') {
if (env === 'dev') {
config.baseUrl = 'http://api-demov3.sensedia.com/fastmovie/' + config.versionUrlBase;
} else if (env == 'hlg') {
config.baseUrlBase = 'https://api-cateno.sensedia.com/hlg/prepay/' + config.versionUrlBase;
} else if (env === 'hlg') {
config.baseUrlBase = 'http://api-demov3.sensedia.com/hlg/fastmovie/' + config.versionUrlBase;
}
/*// don't waste time waiting for a connection or if servers don't respond within 5 seconds
karate.configure('connectTimeout', 5000);
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions src/test/java/movie/parallel/create-movie3.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Cadastrar novo filme
Background:
* url baseUrl
* def pathUrl = 'movies'

Scenario: criar e recuperar novo filme
Given request {description: 'De volta para o Futuro'}
And path pathUrl
When method post
Then status 201
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}

Given path pathUrl + '/' + response.id
When method get
Then status 200
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}
16 changes: 16 additions & 0 deletions src/test/java/movie/parallel/create-movie4.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Cadastrar novo filme
Background:
* url baseUrl
* def pathUrl = 'movies'

Scenario: criar e recuperar novo filme
Given request {description: 'De volta para o Futuro'}
And path pathUrl
When method post
Then status 201
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}

Given path pathUrl + '/' + response.id
When method get
Then status 200
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}
File renamed without changes.
12 changes: 12 additions & 0 deletions src/test/java/movie/parallel/update-movie2.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Alterar filme
Background:
* url baseUrl
* def pathUrl = 'movies/1'
* def json = {description: 'American Pie 3'}

Scenario: alterar filme
Given request json
And path pathUrl
When method put
Then status 200
And match response == {id: '#notnull', description: 'American Pie 3'}
12 changes: 12 additions & 0 deletions src/test/java/movie/parallel/update-movie3.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Alterar filme
Background:
* url baseUrl
* def pathUrl = 'movies/1'
* def json = {description: 'American Pie 3'}

Scenario: alterar filme
Given request json
And path pathUrl
When method put
Then status 200
And match response == {id: '#notnull', description: 'American Pie 3'}
12 changes: 12 additions & 0 deletions src/test/java/movie/parallel/update-movie4.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Alterar filme
Background:
* url baseUrl
* def pathUrl = 'movies/1'
* def json = {description: 'American Pie 3'}

Scenario: alterar filme
Given request json
And path pathUrl
When method put
Then status 200
And match response == {id: '#notnull', description: 'American Pie 3'}
16 changes: 16 additions & 0 deletions src/test/java/movie/simple/create-movie.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Cadastrar novo filme
Background:
* url baseUrl
* def pathUrl = 'movies'

Scenario: criar e recuperar novo filme
Given request {description: 'De volta para o Futuro'}
And path pathUrl
When method post
Then status 201
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}

Given path pathUrl + '/' + response.id
When method get
Then status 200
And match response == {id: '#notnull', description: 'De Volta para o Futuro'}
12 changes: 12 additions & 0 deletions src/test/java/movie/simple/update-movie.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Alterar filme
Background:
* url baseUrl
* def pathUrl = 'movies/1'
* def json = {description: 'American Pie 3'}

Scenario: alterar filme
Given request json
And path pathUrl
When method put
Then status 200
And match response == {id: '#notnull', description: 'American Pie 3'}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package movie;
package perfomance

import com.intuit.karate.gatling.PreDef._
import io.gatling.core.Predef._

import scala.concurrent.duration._

class MovieSimulation extends Simulation {
Expand All @@ -12,10 +13,10 @@ class MovieSimulation extends Simulation {

/*protocol.nameResolver = (req, ctx) => req.getHeader("karate-name")*/

val create = scenario("Teste para criar novo filme").exec(karateFeature("classpath:movie/create-movie.feature"))
val update = scenario("Teste para alterar filme").exec(karateFeature("classpath:movie/update-movie.feature"))
val create = scenario("Teste para criar novo filme").exec(karateFeature("classpath:movie/simple/create-movie.feature"))
val update = scenario("Teste para alterar filme").exec(karateFeature("classpath:movie/simple/update-movie.feature"))
setUp(
create.inject(rampUsers(4) over (5 seconds)).protocols(protocol),
update.inject(rampUsers(4) over (5 seconds)).protocols(protocol)
create.inject(rampUsers(4) during (5 seconds)).protocols(protocol),
update.inject(rampUsers(4) during (5 seconds)).protocols(protocol)
)
}
17 changes: 0 additions & 17 deletions src/test/java/runner/AllRunner.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package movie;
package runner;

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

@RunWith(Karate.class)
@KarateOptions(features = "src/test/java/movie/")
@KarateOptions(features = "src/test/java/movie/simple/")
public class MovieRunner {

@BeforeClass
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/runner/ParallelRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import com.intuit.karate.Results;
import com.intuit.karate.Runner;
import static org.junit.Assert.*;

import org.junit.BeforeClass;
import org.junit.Test;

@KarateOptions(tags = {"~@ignore"},features = {
"src/test/java/movie/"})
@KarateOptions(tags = {"~@ignore"},features = {"src/test/java/movie/parallel/"})
public class ParallelRunner {

@Test
Expand Down

0 comments on commit 1cfcfde

Please sign in to comment.