[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios

54
A Framework for Automatic Construction of Test Scenarios from Use-cases VU Y. NGUYEN 1 , THO T. QUAN 1 , NHUAN D. LAI 2 AND THUAN D.LE 1 1 HOCHIMINH CITY UNIVERSITY OF TECHNOLOGY 2 LARION COMPUTING

Transcript of [HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios

A Framework for Automatic Construction of Test Scenarios

from Use-cases VU Y. NGUYEN1, THO T. QUAN1,

NHUAN D. LAI2 AND THUAN D.LE1

1 HOCHIMINH CITY UNIVERSITY OF TECHNOLOGY

2LARION COMPUTING

Outline

• Introduction

• Motivation

• FATS

– Use-Case Presentation

– Activity Graph Construction

– Testing Scenario Development

• Practical Status

• Conclusion

3

Introduction

Checking the correctness

• Hard

• Expensive

• Manually

Testing

• Static analysis

• False alarms

Code inspection

Testing

• Testing is more popular than code inspection.

• A test case contains a set of

– Inputs

– Execution conditions

– Desired outputs.

Problem

• The test case generation is costly.

• Automatic solutions are specified on complex mathematical models which are difficult to be applied in real industry.

7

Motivation

Motivation

• Try to generate test scenarios

– Automatic

– Simple

– Can be applied in industry

• Solution

– Generate test case from use-cases

Use case example

Motivation

• UMLs in the real industry world

– Widely used in the specification

– Do not strictly follow the UML standard

Use-case flow

• Normal

Use-case flow

• Normal

• Exception

Use-case flow

• Normal

• Exception

• Fork

Activity Diagram

Motivation

• Create test scenarios from use-cases

– Problem: • Difficult to be translated directly automatically

• Complex due to natural language processing

– Solution: • Create an intermediate language for describing the Use-

cases scenarios

• Easily to handle by the computer

• Friendly to end users

17

Framework for Automated Testing Scenarios

The FATS framework

• Framework for Automated Testing Scenarios

Use-cases Presentation

Activity Graph Construction

Testing Scenario

Development

19

Use-cases Presentation

Use-cases Presentation

• Presented in a formal form which is not only machine-understandable for automatic processing but also friendly for end-user to handle

• Use specific markup language

– Consist of fundamental elements

– Use a pair of opening and closing tags for each use-case elements

Ví dụ - Use case

• ID: 1, Name: Tìm khóa học, Create By: Ngọc Vinh, Date Created: 22/12/2010, Actor: Học viên, Description: Tìm kiếm khóa học trung tâm (các thành phần còn lại để trống).

• BasicFlow: 1. Học viên đăng nhập vô hệ thống 2. Học viên đánh tên khóa học vào ô tìm kiếm 3. Bấm nút "search"

• Decision 1 a. If có khóa học với tên đã cho, hệ thống hiển thị tất cả các khóa học tương ứng Go to step 4 b. If không có khóa học với tên đã cho, hệ thống hiển thị dòng chữ "không tìm thấy". Go to step 5 • 4. Học viên chọn một khóa học để xem • 5. End the flow

<UseCase> <Id>1</Id> <Name>Tìm khóa học</Name> <Creator>Ngọc Vinh</Creator> <DateCreated>22/12/2010</DateCreated> <LastUpdate> </LastUpdate> <LastDayUpdate> </LastDayUpdate> <Actor>Học viên</Actor>

<Goal>

</Goal>

<Description>Tìm kiếm khóa học của trung tâm</Description>

<PreCondition>

</PreCondition>

<PostCondition>

</PostCondition>

<Includes>

</Includes>

Ví dụ XML

<BasicFlow> <Flow> <Go id="1">Học viên đăng nhập vào hệ thống</Go> <Go id="2">Học viên đánh tên khóa học vào ô tìm kiếm</Go> <Go id="3">Bấm nút "search"</Go> <Decision id="D1"> <Branch id="1" condition="có khóa học với tên đã cho"> <Go id="3.a">hệ thống hiển thị tất cả các khóa học tương ứng</Go> <Go parameter="4"> </Go> </Branch>

<Branch id="2" condition="không có khóa học nào với tên đã cho"> <Go id="3.b">hệ thống hiển thị dòng chữ "không tìm thấy".</Go> <Go parameter="5"> </Go> </Branch> </Decision> <Go id="4">Học viên chọn một khóa học để xem</Go> <Go id="5">End the flow</Go> </Flow> </BasicFlow> <AlternativeFlows /> <ExceptionFlows /> </UseCase>

Ví dụ XML

Example

• Use-cases: Search event functionality

“When user selects search events on web page, the system will present an appropriate page. If user chooses a date without any event, the system shows “No event”. Otherwise, the system shows a page with events for that date, giving time and event name.”

Form Flow

Form

Form

Form

Form

Form

Form

Highlight error

Highlight error

Highlight Error

Highlight Error

Save load use-case

39

Activity Graph Construction

Activity Graph

Transition table

Activity Graph

43

Testing Scenario Development

Basic Path

• Basic paths are execution paths which loops are executed 1 time at most.

• Example:

– Path 1: 1 2 3 4 5 9.

– Path 2: 1 2 3 4 6 7 8 9.

Test scenarios generation

• Combination of graph traversal and white-box analysis techniques

• Restrict to basic-paths only

Test scenarios

48

Practical status

Practical Status

• Applied in LARION Computing

• Implemented as an internal helper tool for generating test case scenarios

50

Conclusion

Pros

• Development of test scenarios from use-cases in an automatic manner

• Markup languages to make the use-cases understandable by computer programs

• Do not need to generate test scenarios from activity diagram

• Experiment results are promising.

Cons

• Use-case diagrams do not cover all system behaviors due to use-case-composers.

• Not convenient for traditional users

Future works

• GUI-based editor

• Improve automatic process by parsing strict English in use-case descriptions

© 2014 HCMC Software Testing Club

Thank you