Skip to content

This repository serves as a blank example of a Karate Test Suite with Git Actions capabilities

Notifications You must be signed in to change notification settings

bridirks/karate-test-suite

Repository files navigation


Logo

Functional Testing with Karate Framework


Karate framework follows the Cucumber style of writing the program which follows the BDD approach. The syntax is easy to understand by non-programmers. And this framework is the only API testing tool that has combined API Automation and performance testing into a single standalone tool.
We will be using Karate to perform Smoke and Regression tests. All feature files are labeled with the appropriate Tags in order to more easily reference in Git Actions and Command Line. These test files will provide examples on how to set up test cases for custom use.

Smoke Testing

Feature files labeled Smoke are designed to validate individual features in each API. They call on available features and return the HTTP Response status code. The typical expected response is status 200 or OK status.

Regression Testing

Feature files labeled Regression are being split between two categories referred to in a sub-tag.
variables - designed to validate the responses of individual features in each API. They call on available features and verify that the responses contain the correct labels. Labels vary depending on the variables contained in the data being requested. This is not to be confused with data validation, we are only checking that the responses contain the correct variables. The content of those variables is being ignored.
data - the design is similar to variable, but this time the requests are looking for specific responses to a search. These tests will only work on their pre-set search item.

Running a Test on Personal Machine

1. Download the entire project as a zip (this will contain a copy of the standalone jar file)
2. Extract files to the location of your choice
3. Open the command prompt
4. Navigate to the directory that contains the project folder (test-directory) and run desired test file (smoke, regression, etc)
"Navigate to test-directory folder"
./run-smoke
  1. Results will be viewable in a dashboard by selecting the url given at the end of a test run

    Note: if you are running this project on Windows, you will need to add '.bat' to the end of all of the test files in order to run them from command line

Running a Test in Git Actions

1. Navigate to the Actions tab in the ccte-api-karate repository
2. Under `Workflows` select Karate
3. Highlighted in blue is the message `This workflow has a workflow_dispatch event trigger.` To the right of this message is a drop-down menu labeled `Run Workflow`.
4. Optional: Select desired environment
5. Required: Select the desired test tag from the drop-down menu.
6. Select `Run Workflow`
7. Results will be viewable in an artifact folder after the tests have completed. These results will not be formatted unless you unzip the artifact folder

Optional - to View Full Dashboard

1. Download the karate project
2. Download the artifact and extract the contents into the 'target' folder of the downloaded karate project
3. Select 'karate-summary.html' from the karate-reports folder to open in browser

About

This repository serves as a blank example of a Karate Test Suite with Git Actions capabilities

Resources

Stars

Watchers

Forks