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

Feature/8 implement methods #27

Merged
merged 33 commits into from
Nov 3, 2023
Merged

Conversation

miroslavpojer
Copy link
Collaborator

@miroslavpojer miroslavpojer commented Aug 23, 2023

#8 - Implement method ideas
Implemented full expected methods for Log 'ResponseAction'.

def logError(message: String): Boolean
def logWarn(message: String): Boolean
def logInfo(message: String): Boolean
def logDebug(message: String): Boolean

Implemented methods for Log 'ResponseAction'.

  • response-time-...

def assertResponseTimeIsBelow(response: Response, limit: String): Boolean
def assertResponseTimeIsAbove(response: Response, limit: String): Boolean

  • status-code-...

def assertStatusCodeEquals(response: Response): Boolean
def assertStatusCodeSuccess(response: Response): Boolean
def assertStatusCodeIsClientError(response: Response): Boolean
def assertStatusCodeIsServerError(response: Response): Boolean

  • header-...

def assertHeaderExists(response: Response, headerName: String): Boolean
def assertHeaderValueEquals(response: Response, headerName: String, expectedValue: String): Boolean

  • content-type-...

def assertContentTypeIsJson(response: Response): Boolean
def assertContentTypeIsXml(response: Response): Boolean
def assertContentTypeIsHtml(response: Response): Boolean

  • cookie-...

def assertCookieExists(response: Response, cookieName: String): Boolean
def assertCookieValueEquals(response: Response, cookieName: String, expectedValue: String): Boolean
def assertCookieIsSecured(response: Response, cookieName: String): Boolean
def assertCookieIsNotSecured(response: Response, cookieName: String): Boolean

  • body-.

def assertBodyContainsText(response: Response, text: String): Boolean

Done several refactoring changes:

  • improved logging messages
  • Set to Seq to keep defined actions order.
  • small improvements solved when found

* Renamed assertion json tag to responseAction.
* Refactored related logic and doc.
* Simplified json files for ResponseAction - ResponseActions group and name by method with meaning "group.name". In code this value is separated for more intuitive usage.
* Refactored responseActions logic to accept random parameter names.
* Correct parameters are validated in time of project loading.
* Extended json schemas by descriptions and version.
* Implemented full expected methods for Log 'ResponseAction'.
@miroslavpojer miroslavpojer self-assigned this Aug 23, 2023
@miroslavpojer miroslavpojer requested review from Zejnilovic and removed request for Zejnilovic August 23, 2023 06:58
@github-actions
Copy link

github-actions bot commented Aug 23, 2023

JaCoCo code coverage report - ScAPI

File Coverage [88.5%] 🍏
CookieValue.scala 100% 🍏
StdOutReporter.scala 100% 🍏
RequestBody.scala 100% 🍏
EnvironmentFactory.scala 100% 🍏
SuiteTestScenario.scala 100% 🍏
SuitePreAndPostProcessing.scala 100% 🍏
AfterTestSet.scala 100% 🍏
TestSet.scala 100% 🍏
Method.scala 100% 🍏
Suite.scala 100% 🍏
BeforeTestSet.scala 100% 🍏
Exceptions.scala 100% 🍏
JsonSchemaValidator.scala 100% 🍏
ExtractJsonResponseActionType.scala 100% 🍏
ResponseActionGroupType.scala 100% 🍏
AssertResponseActionType.scala 100% 🍏
LogResponseActionType.scala 100% 🍏
ScAPIRunnerConfig.scala 100% 🍏
SuiteResultType.scala 100% 🍏
SuiteRunner.scala 99.21% 🍏
ReferenceResolver.scala 96.76% 🍏
ScAPIRunner.scala 94.06% 🍏
SuiteResult.scala 93.75% 🍏
ExtractJsonResponseAction.scala 93.48% 🍏
RuntimeCache.scala 91.43% 🍏
RequestHeaders.scala 90.48% 🍏
SuiteFactory.scala 84.67% 🍏
AssertionResponseAction.scala 82.28% 🍏
LogResponseAction.scala 78.33%
ContentValidator.scala 72.99%
Response.scala 71.05%
ScAPIRequestSender.scala 2.74%
Total Project Coverage 88.75% 🍏

@miroslavpojer miroslavpojer marked this pull request as ready for review August 23, 2023 07:53
@miroslavpojer miroslavpojer removed the request for review from Zejnilovic August 23, 2023 07:53
…... part

* Implemented methods for Assertion 'ResponseAction' - header-... part
* Implemented methods for Assertion 'ResponseAction' - content-type-... part
* Updated log message to keep same format - on debug level.
* Migrate several Set to Seq to keep order of elements which is required by logic of test design.
# Conflicts:
#	testApi/src/main/resources/schema/after.schema.json
#	testApi/src/main/resources/schema/before.schema.json
#	testApi/src/main/resources/schema/suite.schema.json
#	testApi/src/main/scala/africa/absa/testing/scapi/json/Requestable.scala
#	testApi/src/main/scala/africa/absa/testing/scapi/model/Method.scala
#	testApi/src/main/scala/africa/absa/testing/scapi/model/SuiteTestScenario.scala
#	testApi/src/main/scala/africa/absa/testing/scapi/rest/response/AssertionResponseAction.scala
#	testApi/src/main/scala/africa/absa/testing/scapi/rest/response/LogResponseAction.scala
#	testApi/src/main/scala/africa/absa/testing/scapi/rest/response/Response.scala
#	testApi/src/test/resources/project_with_issues/suites/aulgui-controller/undefinedConstantIssue.suite.json
#	testApi/src/test/resources/test_project/suites/gui-controller/deleteQuestion.suite.json
#	testApi/src/test/resources/test_project/suites/gui-controller/getUserCurrent.after.json
#	testApi/src/test/resources/test_project/suites/gui-controller/getUserCurrent.before.json
#	testApi/src/test/resources/test_project/suites/gui-controller/getUserCurrent.suite.json
#	testApi/src/test/resources/test_project/suites/gui-controller/postQuestion.suite.json
#	testApi/src/test/resources/test_project/suites/gui-controller/putQuestion.suite.json
#	testApi/src/test/scala/africa/absa/testing/scapi/json/SuiteFactoryTest.scala
#	testApi/src/test/scala/africa/absa/testing/scapi/rest/response/ResponseAssertionsTest.scala
#	testApi/src/test/scala/africa/absa/testing/scapi/rest/response/ResponseExtractTest.scala
#	testApi/src/test/scala/africa/absa/testing/scapi/rest/response/ResponseLogTest.scala
#	testApi/src/test/scala/africa/absa/testing/scapi/rest/response/ResponseTest.scala
#	testApi/src/test/scala/africa/absa/testing/scapi/suite/runner/SuiteRunnerTest.scala
* Fix not used method parameters review note.
Copy link
Collaborator

@dk1844 dk1844 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR, but the Logger with var level getting set around is very weird.

Some of the intercept[xxx] call do not check the error message, wouldn't it be worth being present everywhere? Or are there some exceptions?

* Fix - not used method parameters review note.
* Fix - String to Enum
* Fix - replace boolean return values in XYZResponseAction methods.
* Fix - replace Log type of response actions by enum.
* Fix - replace ExtractJson type of response actions by enum.
…eturn values.

* Fix - make response perform method private.
* Fix - Update tests checking exceptions to check meesages too.
* Fix - Update assert method to assert values with clues where missing.
@miroslavpojer
Copy link
Collaborator Author

Not part of this PR, but the Logger with var level getting set around is very weird.

Some of the intercept[xxx] call do not check the error message, wouldn't it be worth being present everywhere? Or are there some exceptions?

All intercepts reviewed and now all of them should check message too.

* Fix - update of visibility on methods and attributes.
* Fix - removed old no more used object LoggerConfig.
* Rename of variable in code to fit to real usage.
* Fix - moved Suite related models classes to new suite package in model package.
* Fix - rename SuiteAround to SuitePreAndPostProcessing.
* Fix - rename SuiteBefore to BeforeTestSet
* Fix - rename SuiteAfter to AfterTestSet
* Fix - rename SuiteBundle to Suite
* Fix - rename ResponsePerformer to ResponseActions
* Fix - move ResponseAction related file into new package action
* Fix - rename "endpoint" to "name" as this parameters is used as name for suite not as endpoint.
… name and location. Second part: refactor Enumeration for SuiteResultType.
@miroslavpojer
Copy link
Collaborator Author

I have finished all review notes. See commits in review note answers.
I have done big amount of refactoring changes. Please @dk1844 and @Zejnilovic to do fully new review of current state.

Copy link
Collaborator

@dk1844 dk1844 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better, thanks for the fixes from last time.

Copy link
Collaborator

@dk1844 dk1844 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@miroslavpojer miroslavpojer merged commit 03dca9c into master Nov 3, 2023
2 checks passed
@miroslavpojer miroslavpojer deleted the feature/8-implement_methods branch November 3, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants