Skip to content

Commit 826403e

Browse files
Update README.md
1 parent 728342d commit 826403e

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

Diff for: README.md

+61-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
11
# karateFrameworkProject
2-
Basic karate framework project
2+
This is a basic karate project with samples and some added functionalities.
3+
4+
## Prerequisites
5+
1. [Maven](https://maven.apache.org/download.cgi) [Install manual](https://maven.apache.org/install.html )
6+
2. [Java 8 or higher](https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html)
7+
8+
You can follow the [setup guide](https://wizeline.atlassian.net/wiki/spaces/WQ/pages/3341549619/Karate+Setup)
9+
10+
## How to use the project
11+
Firstly, you have to clone the repository to get the project structure.
12+
13+
The project contains a Demo folder with examples in order to show you the main basic uses and functions in karate framework.
14+
Those examples are developed to use todoist API. So if you want to execute it, you must create an account in https://todoist.com/ and get a token.
15+
16+
You must include in karate-config.json those parameters:
17+
18+
config.apiUrl= 'https://api.todoist.com/rest/v1/';
19+
config.auth = '[your Bearer token]';
20+
21+
and add this auth param to headers requests using the following sentence just before return config object:
22+
23+
karate.configure('headers', {Authorization: config.auth})
24+
25+
If you has done everything well, you will be able to start using the project.
26+
27+
The project uses JUnit5 and it is configured to exetcute the tests using the _maven test_ command.
28+
You will be able to execute it going to project directory (use promp cmd) and executing there the maven command.
29+
30+
## Project Structure
31+
### src/test/java/karateProject folder:
32+
Contains the features and main execution java class.
33+
34+
#### Feature folder:
35+
Contains the classes features that implement the scenarios for each test case. The most recommendable is store all features files inside of this folder.
36+
37+
#### Runner file:
38+
Those files are needed to execute the tests. In this case, we have only one for execute all tests (_DemoTest.java_). This file configures the execution of all stored scenarios at the same or lower level. That means, if you have a feature file in a higher level than _DemoTest.java_, those scenarios won't be executed using this runner file.
39+
40+
_DemoTest_ file contains the configuration needed to use a parallel execution with 5 thread at the same time. Also, contains a method to get reports using cucumber reporting.
41+
42+
Reports will be stored on target>generated-tests-sources folder after each execution.
43+
44+
### helpers folder:
45+
#### JavaFiles folder
46+
Contains clasess to provide utils using java lenguage
47+
* DataGenerator class: Contains methods to get data useful for tests. e.g. generating strings
48+
* DbUtils class: Contains a jdbc connection configuration in order to be able to connect to a database.
49+
If you want to use this utility, you must add the connection string into karate-config.js something like that:
50+
51+
config.dbConfig = { username: 'root', password: 'pass', url: 'jdbc:mysql://localhost:3306/[yourDatBaseName]', driverClassName: 'com.mysql.cj.jdbc.Driver' }
52+
53+
This string connection is configuring a mysql database connection.
54+
55+
To use this DbUtils in any scenario you must to create a connection instance and use its methods.
56+
57+
#### JsFiles folder
58+
Contains js files to provide utils using javascript lenguage
59+
* Validator file: Contains a method to validate date formats.
60+
61+
#### JsFiles models
62+
Contains json files with the models that we are going to check and validate.

0 commit comments

Comments
 (0)