-
Notifications
You must be signed in to change notification settings - Fork 0
TBE-2680 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
TBE-2680 #10
Changes from 1 commit
5348eca
9152366
3573329
39eada5
870aed6
8c6c5d7
05f1212
cb6a52c
56b1a3c
811a7a1
45b3756
895b40a
971fa03
74b63e8
2df328e
5044ced
3759534
c395cf0
ee81657
d66e78e
fdd879c
cedeb0b
bf961fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "username": "testlum", | ||
| "password": "123456" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "clientId": "testlum-client", | ||
| "clientSecret": "super-secret" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "username": "testlum", | ||
| "password": "123456" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| name,description,status,category,expectedPost,expectedGet | ||
| RepeatEntity1,Repeat Description 1,NEW,REPEAT,expected_1_1,expected_3_1 | ||
| RepeatEntity2,Repeat Description 2,ACTIVE,REPEAT,expected_1_2,expected_3_2 | ||
| RepeatEntity3,Repeat Description 3,INACTIVE,REPEAT,expected_1_3,expected_3_3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| name,description,status,category,expectedPost,expectedGet | ||
| VarEntity1,Description 1,NEW,VAR,expected_1_1,expected_3_1 | ||
| VarEntity2,Description 2,ACTIVE,VAR,expected_1_2,expected_3_2 | ||
| VarEntity3,Description 3,INACTIVE,VAR,expected_1_3,expected_3_3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| username,password,expectedLogin,expectedResource | ||
| testlum1,123456,expected_1_1,expected_3_1 | ||
| testlum2,123456,expected_1_2,expected_3_2 | ||
| testlum3,123456,expected_1_3,expected_3_3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [ | ||
| { | ||
| "username": "testlum", | ||
| "role": "ADMIN" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "username" : "Ronaldo", | ||
| "role" : "USER" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [ { | ||
| "username" : "testlum", | ||
| "role" : "ADMIN" | ||
| }, { | ||
| "username" : "Ronaldo", | ||
| "role" : "USER" | ||
| } ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| <scenario xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="http://www.knubisoft.com/testlum/testing/model/scenario" | ||
| xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/scenario scenario.xsd"> | ||
|
|
||
| <overview> | ||
| <description> | ||
| This scenario verifies Basic Authentication functionality using the auth command. | ||
|
|
||
| Test flow includes: | ||
| 1. Apply Basic Auth header using credentials from file via auth tag. | ||
| 2. Send GET request to retrieve list of users and verify response status = 200. | ||
| 3. Validate response headers (X-Auth-Type = BASIC). | ||
| 4. Send POST request to create a new user using authenticated context. | ||
| 5. Verify response status = 200 and validate response body. | ||
| 6. Send GET request again to verify that the new user was successfully added. | ||
| 7. Validate updated response body and headers. | ||
| 8. Exit auth block (automatic logout if enabled). | ||
| 9. Send DELETE request to reset test data and ensure test isolation. | ||
|
|
||
| This scenario validates: | ||
| - Basic Auth header injection via auth command | ||
| - Authorization handling on protected endpoints | ||
| - Authenticated access to GET and POST endpoints | ||
| - Response header validation | ||
| - State mutation (user creation) under authorized context | ||
| - Test data cleanup via reset endpoint | ||
| </description> | ||
| <name>Auth Basic</name> | ||
| <developer>Vadym Kostenko</developer> | ||
| </overview> | ||
|
|
||
| <settings truncateStorages="true"> | ||
| <tags>httpAuth</tags> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. httpAuth -> auth |
||
| </settings> | ||
|
|
||
| <auth comment="Apply Basic Auth header" | ||
| apiAlias="MEGA_APP_BASIC" | ||
| credentials="http-auth-user-basic.json" | ||
| loginEndpoint="/ignore"> | ||
|
|
||
| <http comment="Check ability to get users inside auth block" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get before auth to make sure that it's private endpoint |
||
| alias="MEGA_APP_BASIC"> | ||
| <get endpoint="/api/test/auth/basic/users"> | ||
| <response code="200" file="expected_2.json"/> | ||
| <header name="X-Auth-Type" data="BASIC"/> | ||
| </get> | ||
| </http> | ||
|
|
||
| <http comment="Check ability to create new user inside auth block" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
| alias="MEGA_APP_BASIC"> | ||
| <post endpoint="/api/test/auth/basic/users"> | ||
| <response code="200" file="expected_3.json"/> | ||
| <header name="Content-Type" data="application/json"/> | ||
| <header name="X-Auth-Type" data="BASIC"/> | ||
| <body> | ||
| <raw> | ||
| { | ||
| "username": "Ronaldo", | ||
| "password": "kris123", | ||
| "role": "USER" | ||
| } | ||
| </raw> | ||
| </body> | ||
| </post> | ||
| </http> | ||
|
|
||
| <http comment="Check ability to get users list after creating new user" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
| alias="MEGA_APP_BASIC"> | ||
| <get endpoint="/api/test/auth/basic/users"> | ||
| <response code="200" file="expected_4.json"/> | ||
| <header name="X-Auth-Type" data="BASIC"/> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove header |
||
| </get> | ||
| </http> | ||
|
|
||
| </auth> | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add 401 request after auth ending |
||
| <http comment="Reset basic auth test data after auth block" | ||
| alias="MEGA_APP_BASIC"> | ||
| <delete endpoint="/api/test/auth/basic/reset"> | ||
| <response code="200"/> | ||
| <header name="X-Auth-Type" data="BASIC"/> | ||
| </delete> | ||
| </http> | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add autologout false check |
||
| </scenario> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "token" : "p(any)" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "username" : "testlum" | ||
| } |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no single one auth tag in auth scenario
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create true condition |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| <scenario xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="http://www.knubisoft.com/testlum/testing/model/scenario" | ||
| xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/scenario scenario.xsd"> | ||
|
|
||
| <overview> | ||
| <name>Auth JWT Condition</name> | ||
| <description> | ||
| This scenario verifies interaction between JWT authentication flow and condition command. | ||
|
|
||
| Test flow includes: | ||
| 1. Send POST login request with valid credentials. | ||
| 2. Verify login response = 200. | ||
| 3. Extract JWT token from response. | ||
| 4. Create condition based on extracted token. | ||
| 5. Send GET request to protected resource only if condition is true. | ||
| 6. Verify protected response = 200. | ||
| 7. Create false condition. | ||
| 8. Send GET request with false condition (should be skipped). | ||
| 9. Reset JWT auth state after test. | ||
|
|
||
| This scenario validates: | ||
| - JWT login flow | ||
| - Token extraction | ||
| - Condition creation based on auth result | ||
| - Conditional execution of protected requests | ||
| </description> | ||
| <developer>Vadym Kostenko</developer> | ||
| </overview> | ||
|
|
||
| <settings truncateStorages="true"> | ||
| <tags>httpAuth</tags> | ||
| </settings> | ||
|
|
||
| <http comment="Step 1-2. Login and get JWT token" | ||
| alias="MEGA_APP"> | ||
| <post endpoint="/api/test/auth/jwt/login"> | ||
| <response code="200" file="expected_1.json"/> | ||
| <header name="Content-Type" data="application/json"/> | ||
| <body> | ||
| <raw> | ||
| { | ||
| "username": "testlum", | ||
| "password": "123456" | ||
| } | ||
| </raw> | ||
| </body> | ||
| </post> | ||
| </http> | ||
|
|
||
| <var comment="Step 3. Extract JWT token from login response" | ||
| name="token"> | ||
| <path value="$.token"/> | ||
| </var> | ||
|
|
||
| <condition comment="Step 4. Verify token is not empty" | ||
| name="tokenExists" | ||
| spel="'{{token}}' != null and '{{token}}' != ''"/> | ||
|
|
||
| <http comment="Step 5-6. Access protected resource only if token exists" | ||
| alias="MEGA_APP" | ||
| condition="tokenExists"> | ||
| <get endpoint="/api/test/auth/jwt/resource"> | ||
| <response code="200" file="expected_4.json"/> | ||
| <header name="Authorization" data="Bearer {{token}}"/> | ||
| <header name="X-Auth-Type" data="JWT"/> | ||
| </get> | ||
| </http> | ||
|
|
||
| <condition comment="Step 7. Create false condition" | ||
| name="neverExecute" | ||
| spel="'1' == '2'"/> | ||
|
|
||
| <http comment="Step 8. This request should not execute because condition is false" | ||
| alias="MEGA_APP" | ||
| condition="neverExecute"> | ||
| <get endpoint="/api/test/auth/jwt/resource"> | ||
| <response code="200" file="expected_6.json"/> | ||
| <header name="Authorization" data="Bearer {{token}}"/> | ||
| <header name="X-Auth-Type" data="JWT"/> | ||
| </get> | ||
| </http> | ||
|
|
||
| <http comment="Step 9. Reset JWT auth state after test" | ||
| alias="MEGA_APP"> | ||
| <delete endpoint="/api/test/auth/jwt/reset"> | ||
| <response code="200"/> | ||
| <header name="X-Auth-Type" data="JWT"/> | ||
| </delete> | ||
| </http> | ||
|
|
||
| </scenario> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "message" : "Custom auth access granted", | ||
| "authType" : "CUSTOM" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "status" : "UNAUTHORIZED", | ||
| "message" : "Missing Authorization header", | ||
| "timestamp" : "p(any)" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need truncateStorages here I guess