Skip to content
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

feat: Add test scenarios for support-cron-scheduler #911

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DeviceGET002 - Query all devices with offset
And Set Test Variable ${offset} 2
When Query All Devices With offset=${offset}
Then Should Return Status Code "200" And devices
And And totalCount Is Greater Than Zero And ${content}[devices] Count Should Match totalCount-offset
And totalCount Is Greater Than Zero And ${content}[devices] Count Should Match totalCount-offset
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Info GET Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-info.log

*** Test Cases ***
InfoGET001 - Query ping
When Query Ping
Then Should Return Status Code "200" And timestamp
And apiVersion Should be ${API_VERSION}
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

InfoGET002 - Query version
When Query Version
Then Should Return Status Code "200" And version
And apiVersion Should be ${API_VERSION}
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

InfoGET003 - Query config
When Query Config
Then Should Return Status Code "200" And config
And apiVersion Should be ${API_VERSION}
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Job Delete Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-delete.log

*** Test Cases ***
CronSchedJobDELETE001 - Delete job
# Jobs contain combination with definition type CRON/INTERVAL and actions type REST/EDGEXMESSAGEBUS/DEVICECONTROL
Given Create Multiple Jobs
When Delete Job By Name
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And Job Has Been Deleted
[Teardown] Delete Jobs

ErrCronSchedJobDELETE001 - Delete job with invalid name
When Delete Job By Invalid Name
Then Should Return Status Code "404"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Job Get Positive Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-get-positive.log

*** Test Cases ***
CronSchedJobGET001 - Query all jobs
Given Create Multiple Jobs
When Query All Jobs
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And scheduleJobs Count Should Match totalCount
[Teardown] Delete Jobs

CronSchedJobGET002 - Query all jobs by labels
Given Create Multiple Jobs With Labels
When Query All Jobs By Labels
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And scheduleJobs Count Should Be Correct
[Teardown] Delete Jobs

CronSchedJobGET003 - Query all jobs by offset
Given Create Multiple Jobs
When Query All Jobs By Offset
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And scheduleJobs Count Should Match totalCount-offset
[Teardown] Delete Jobs

CronSchedJobGET004 - Query all jobs by limit
Given Create Multiple Jobs
When Query All Jobs By Limit
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And scheduleJobs Count Should Match Limit
[Teardown] Delete Jobs

CronSchedJobGET005 - Query job by name
Given Create Multiple Jobs
When Query Job By Name
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And Job Should Be Found
[Teardown] Delete Jobs

ErrCronSchedJobGET001 - Query job by name with non-existent job
When Query Job By Name With Non-existent Job
Then Should Return Status Code "404"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Job PATCH Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-patch.log

*** Test Cases ***
CronSchedJobPATCH001 - Update jobs
# Update different field on each job
Given Create Multiple Jobs
When Update Jobs
Then Should Return Status Code "207"
And Should Return Content-Type "application/json"
And Item Index All Should Contain Status Code "201" And id
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And Jobs Should Be Updated
[Teardown] Delete Jobs

ErrCronSchedJobPATCH001 - Update job with empty definition type
Given Create Multiple Jobs
When Update Jobs With Empty Definition Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH002 - Update job with empty definition scheduledef
Given Create Multiple Jobs
When Update Jobs With Empty Definition ScheduleDef
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH003 - Update job with invalid definition type
Given Create Multiple Jobs
When Update Jobs With Invalid Definition Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH004 - Update job with empty actions type
Given Create Multiple Jobs
When Update Jobs With Empty Actions Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH005 - Update job with invalid actions type
Given Create Multiple Jobs
When Update Jobs With Invalid Actions Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH006 - Update job with invalid admin state
Given Create Multiple Jobs
When Update Jobs With Invalid AdminState
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPATCH007 - Update job with startTimestamp > endTimestamp
Given Create Multiple Jobs
When Update Jobs With Incorrect Definition Timestamp
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Job POST Trigger Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-post-trigger.log

*** Test Cases ***
CronSchedJobTriggerPOST001 - Trigger job by manual
Given Create Multiple Jobs
When Trigger Job By Manual
Then Should Return Status Code "202"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And Job Has Been Triggered
[Teardown] Delete Jobs

ErrCronSchedJobTriggerPOST001 - Trigger job by manual with non-existent job
When Trigger Job By Manual With Non-existent Job
Then Should Return Status Code "404"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobTriggerPOST002 - Trigger job by manual with the startTimestamp is not arrived yet
Given Create Multiple Jobs
When Trigger Job Which startTimestamp Is Not Arrived
Then Should Return Status Code "500"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Job POST Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-post.log

*** Test Cases ***
CronSchedJobPOST001 - Create multiple jobs
# Jobs contain combination with definition type CRON/INTERVAL and actions type REST/EDGEXMESSAGEBUS/DEVICECONTROL
When Create Multiple Jobs
Then Should Return Status Code "207"
And Should Return Content-Type "application/json"
And Item Index All Should Contain Status Code "201" And id
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Jobs

ErrCronSchedJobPOST001 - Create job with empty name
When Create Jobs With Empty Name
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST002 - Create job with empty definition type
When Create Jobs With Empty Definition Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST003 - Create job with empty definition scheduledef
When Create Jobs With Empty Definition ScheduleDef
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST004 - Create job with invalid definition type
When Create Jobs With Invalid Definition Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST005 - Create job with empty actions type
When Create Jobs With Empty Actions Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST006 - Create job with invalid actions type
When Create Jobs With Invalid Actions Type
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST007 - Create job with invalid admin state
When Create Jobs With Invalid AdminState
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrCronSchedJobPOST008 - Create job with startTimestamp > endTimestamp
When Create Jobs With Incorrect Definition Timestamp
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags Skipped

*** Variables ***
${SUITE} Support Cron Scheduler Action Record Get All Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/support-cron-scheduler-action-record-get-all.log

*** Test Cases ***
CronSchedActionGET001 - Query all schedule action record
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And ActionRecord Count Should Match totalCount
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs

CronSchedActionGET002 - Query all schedule action record with start
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record With Start
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And Only Created Of ActionRecord Greater Start Should Be Found
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs

CronSchedActionGET003 - Query all schedule action record with end
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record With End
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And Only Created Of ActionRecord Less Than End Should Be Found
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs

CronSchedActionGET004 - Query all schedule action record with start/end
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record With Start/End
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And Only Created Of ActionRecord Between Start/End Should Be Found
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs

CronSchedActionGET005 - Query all schedule action record with offset
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record With offset
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And ActionRecord Count Should Match totalCount-offset
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs

CronSchedActionGET006 - Query all schedule action record by start with limit
Given Create Multiple Jobs
And Wait For Running Schedule Job
When Query All Schedule Action Record With Limit
Then Should Return Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
And totalCount Is Greater Than Zero And ActionRecord Count Should Match Limit
And Job Name Should Be Matched With Created Jobs
[Teardown] Delete Jobs
Loading