Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

testing-framework

No description
by

Ryan Wettlaufer

on 10 October 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of testing-framework

How to create a test script with the provided test-framework.



Writing your own test-actions.
Table of Contents:
Testing Services Provided:
There are several services which can be tested by creating a JSON or Excel file with the correct format/ valid actions.
Writing your own Test-Actions
Running Your Test
OSGi
How to create a OSGi Test(JSON):
Example: Test Creation of a Office.
Sheet 1: setup
Where to place the
Excel // JSON file?
You may choose one way or even combine them!
File Naming Convention
3 Key Words:
'setup'
This is where you build the entities / objects that are needed to create the entity being tested.
ex. (every office needs a firm to belong to)




'test'
This is where the information for the entity / object you are testing is placed.



'teardown'
This portion of the test is where you have the option to clean up the objects / entities you have created in the database.
The first row of data must establish what
action
is going to be created.
The second row will contain a unique
description
of the testing action being carried out
Objects within objects
like MailingAddress must provide the object name and the parameters you are trying to provide values for, separated by a period.

end
- this is the keyword that establishes the end of one test action.
Sheet 1 of 3
How to create a Test(EXCEL):
Sheet 2: test
Sheet 2 of 3
How to create a Test(EXCEL):
How to create a Test(EXCEL):
Sheet 3: teardown
Sheet 3 of 3
The first row of data must establish what action is going to be created.
The second row will contain a unique description of the testing action being carried out

end - this is the keyword that establishes the end of one test action.

The entities / objects that someone wants to test will be constructed on this sheet .
The first row of data must establish what action is going to be created.

The second row will contain a unique description of the testing action being carried out

end - this is the keyword that establishes the end of one test action.

The entities / objects created get cleaned up with the information sent on the third and final sheet of the excel sheet.
First Way:
The testing-framework will first seek for test scripts in the resources/test-scripts/ folder.
PATH: /test-framework/src/main/resources/test-scripts/
You may add your .json / .xlsx file here as long as it follows the naming convention.

(Follow naming convention(next slide))
Second Way:
The testing-framework then looks for a file named 'test_config.json' within the test folder.
test_config.json contains two types of information:
the direct path to the .json/.xlsx test script
the order in which the test action will be called based on naming convention.
Testing Framework
by
Ryan Wettlaufer
&
Rob Philipp

Test-Script Folders:
Must start with a '
t
' (stands for test-script).
Provide the order in which you want the tests to be run via sequential numbering. (separated by one underscore)
Must place
TWO
underscores before you give your test script an actual name.
After the test name, you must provide either .osgi or .rest or both!
This lets the framework know whether to use the
REST
test cases or
OSGi
test cases.
Test-Script Folders
File Naming Convention
Test-Action Files:
Must start with a '
a
' (stands for action).
Provide the order in which you want the actions to be run via sequential numbering. (separated by one underscore)
Must place
TWO
underscores before you give your test action a name.
After the test name, you must provide either .osgi or .rest or both!
This lets the framework know whether to use the
REST
test cases or
OSGi
test cases.
Test-Actions
Part 1
File Naming Convention
Test-Actions
Part 2
test_config.json:
First JSON element must be '
references
'.

Provide correctly named test action.
This makes sure the test actions are in the correct order.

Provide the path to where the .json // .xlsx file is located.
You can run OSGi tests by opening the OsgiDynamicTestScript located:
/osgi-tests/src/test/java/com/investcloud/test/framework2/osgi/OsgiDynamicTestScript.java
Run this test script as a junit test and if your test-script / actions are named properly it execute the test actions.
Running Your Test
OSGi (debug-mode)
In the OsgiDynamicTestScript there is a option to turn debugging on and off.
When the debug mode is on, the OsgiDynamicTestScript should be launched the normal way. (run as J-Unit Test)
You should see this in the console.
Now you must run your
remote debug java test application
. (Make sure the port is set to
5005
)
Hit
debug
and you are ready to go!
Running Your Test
REST
To run REST tests you must start up service mix manually.
Once service mix is running, you can open the RestDynamicTestScript.java located:
/integration-tests/src/test/java/com/investcloud/test/framework2/rest/RestDynamicTestScript.java
Run this test script as a junit test and the test-framework will run all of the test actions that have .rest in the name.
To
debug
, just click debug as instead of run as.
TestActionData
1.) Create the TestActionData class, which derives from the AbstractTestActionData class.
Steps:
1.) Create TestActionData class

2.) Create TestActionDataFactory class

3.) Create TestAction class

4.) Create Decorator class

5.) Add TestActionData object to the data map

6.) Add the test action to the AbstractDynamicTestScript
This class defines the parameters, or business data needed to perform the desired test action.
TestActionDataFactory
2.) Create the TestActionDataFactory class, which derives from the TestActionDataFactory class.
Creates a TestActionData class.
TestAction
3.) Create the TestAction class which derives from the AbstractTestAction<T extends TestActionData> class.

This is where the actual test operation is being carried out.
This class is specific to the type of service being tested. therefor you will need to create a class for each service type. (OSGI // REST)
Decorator
4.) Create the Decorator class which derives from the AbstractDecorator.

The Decorator class is responsible for taking a TestActionData object and creating a TestAction for it.
This class is specific to the type of service being tested. therefor you will need to create a class for each service type. (OSGI // REST)
TestActionData
5.) Add your TestActionData object to the map which associates it with a Decorator. You will need to do this in the
OsgiDynamicTestScript
and the
RestDynamicTestScript
classes.
Add Action to REST or OSGi DynamicTestScript
6.) Add the name of your test action to the map in the DynamicTestScript that corresponds with the test type you are running, which will associate it to your TestActionDataFactory.
Rob's guide to implementing a Test Case:
https://confluence.investlab.com/display/DEV/Implementing+a+Test+Case
Full transcript