Upload
pascal-dufour
View
528
Download
0
Embed Size (px)
Citation preview
Agenda• Why and how Minosse is developed• How to create automated checks in Minosse (CucumberJS)• Thoughts behind writing great feature files
The new testerProgram languages
• Groovy
• JAVA
• NodeJS
• Ruby
https://www.flickr.com/photos/jdhancock/
Easy to switch for testers between projects
• One language for test automation across projects
• Test written in a uniform style across projects
Problems we solved
Easy to adapt for new testers
• Tests written in a readable language for a techie person
• No scripting skills required to write automated tests
Easy life for developers
• Test implementation code is written once
• Bugs and fixes in one place
Agenda• Why and how Minosse is developed• How to create automated checks in Minosse (CucumberJS)• Thoughts behind writing great feature files
Generic set of common steps for testing API
(ab)-use CucumberJS
• Property steps
• HTTP steps
• Debug steps
Minosse
Load testdata
• Given I set property foo to testdata foo
Setting a property
• Given I set property foo of request body to number 4
Remove a property
• Given I remove property foo
Property setting steps
Set the request body
• Given I set the request body to property foo
Set a request header
• Given I set the request header bar with value foo
Set the request content type
• Given I set the request header Content-Type with value multipart/formdata
Save the response body
• Given I set property foo to the response body
Http steps Set requests and save response body
Send a request
• Given I send a POST request to /foo
Sending an HTTPS request
• Given I secure the connection with certificate certificate.crt and with key keyFile.key
Check the response code
• Given the response status code is 200
Http steps sending a request and check
Checking if property does not exist
• Given I check property foo of response body does not exist
Checking the value of a property
• Given I check property foo of response body equals number 4
Checking the type of a property
• Given I check property foo of response body has type number
Checking the format of a property
• Given I check property bar has format email
Property checking steps
Setup your own environmentInstall instructions
1. Install NodeJS
2. Clone the api repository `git clone [email protected]:aredo/restcountries.git`
3. Checkout the release 0.1.0 `git checkout tags/0.1.0`
4. cd restcountries && npm install minosse cucumber
Or we made an environment for youInstall instructions
1. Ask Pascal or Valerio the USB
2. Copy the content somewhere in your machine
3. Import the machine in VirtualBox
You can also download the machine here:
https://goo.gl/WKXOFk
Scenario: Calling Get should return a 200 status code
Given I send a GET request to /
When the response status code is 200
Assignments 1 add a debug step
Then DEBUG I print property response body
For handouts see https://goo.gl/OyJuZD
Scenario: Calling Get should return a 200 status code Given I send a GET request to / When the response status code is 200 Then DEBUG I print property response bodyAnd I check
Assignments 2 add a check on the response
property message of response body equals string Welcome buddy!
Scenario: Calling Get on endpoint /incorrect should return a 404 status code and the message Sorry, that page does not exist Given I send a GET request to /incorrect When the response status code is 404 And I check
Assignments 3 check a specific status
property message of response body equals string Sorry, that page does not exist
Scenario: Calling Get on endpoint api/v1 should return a 200 status code and I check multiple properties. Given I send a GET request to /api/v1 When the response status code is 200 And I check
Assignments 4 check a specific value
property res.body[0].name equals string Afghanistan
Scenario: I want to show my custom steps Given I want to create a custom step
Assignments 5 create a custom step
Agenda• Why and how Minosse is developed• How to create automated checks in Minosse (CucumberJS)• Thoughts behind writing great feature files
What the testers do in the project
Create test ideasReview documentation
Review testsCreate automated
testsMaintain tests
Exploratory testing
Review reports
•Created by the team.
•Self verifying data for files en test….
•1 test should test 1 thing (single responsibility pattern).
•Exploratory testing is mandatory for a good check
•What is implemented is tested. => Test should always reflect implementation.
•We use Coverage Report to measure the test coverage. To train ourselves in creating better test.
•Everything is reviewed by the someone in the team or by an other team
Writing a good feature file
@collect-active Feature: As a user I want to collect and receive stamps with bonus stamp offers @BSO Scenario Outline: As a user I want to collect and receive stamps with bso Given testdata collect_active is stored as collect ........ When I send a POST request to /…/………………/active Then the response status code is 200 And check property transactionId of response body is property transactionIdentifier And check property newBalance of response body is number <newBalance> And check property mutation of response body is number <mutation>
Examples: |amountSpent |bso |value |newBalance |mutation | |10 |Bso1Stamps |1 |2 |2 | |10 |Bso100Stamps |1 |101 |101 | |20 |Bso1Stamps |7 |9 |9 | |10 |BsoLimitedLife |1 |2 |2 |