diff --git a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js
new file mode 100644
index 0000000..ee6ba90
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationActionHelper.test.js
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2019 Vodafone Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import deepFreeze from 'deep-freeze';
+import mockRest from 'test-utils/MockRest.js';
+import { cloneAndSet } from 'test-utils/Util.js';
+import { storeCreator } from 'sdc-app/AppStore.js';
+import SoftwareProductValidationActionHelper from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationActionHelper.js';
+import { tabsMapping } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationConstants.js';
+
+import Configuration from 'sdc-app/config/Configuration.js';
+
+import { VSPComplianceCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPCertificationCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPChecksFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+
+describe('Software Product Validation Action Helper Tests', function() {
+    it('Software Products Validation Action Helper : Dsspatch', () => {
+        const store = storeCreator();
+        deepFreeze(store.getState());
+
+        const vspChecksList = VSPChecksFactory.build();
+        const vspTestsMap = VSPTestsMapFactory.build();
+        const certificationChecked = VSPCertificationCheckedFactory.build();
+        const complianceChecked = VSPComplianceCheckedFactory.build();
+        const activeTab = { activeTab: tabsMapping.INPUTS };
+        const errorMessage = { msg: 'Test Error Message' };
+
+        deepFreeze(vspChecksList);
+        deepFreeze(vspTestsMap);
+        deepFreeze(certificationChecked);
+        deepFreeze(complianceChecked);
+        deepFreeze(activeTab);
+
+        let expectedStore = cloneAndSet(
+            store.getState(),
+            'softwareProduct.softwareProductValidation.vspChecks',
+            vspChecksList
+        );
+        expectedStore = cloneAndSet(
+            store.getState(),
+            'softwareProduct.softwareProductValidation.vspTestsMap',
+            vspTestsMap
+        );
+        expectedStore = cloneAndSet(
+            store.getState(),
+            'softwareProduct.softwareProductValidation.certificationChecked',
+            certificationChecked
+        );
+        expectedStore = cloneAndSet(
+            store.getState(),
+            'softwareProduct.softwareProductValidation.complianceChecked',
+            complianceChecked
+        );
+        expectedStore = cloneAndSet(
+            store.getState(),
+            'softwareProduct.softwareProductValidation.activeTab',
+            activeTab
+        );
+        let restPrefix = Configuration.get('restPrefix');
+
+        mockRest.addHandler('fetch', ({ options, data, baseUrl }) => {
+            expect(baseUrl).toEqual(`${restPrefix}/v1.0/externaltesting`);
+            expect(data).toEqual(undefined);
+            expect(options).toEqual(undefined);
+            return { vspChecks: vspChecksList };
+        });
+
+        SoftwareProductValidationActionHelper.setVspTestsMap(store.dispatch, {
+            vspTestsMap
+        });
+        SoftwareProductValidationActionHelper.setComplianceChecked(
+            store.dispatch,
+            { complianceChecked }
+        );
+        SoftwareProductValidationActionHelper.setCertificationChecked(
+            store.dispatch,
+            { certificationChecked }
+        );
+
+        SoftwareProductValidationActionHelper.setActiveTab(store.dispatch, {
+            activeTab
+        });
+
+        SoftwareProductValidationActionHelper.onErrorThrown(store.dispatch, {
+            errorMessage
+        });
+
+        SoftwareProductValidationActionHelper.fetchVspChecks(store.dispatch)
+            .then(() => {
+                expect(store.getState()).toEqual(expectedStore);
+            })
+            .catch(() => {});
+    });
+});
diff --git a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js
new file mode 100644
index 0000000..aa00a5d
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationInputView.test.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2019 Vodafone Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { mapStateToProps } from 'sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputs.js';
+
+import VspValidationInputsView from 'sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputsView.jsx';
+import TestUtils from 'react-dom/test-utils';
+
+import { VSPComplianceCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPCertificationCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPChecksFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPTestsRequestFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPGeneralInfoFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+
+describe('SoftwareProductValidation Mapper and View Classes', () => {
+    it('mapStateToProps mapper exists', () => {
+        expect(mapStateToProps).toBeTruthy();
+    });
+
+    it('mapStateToProps data test', () => {
+        const vspChecksList = VSPChecksFactory.build();
+        const vspTestsMap = VSPTestsMapFactory.build();
+        const certificationChecked = VSPCertificationCheckedFactory.build();
+        const complianceChecked = VSPComplianceCheckedFactory.build();
+        const generalInfo = VSPGeneralInfoFactory.build();
+        var obj = {
+            softwareProduct: {
+                softwareProductValidation: {
+                    vspChecks: vspChecksList,
+                    vspTestsMap: vspTestsMap.vspTestsMap,
+                    certificationChecked:
+                        certificationChecked.certificationChecked,
+                    complianceChecked: complianceChecked.complianceChecked,
+                    generalInfo: generalInfo.generalInfo
+                }
+            }
+        };
+        var results = mapStateToProps(obj);
+        expect(results.softwareProductValidation.vspChecks).toBeTruthy();
+        expect(results.softwareProductValidation.vspTestsMap).toBeTruthy();
+        expect(
+            results.softwareProductValidation.certificationChecked
+        ).toBeTruthy();
+        expect(
+            results.softwareProductValidation.complianceChecked
+        ).toBeTruthy();
+    });
+
+    it('SoftwareProductValidationInputView render test', () => {
+        const complianceChecked = VSPComplianceCheckedFactory.build();
+        const certificationChecked = VSPCertificationCheckedFactory.build();
+        const vspTestsMap = VSPTestsMapFactory.build();
+        const vspChecksList = VSPChecksFactory.build();
+        const testsRequest = VSPTestsRequestFactory.build();
+        const generalInfo = VSPGeneralInfoFactory.build();
+
+        const version = {
+            name: 1
+        };
+        const softwareProductId = '1234';
+        const status = 'draft';
+
+        var obj = {
+            version: version,
+            softwareProductId: softwareProductId,
+            status: status,
+            softwareProductValidation: {
+                complianceChecked: complianceChecked.complianceChecked,
+                certificationChecked: certificationChecked.certificationChecked,
+                vspTestsMap: vspTestsMap.vspTestsMap,
+                vspChecks: vspChecksList,
+                testsRequest: testsRequest.testsRequest,
+                generalInfo: generalInfo.generalInfo
+            }
+        };
+
+        let vspValidationInputView = TestUtils.renderIntoDocument(
+            <VspValidationInputsView {...obj} />
+        );
+        expect(vspValidationInputView).toBeTruthy();
+    });
+});
diff --git a/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationView.test.js b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationView.test.js
new file mode 100644
index 0000000..640f9f6
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/validation/SoftwareProductValidationView.test.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright © 2019 Vodafone Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { Provider } from 'react-redux';
+import { storeCreator } from 'sdc-app/AppStore.js';
+
+import { mapStateToProps } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidation.js';
+import { mapActionsToProps } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidation.js';
+import SoftwareProductValidationView from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationView.jsx';
+import { VSPComplianceCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPCertificationCheckedFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPChecksFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { VSPTestsMapFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationFactory.js';
+import { tabsMapping } from 'sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationConstants.js';
+import TestUtils from 'react-dom/test-utils';
+//import { scryRenderedDOMComponentsWithTestId } from 'test-utils/Util.js';
+
+describe('SoftwareProductValidation Mapper and View Classes', () => {
+    it('mapStateToProps mapper exists', () => {
+        expect(mapStateToProps).toBeTruthy();
+    });
+
+    it('mapActionsToProps mapper exists', () => {
+        expect(mapActionsToProps).toBeTruthy();
+    });
+
+    it('mapStateToProps data test', () => {
+        const vspChecksList = VSPChecksFactory.build();
+        const vspTestsMap = VSPTestsMapFactory.build();
+        const certificationChecked = VSPCertificationCheckedFactory.build();
+        const complianceChecked = VSPComplianceCheckedFactory.build();
+
+        var obj = {
+            softwareProduct: {
+                softwareProductValidation: {
+                    vspChecks: vspChecksList,
+                    vspTestsMap: vspTestsMap.vspTestsMap,
+                    certificationChecked: certificationChecked.certificationChecked,
+                    complianceChecked: complianceChecked.complianceChecked,
+                    activeTab: tabsMapping.SETUP
+                }
+            }
+        };
+        var results = mapStateToProps(obj);
+        expect(results.softwareProductValidation.vspChecks).toBeTruthy();
+        expect(results.softwareProductValidation.vspTestsMap).toBeTruthy();
+        expect(
+            results.softwareProductValidation.certificationChecked
+        ).toBeTruthy();
+        expect(
+            results.softwareProductValidation.complianceChecked
+        ).toBeTruthy();
+        expect(results.softwareProductValidation.activeTab).toBeTruthy();
+    });
+
+    it('SoftwareProductValidationView render test', () => {
+        const vspChecksList = VSPChecksFactory.build();
+        const vspTestsMap = VSPTestsMapFactory.build();
+        const certificationChecked = VSPCertificationCheckedFactory.build();
+        const complianceChecked = VSPComplianceCheckedFactory.build();
+        let dummyFunc = () => {};
+        const version = {
+            name: 1
+        };
+        const softwareProductId = '1234';
+        const status = 'draft';
+        var obj = {
+            version: version,
+            softwareProductId: softwareProductId,
+            status: status,
+            softwareProductValidation: {
+                vspChecks: vspChecksList,
+                vspTestsMap: vspTestsMap,
+                certificationChecked: certificationChecked.certificationChecked,
+                complianceChecked: complianceChecked.complianceChecked,
+                activeTab: tabsMapping.SETUP
+            }
+        };
+        const store = storeCreator();
+        let softwareProductValidationView = TestUtils.renderIntoDocument(
+            <Provider store={store}>
+                <SoftwareProductValidationView
+                    {...obj}
+                    onErrorThrown={dummyFunc}
+                    onTestSubmit={dummyFunc}
+                    setVspTestsMap={dummyFunc}
+                    setActiveTab={dummyFunc}
+                    setComplianceChecked={dummyFunc}
+                    setCertificationChecked={dummyFunc}
+                />
+            </Provider>
+        );
+
+        expect(softwareProductValidationView).toBeTruthy();
+
+        // let goToInput = scryRenderedDOMComponentsWithTestId(
+        //     softwareProductValidationView,
+        //     'go-to-inputs'
+        // );
+        // expect(goToInput).toBeTruthy();
+        // TestUtils.Simulate.click(goToInput[0]);
+        // let goToInput = TestUtils.findRenderedDOMComponentWithClass(
+        //     softwareProductValidationView,
+        //     'go-to-inputs-btn'
+        // );
+        // TestUtils.Simulate.click(goToInput);
+    });
+});
diff --git a/openecomp-ui/test/softwareProduct/validationResults/SoftwareProductValidationResultsView.test.js b/openecomp-ui/test/softwareProduct/validationResults/SoftwareProductValidationResultsView.test.js
new file mode 100644
index 0000000..b2cc2c0
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/validationResults/SoftwareProductValidationResultsView.test.js
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2019 Vodafone Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { mapStateToProps } from 'sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResults.js';
+import SoftwareProductValidationResultsView from 'sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx';
+import { VSPTestResultsSuccessFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
+import { VSPTestResultsFailureFactory } from 'test-utils/factories/softwareProduct/SoftwareProductValidationResultsFactory.js';
+import TestUtils from 'react-dom/test-utils';
+
+describe('SoftwareProductValidationResults Mapper and View Classes', () => {
+    it('mapStateToProps mapper exists', () => {
+        expect(mapStateToProps).toBeTruthy();
+    });
+
+    it('mapStateToProps fail data test', () => {
+        const vspTestResults = VSPTestResultsFailureFactory.build();
+
+        var obj = {
+            softwareProduct: {
+                softwareProductValidation: {
+                    vspTestResults: vspTestResults.vspTestResults
+                }
+            }
+        };
+        var results = mapStateToProps(obj);
+        expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
+    });
+
+    it('mapStateToProps success data test', () => {
+        const vspTestResults = VSPTestResultsSuccessFactory.build();
+
+        var obj = {
+            softwareProduct: {
+                softwareProductValidation: {
+                    vspTestResults: vspTestResults.vspTestResults
+                }
+            }
+        };
+        var results = mapStateToProps(obj);
+        expect(results.softwareProductValidation.vspTestResults).toBeTruthy();
+    });
+
+    it('SoftwareProductValidationResultsView test fail render test', () => {
+        const vspTestResults = VSPTestResultsFailureFactory.build();
+
+        const version = {
+            name: 1
+        };
+        const softwareProductId = '1234';
+        var obj = {
+            softwareProductId: softwareProductId,
+            version: version,
+            softwareProductValidation: {
+                vspTestResults: vspTestResults.vspTestResults
+            }
+        };
+        let vspValidationResultsView = TestUtils.renderIntoDocument(
+            <SoftwareProductValidationResultsView {...obj} />
+        );
+        expect(vspValidationResultsView).toBeTruthy();
+    });
+
+    it('SoftwareProductValidationResultsView test success render test', () => {
+        const vspTestResults = VSPTestResultsSuccessFactory.build();
+
+        let version = {
+            name: 1
+        };
+        const softwareProductId = '1234';
+        var obj = {
+            softwareProductId: softwareProductId,
+            version: version,
+            softwareProductValidation: {
+                vspTestResults: vspTestResults.vspTestResults
+            }
+        };
+        let vspValidationResultsView = TestUtils.renderIntoDocument(
+            <SoftwareProductValidationResultsView {...obj} />
+        );
+        expect(vspValidationResultsView).toBeTruthy();
+    });
+});
