Skip to content

Commit

Permalink
feat: TAG-0.8.1 Sanity report logging (#217)
Browse files Browse the repository at this point in the history
* Initial commit

* Added unit tests

* fixed duration fix

* Added sanity flow chart
  • Loading branch information
Abhishk123 authored Sep 10, 2024
1 parent 3970cfd commit e5f99f1
Show file tree
Hide file tree
Showing 9 changed files with 761 additions and 557 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ It has the following features -
- [FCA URL deployed and available in the S3](#fca-url-deployed-and-available-in-the-s3)
- [Below are the steps to run FCA in local system](#below-are-the-steps-to-run-fca-in-local-system)
- [Supported ways of Execution](#supported-ways-of-execution)
- [Sanity Suite Flow](./docs/index.md)
- [Supported targets](#supported-targets)
- [Supported Modes of execution](#supported-modes-of-execution)
- [Supported validations](#supported-validations)
Expand Down
Binary file added docs/images/generateAPIValidaionResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/testRunnerFlow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Sanity Suite Flow chart

## Implementation
![Implementation Diagram](./images/testRunnerFlow.png)

## Generating Report Logs
![Manual Trigger Diagram](./images/generateAPIValidaionResult.png)
498 changes: 146 additions & 352 deletions src/Test_Runner.js

Large diffs are not rendered by default.

30 changes: 12 additions & 18 deletions src/ValidationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class ValidationView extends lng.Component {
},
color: 0xff123456,
},
ContentValidationStateText: {
Message: {
x: 530,
y: 200,
w: 1920 - 700,
Expand Down Expand Up @@ -198,7 +198,7 @@ export default class ValidationView extends lng.Component {
this.tag('UpdateText').text = CONSTANTS.VALIDATION_SCROLLMESSAGE;
this.tag('ApititleText').text = '';
this.tag('SchemaValidationStateText').text = '';
this.tag('ContentValidationStateText').text = '';
this.tag('Message').text = '';
this.tag('ValidationData').text = '';
}
} else {
Expand Down Expand Up @@ -230,45 +230,39 @@ export default class ValidationView extends lng.Component {
const { err, fail, code } = _displayparms;
this.tag('ValidationData').color = 0xff123456;
let schemaValidationStateText = null,
contentValidationStateText = null,
message = null,
validationData = null;
if (code != undefined) {
let codeObject = null,
isCodeTypeObject = true,
messageString = null;
try {
codeObject = JSON.parse(_displayparms.code);
messageString = codeObject.Message;
if (typeof codeObject.Message != 'string') {
messageString = JSON.stringify(codeObject.Message, null, 1);
messageString = codeObject.Response;
if (typeof codeObject.Response != 'string') {
messageString = JSON.stringify(codeObject.Response, null, 1);
}
isCodeTypeObject = true;
} catch (err) {
isCodeTypeObject = false;
}
if (isCodeTypeObject) {
schemaValidationStateText = CONSTANTS.SCHEMA_VALIDATION_STATUSMESSAGE + codeObject.Schema;
contentValidationStateText = CONSTANTS.CONTENT_VALIDATION_STATUSMESSAGE + codeObject.Content;
if (fail) {
validationData = CONSTANTS.ERROR_MESSAGE + messageString;
} else {
validationData = CONSTANTS.API_RESPONSE + messageString;
}
schemaValidationStateText = CONSTANTS.SCHEMA_VALIDATION_STATUSMESSAGE + codeObject['Schema Validation'];
message = 'Message: ' + codeObject.Message;
validationData = CONSTANTS.API_RESPONSE + messageString;
} else {
schemaValidationStateText = CONSTANTS.SCHEMA_VALIDATION_STATUSMESSAGE + CONSTANTS.SCHEMA_CONTENT_SKIPPED;
contentValidationStateText = CONSTANTS.CONTENT_VALIDATION_STATUSMESSAGE + CONSTANTS.SCHEMA_CONTENT_SKIPPED;
validationData = CONSTANTS.ERROR_MESSAGE + 'JSON parse failed (ValidationView)';
validationData = CONSTANTS.API_RESPONSE + 'JSON parse failed (ValidationView)';
}
} else {
// Remove if not needed after testing
schemaValidationStateText = CONSTANTS.SCHEMA_VALIDATION_STATUSMESSAGE + CONSTANTS.SCHEMA_CONTENT_SKIPPED;
contentValidationStateText = CONSTANTS.CONTENT_VALIDATION_STATUSMESSAGE + CONSTANTS.SCHEMA_CONTENT_SKIPPED;
validationData = CONSTANTS.ERROR_MESSAGE + 'Received response as undefined';
validationData = CONSTANTS.API_RESPONSE + 'Received response as undefined';
}
// Updating values in UI
this.tag('ApititleText').text = CONSTANTS.API_TITLE + _displayparms.fullTitle;
this.tag('SchemaValidationStateText').text = schemaValidationStateText;
this.tag('ContentValidationStateText').text = contentValidationStateText;
this.tag('Message').text = message;

/*
Schema data for some APIs are large enough to break the render engine.
Expand Down
4 changes: 3 additions & 1 deletion src/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const CONSTANTS = {
CONTENT_ERROR: 'Content Error',
RDK_SERVICES: 'org.rdk.',
API_TITLE: 'API TITLE: ',
API_RESPONSE: 'API Response: ',
API_RESPONSE: 'Response: ',
INVOKE_TEST_MESSAGE: '**** Click Invoke to run tests ****',
VALIDATION_MESSAGE: '***** Validation Started ******',
VALIDATION_SCROLLMESSAGE: "Scroll down through the menu's to view the result",
Expand Down Expand Up @@ -160,4 +160,6 @@ export const CONSTANTS = {
EXCLUDED_METHODS_FOR_MFOS: [],
...CONFIG_CONSTANTS,
VERSIONS: 'Versions',
NO_RESULT_OR_ERROR_MESSAGE: 'No result or error in response. eg: {jsonrpc: "2.0", id: x }',
SCHEMA_VALIDATION: 'Schema Validation',
};
2 changes: 1 addition & 1 deletion src/pubsub/handlers/RunTestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class RunTestHandler extends BaseHandler {

async getValidationReport(message) {
const sdkMode = message.action;
process.env.COMMUNICATION_MODE = message.context.communicationMode;
process.env.COMMUNICATION_MODE = message.context.communicationMode ? message.context.communicationMode : CONSTANTS.TRANSPORT;

const sdkInvokerInfo = new Test_Runner();
let validatedMenu;
Expand Down
Loading

0 comments on commit e5f99f1

Please sign in to comment.