Date post: | 06-Apr-2018 |
Category: |
Documents |
Upload: | krishna-gupta |
View: | 216 times |
Download: | 0 times |
of 62
8/3/2019 SQAAssignment
1/62
SQA Assignment
Topic used: XML DBMS
By:Aditya Pancholi (02)
Barkha Sain (08)
8/3/2019 SQAAssignment
2/62
Introduction (History Behind)
The project selected is XML-DBMS createdby Aditya Pancholi, Shefali Sharma andPrerna Gupta as an assignment alloted by
their DBMS instructor, Mrs V. Kulkarni intheir 2nd semister.
As XML-DBMS was a totally new area,never studied before, most of the time wasspent on learning the concept and lesstime was devoted for implementation.
8/3/2019 SQAAssignment
3/62
Requirement Specification(First Meeting)
Design a XML-DBMS
I would like you to use of Xpath or X-query
It needs to be submitted by the end ofthe semester.
I would like you to implement it in Java It is expected to have some basic
minimum functionality.
8/3/2019 SQAAssignment
4/62
Requirement Specification(Second Meeting)
It will be good if it provide basic featureslike create table, drop table, insert intotable, delete from table, update table etc.
Select is most important thing expected. Java provides features for XML
processing, and I am more comfortable in
Java (and not with C++) so I want you tomake it in Java
8/3/2019 SQAAssignment
5/62
Requirement Analysis andFeasibility Study
Time Constraint = Greatest Factor.
Less Comfort level in Java as comparedto Python and C++.
Little or No knowledge aboutimplementation of XML in Java.
Tutorials available on internet.
Help and guidance available from V.K.Mam.
8/3/2019 SQAAssignment
6/62
Requirement Analysis andFeasibility Study (Contd.)
Xpath or Xquery ??
Xpath : Less features, Harder to Use but easierand more developed libraries in Java.
Xquery : More features, Simpler to use thanXpath but less developed libraries in Java.
Insert, Drop, Create can be implemented.
Select can be implemented too.But Update and Delete cant be implementeddue to technical reasons.
8/3/2019 SQAAssignment
7/62
Requirement Analysis andFeasibility Study (Contd.)
Parsing cant be done. Input will be in formof Xpath and XML. As user is comfortablewith both, so not a big issue.
8/3/2019 SQAAssignment
8/62
Requirement Freezing
Deadline Accepted.
Decided that Java will be used asprogramming language.
Update and Delete not to beimplemented.
Xpath to be used for Selection
Parser not to be implemented.
8/3/2019 SQAAssignment
9/62
Designing
Objective
The aim is to simulate an XML Database
Management System. An XML database isa data persistence software system thatallows data to be stored in XML format.
8/3/2019 SQAAssignment
10/62
Designing (contd.)
8/3/2019 SQAAssignment
11/62
Designing (contd.)
Project Specifications
Language Used : Java, Xpath
Platform : Windows/ Linux
Libraries (Main) : Java awt, Java swing, JAXP(Java API for XML Processing)
Interface : It will be a GUI. A window will beopened where there will be a space for writingqueries and a space for output.
8/3/2019 SQAAssignment
12/62
Designing (contd.)
8/3/2019 SQAAssignment
13/62
Designing (contd.)
Assumptions
Valid data-types are string and number
There are no constraints implemented inthe program
It is assumed that system memory is bigenough that the whole DOM tree can fitinto memory.
8/3/2019 SQAAssignment
14/62
Designing (contd.)
Commands accepted are create, insert, dropand select. create, insert and drop are in form ofxml while select is in form of xpath.
It is assumed that the operator has some ideaabout XML and Xpath.
The limitations of Java libraries over
implementation of Xpath and Dom holds true.These limitations and over complications can beseen well in the code. It is assumed that inputare such that do not violate these limitations.
8/3/2019 SQAAssignment
15/62
Designing (contd.)
Flow of Control
The user will get a GUI interface. When the user willinput the query in the query box and then click onexecute button. The query will go to the parser
component which will check the syntax of the query andthen converts the correct query into the XML query form.This goes to the Query analyzer which will check thesyntax of the XML query. It sends the correct XML queryto the query processor. This component first checks the
semantics of the query and then processes the queryusing XPath on the DOM tree of the database and thenreturns the output. This output goes to the output area ofthe GUI window.
8/3/2019 SQAAssignment
16/62
Designing (contd.)
8/3/2019 SQAAssignment
17/62
Designing (contd.)
Storage structure
The basic idea is to store one table in a XML file. In factfor every table, two files will be used. One file will be
storing the meta data. That is information aboutattributes, like their name, data type, constraints etc.This itself will be in XML format.
The other file will store the data ( i.e tuples of the table).
This data will be consistent with the information in themeta data. That is before making any entry into the datafile, we need to check for its consistency with the metadata file.
8/3/2019 SQAAssignment
18/62
Designing (contd.)
All the files are stored into one folder. This foldercorresponds to the database. If we have tomaintain multiple databases, we can extend theconcept to having a one folder for each
database, stored in a folder that correspondingto complete packing.
When ever we create a table using a create( )
command, both the files will be created. Metadata file will be filled with the information aboutthe information provided along with the create ( )command.
8/3/2019 SQAAssignment
19/62
Designing (contd.)
Data Flow Diagrams
8/3/2019 SQAAssignment
20/62
Designing (contd.)
Level-1 DFD
8/3/2019 SQAAssignment
21/62
Designing (contd.)
Level-2 DFD
8/3/2019 SQAAssignment
22/62
Risk Analysis (Before Coding)
Project may not complete on timeseverity : Very Highlikelihood : Low
risk level : Apossible causes : Java the devil.
low skill of developers.
measures : No time to waste.Study work needs to be
be done in parallel.
8/3/2019 SQAAssignment
23/62
Risk Analysis (Before Coding)(contd.)
Some unforeseen functionality issuecaused by Java
severity : High
likelihood : Highrisk level : Apossible causes : Java the devil.measures : some other method to be
used to solve that.use of C or Python within
java code
8/3/2019 SQAAssignment
24/62
8/3/2019 SQAAssignment
25/62
Coding
8/3/2019 SQAAssignment
26/62
Risk Analysis (While Coding andAfter Coding)
Am I doing write thing ?Severity : Very HighLikelihood : Very LowRisk level : B
Possible causes : lack of requirements,wrong interpretationMeasures : proper requirement
specification and properdiscussion with coder regarding
requirements.Mitigation : Immediate Stop, Re-discuss therequirements and consider the design againand code again
8/3/2019 SQAAssignment
27/62
Risk Analysis (While Coding andAfter Coding) (contd.)
Am I doing thing efficiently ?Severity : LowLikelihood : HighRisk level : B
Possible causes : Java the evil, lack of skill,lack of timeMeasures : maintaining quality from
beginning and doing qualitychecks
Mitigation : Re-discuss the efficiency issuesand try to improve with minimumchanges
8/3/2019 SQAAssignment
28/62
Testing
Black BoxCause Effect GraphEquivalence Partitioning
White BoxBranch and Path Coverage
Date Flow Testing.
8/3/2019 SQAAssignment
29/62
Black Box testing
8/3/2019 SQAAssignment
30/62
Cause Effect Graph
GUI :
Query is placed in the Query text-box. WhenExecute button is pressed, input is passed tothe program, where it is processed and result (orerror) is displayed on Output box. Clear buttonis used for clearing the input text-box.
8/3/2019 SQAAssignment
31/62
Cause Effect Graph (contd.)
Causes :C1 : Valid Query is written in Query text
box.
C2 : Execute button is pressed.C3 : Clear button is pressed.Effects :
A1 : Output is displayed.A2 : Error is displayed.A3 : Query text box is cleared.
8/3/2019 SQAAssignment
32/62
8/3/2019 SQAAssignment
33/62
Cause Effect Graph (contd.)
8/3/2019 SQAAssignment
34/62
Cause Effect Graph (contd.)
A1 = C1 & C2
A2 = ~C1 & C2
A3 = C3
8/3/2019 SQAAssignment
35/62
8/3/2019 SQAAssignment
36/62
Cause Effect Graph (contd.)
Test Cases:
Test Cases Input Query ExecuteButton
Clear Button ExpectedOutput
1Valid Query Output +
Input Box Cleared
2 Valid XQuery Output
3 Valid X Input Box Cleared
4 Valid X X No state Change
5 Invalid Error Message
6 Invalid X Error Message
7 Invalid X Input Box Cleared
8 Invalid X X No state Change
8/3/2019 SQAAssignment
37/62
Equivalence Partitioning
In order to select , the format isxpath
4-char keyword can be NUBR or STRG orBOOL or NDST.
query = xpath query
Output = valid output or an error.
8/3/2019 SQAAssignment
38/62
Equivalence Partitioning (contd.)
Let us consider the input string as a set ofinput substrings
Input substring1 : first label {xpath}
Input substring2 : 4 char keywordInput substring3 : DB-name
Input substring4 : Xpath Query
Lets consider all set of possible inputs tothese.
8/3/2019 SQAAssignment
39/62
8/3/2019 SQAAssignment
40/62
Equivalence Partitioning (contd.)
Possible Inputs for substring3
Valid database name (existing one)
Invalid name (non-existing database)
Null
Possible Inputs for substring4
Syntactically invalid query
Syntactically valid query but semantically invalid query
Syntactically and semantically valid query
Null
8/3/2019 SQAAssignment
41/62
Equivalence Partitioning (contd.)
We cant consider all input partitions as there will be 215
possible cases.
Possible Outputs
Output as a Number Output as a String
Output as a Boolean Value
Output as a Node Set
Error message
We club cases together to get a smaller set of partitions.
8/3/2019 SQAAssignment
42/62
Equivalence Partitioning (contd.)
Test cases (Input)
1) Substring1 is not xpath. Rest of the substrings can take any value.2) Substring1 is xpath and substring3 is not a valid database name.3) Substring1 is xpath and substring3 is valid database name, substring2 is
not one of the four valid keywords
4) Substring1 is xpath and substring3 is valid database name, substring2 isone of the four valid keywords but substring4 is a query with invalidsyntax.
5) Substring1 is xpath and substring3 is valid database name, substring2 isone of the four valid keywords but substring4 is a query with valid syntaxbut invalid semantics.
6) Everything is valid, Substring2 is NUBR7) Everything is valid, Substring2 is STRG8) Everything is valid, Substring2 is BOOL9) Everything is valid, Substring2 is NDST
8/3/2019 SQAAssignment
43/62
Equivalence Partitioning (contd.)
Test cases (Output)
10) Output is a number
11) Output is a string12) Output is a Boolean value
13) Output is a Node set
14) Output is error message
8/3/2019 SQAAssignment
44/62
Equivalence Partitioning (contd.)
Test casesTest case 1 2 3 4 5
Substring1 xpathe xpath xpath xpath xpath
Substring2 NUBR NUBR NUB NUBR NUBR
Substring3 Students Stud Students Students Students
Substring4 count(/rows/row)
count(/rows/row)
count(/rows/row)
_rows_row /rows/row
ExpectedOutput
ErrorMessage
ErrorMessage
ErrorMessage
ErrorMessage
ErrorMessage
8/3/2019 SQAAssignment
45/62
Equivalence Partitioning (contd.)
Test cases (contd.)
Test case 6 7 8 9
Substring1 xpath xpath xpath xpath
Substring2 NUBR STRG BOOL NDST
Substring3 Students Students Students Students
Substring4 count(/rows/row)
/rows/row[1]/column[@name=na
me]/@value
count(/rows/row) ==1
/rows/row[1]
ExpectedOutput
8 aditya False Whole firstrow
8/3/2019 SQAAssignment
46/62
Equivalence Partitioning (contd.)
Test cases (contd.)
Test case 10 11 12 13 14
Substring1 xpath xpath xpath xpath xpathe
Substring2 NUBR STRG BOOL STRG NUBR
Substring3 Students Students Students Students Students
Substring4 count(/rows/row)
/rows/row[1]/column[@name=na
me]/@value
count(/rows/row) ==1
/rows/row /rows/row
ExpectedOutput
8 aditya False all rowsprinted
ErrorMessage
8/3/2019 SQAAssignment
47/62
White Box testing
8/3/2019 SQAAssignment
48/62
Branch and Path Coverage Testing
0public void pushInput (Object obj)1{2 Document doc = xmlComponent.getDocumentFromString (obj.toString (), "query");3 if (doc != null)4 {5 String queryType = xmlComponent.getStringFromXPath (doc, "name (/query/child::*[1])");6 if (queryType.equals ("createTable"))7 {8 String tableName = createTable (doc);9 sendOutput ("Table : '" + tableName + "' successfuly created...");10 }11 else if (queryType.equals ("dropTable"))12 {13 String tableName = dropTable (doc);14 sendOutput ("Table : '" + tableName + "' successfuly dropped...");15 }16 else if (queryType.equals ("insert"))17 {18 String tableName = insertIntoTable (doc);19 sendOutput ("Data successfuly inserted into table : '" + tableName + "'");20 }
21 else22 {23 sendOutput ("Not implemented yet...");24 }25 }26 else27 {28 sendErrorMessage ("Error in parsing Xml.");29 }30}
8/3/2019 SQAAssignment
49/62
Branch and Path Coverage (contd.)
8/3/2019 SQAAssignment
50/62
Branch and Path Coverage (contd.)
Test Cases
1) Obj passed is such that its Dom tree isnull.
Path covered = 0,1,2,3,4,26,27,28,29,30
Statement Coverage : 10/31 = 32.26%
Branch Coverage : 01/08 = 12.25%Path coverage : 01/05 = 20.00%
8/3/2019 SQAAssignment
51/62
Branch and Path Coverage (contd.)
Test Cases (contd.)
2) Obj passed is such that its Dom tree is not nulland its first child is createTable.
Path covered = 0,1,2,3,4,5,6,7,8,9,10,25,29,30
Statement Coverage : 14/31 = 45.16%
Branch Coverage : 02/08 = 25.00%Path coverage : 01/05 = 20.00%
8/3/2019 SQAAssignment
52/62
Branch and Path Coverage (contd.)
Test Cases (contd.)
3) Obj passed is such that its Dom tree is not nulland its first child is dropTable.
Path covered =0,1,2,3,4,5,6,7,11,12,13,14,15,25,29,30
Statement Coverage : 16/31 = 51.61%Branch Coverage : 03/08 = 37.5%
Path coverage : 01/05 = 20.00%
8/3/2019 SQAAssignment
53/62
Flow Graph (contd.)
Test Cases (contd.)
4) Obj passed is such that its Dom tree is not nulland its first child is insertIntoTable.
Path covered =0,1,2,3,4,5,6,7,11,12,16,17,18,19,20,25,29,30
Statement Coverage : 18/31 = 58.06%Branch Coverage : 04/08 = 50.00%
Path coverage : 01/05 = 20.00%
8/3/2019 SQAAssignment
54/62
Flow Graph (contd.)
Test Cases (contd.)
5) Obj passed is such that its Dom tree is not nulland its first child is joinTable.
Path covered =0,1,2,3,4,5,6,7,11,12,16,17,21,22,23,24,25,29,30
Statement Coverage : 19/31 = 61.29%Branch Coverage : 04/08 = 50.00%
Path coverage : 01/05 = 20.00%
8/3/2019 SQAAssignment
55/62
8/3/2019 SQAAssignment
56/62
Data Flow Testing
0protected void1parseAndSend (String str)2{
3if (str.equals ("") == false)4{
5if (str.indexOf ("xpath") == 0)6{
7String rest = str.substring (11);8int nextSpace = rest.indexOf (" ");9String tablename = rest.substring (0, nextSpace);10String xpathExpression = rest.substring (nextSpace + 1);11String tableData = configuration.getDataDirectory () + "/" + tablename + "/data.xml";
12Document tableDoc = xmlComponent.getDocumentFromFile (tableData);13String type = str.substring (6, 10);14if (type.equals ("NUMR"))15{
16Double number = xmlComponent.getDoubleFromXPath (tableDoc, xpathExpression);17flowController.pushOutput ("parserXPathResultOutputAOPipe", number);
18}
19else if (type.equals ("STRG"))20{
21String strVal = xmlComponent.getStringFromXPath (tableDoc, xpathExpression);22flowController.pushOutput ( "parserXPathResultOutputAOPipe", strVal);
23}
24else25{
26flowController.pushOutput ("parserErrorAOPipe", "Unknown XPath type : " + type);27}28}
29else30{
31flowController.pushOutput ("parserOutputAOPipe", str );32}
33else
34{
35flowController.pushOutput ("parserErrorAOPipe", "Empty strings not accepted !");36}37}
8/3/2019 SQAAssignment
57/62
Data Flow Testing (contd.)
Variables :strrestnextSpace
tablenamexpathExpressiontableDatatableDoc
typenumberstrVal
8/3/2019 SQAAssignment
58/62
Data Flow Testing (contd.)Variable definition P-use C-use
str 1 3,5 7,13,31
rest 7 8,9,10
nextSpace 8 9
tablename 9 11
xpathExpression 10 16,21
tableData 11 12
tableDoc 12 16,21
type 13 14,19 26
number 16 17
strVal 21 22
8/3/2019 SQAAssignment
59/62
Data Flow Testing (contd.)
du-pairs
[1,3] &[1,5] : p-use of str[1,7], [1,13] &[1,31] : c-use of str[7,8], [7,9] & [7,10] : c-use of rest
[8,9] : c-use of nextspace[9,11] : c-use of tablename[10,16] &[10,21] : c-use of xpathExpression[11,12] : c-use of tableData[12,16] &[12,21] : c-use of tableDoc
[13,14] & [13,19] : p-use of type[13,26] : c-use of type[16,17] : c-use of number[21,22] : c-use of strVal
8/3/2019 SQAAssignment
60/62
Data Flow Testing (contd.)
Test Cases (All p-use)
Test-case variable du-pair subpaths input (str) outputs
(pushoutput)
1 str [1,3] 1,2,3 "Empty stringsnot accepted !"
2 str [1,5] 1,2,3,4,5 xpath NUBRstudents
count(/rows/row)
8
3 type [13,14] 13,14 xpath NUBRstudents
count(/rows/row)
8
4 type [13,19] 13,14,15,19
or
13,14,15,16,
17,18,19
xpath STRGstudents
/rows/row[1]/column[@name=name]/@value
aditya
8/3/2019 SQAAssignment
61/62
Data Flow Testing (contd.)
Test Cases (All c-use)
There are many , we show only for 1 varaiable str.
Test-case variable du-pair subpaths input (str) outputs(pushoutput)
1 str [1,7] 1,2,3,4,5,6,7 xpath NUBRstudents
count(/rows/row)
8
2 str [1,13] 1-13 xpath NUBRstudents
count(/rows/row)
8
3 str [1,31] 1-6,29-31
8/3/2019 SQAAssignment
62/62