SOFA Test
SOFA Test
SOFA Test
SOFA Testing
1. iTest
Introduction
2. Get Started
iTest
3. Common
Syntax
4. Best Practices
5. Junit in SOFA WWW.DANA.ID
iTEST Introduction
iTest is an automation framework developed by Alipay. In iTest there are test logic and test data that are
separated.
The test logic is divided into various components.
The test data composed and stored by yaml files and csv files
WWW.DANA.ID
Cont’d
Test case = Test logic + test data
Test Data
WWW.DANA.ID
Cont’d
WWW.DANA.ID
Get Started iTest
1. To create iTest, we can start it using iTest plugins or create the required files manually.
• Eclipse Edition
online mode :
add update site http://jarvis-storage-file-test.cn-hangzhou.alipay-pub.aliyun-
inc.com/intl/plugin/eclipse/itesthelper
offline mode:
Helper --> Install New Software --> Add respository(select zip file ) --> next --> finish -->restart
WWW.DANA.ID
Cont’d
2. To create iTest, we can start it using iTest plugins or create the required files manually.
WWW.DANA.ID
Common Syntax
Example
WWW.DANA.ID
Cont’d
Component type :
result= ccprepare:SamplePrepare?
value=‘Dormamu, I’ve come to bargain’
cccheck:SampleCheck?expectValue=‘abcd’
WWW.DANA.ID
Cont’d
WWW.DANA.ID
Cont’d
WWW.DANA.ID
Cont’d
• Velocity – support velocity syntax to get and set value on data.yaml and logic.yaml
Example:
merchantId: ${merchantId}
userId: $orderCreateRequest.order.seller.userId
orderId: $!vu.get32RandomId()
• !import – import other yaml content to current location
Syntax : !import filepath@key
Example:
envInfo: !import testres/ccprepare/EnvInfo.yaml@default
WWW.DANA.ID
Cont’d
BatchTestStarter
1. Scan. Scan and load all *.data.yaml, *.logic.yaml
2. Assemble. Assemble each (dataId, logicId) to TestCase
3. Execute. Execute every TestCase.
SpecificTestStarter
1. Only run the specific testcase in the file resources/testcase/specificTest.list
2. Or run the specific testcase assigned in listTestCases() method
WWW.DANA.ID
Cont’d
TestContext
WWW.DANA.ID
Cont’d
Best Practice Summarize
• Use plugin to write test case as far as possible, it will help to increase efficiency and reduce
unknown exception and bug.
• Use Standard components which imported by itest-config.xml as far as possible.
• Place all related files (such as logic.yaml 、 data.yaml 、 db-*.csv 、 *.yaml) together inside
testcase catlog like this:
• View test results and analysis test logs on ITest Manage Platform.
WWW.DANA.ID
Junit Test
1. Adding Java class for testing
2. Adding Bean config using xml
Default
location for
Junit test
Default
location for
Bean Config
WWW.DANA.ID
Cont’d
Adding Java class for testing
WWW.DANA.ID
Cont’d
Adding bean config using xml
WWW.DANA.ID