Group: LibreDWG/TestSuite

From LibrePlanet
Jump to: navigation, search
(XML based TestSuite)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
=== Test Suite for LibreDwg ===
 
=== Test Suite for LibreDwg ===
  
The aim of the Test Suite is to test the reading and writing capabilities of LibreDwg for various versions of DWG files.
+
The aim of the Test Suite is to test the reading and writing capabilities of LibreDwg for various versions of DWG files. The Test Suite is divided in four parts.
  
==== Test Suite using testSVG script. ====
+
1) The test-data: DWG and matching DXF files for all versions, some other data.
  
Test suite contains various dwg files. Each dwg file contains one single object like ''Line, Ray, Construction Line,'' etc.
+
2) dejagnu unit tests
  
Test Suite also contains a png file for each dwg file.
+
3) other unit tests
  
testSVG is script that converts a dwg file into a svg file.
+
4) XML Suite
  
When the Test Suite runs, it converts all dwg files into svg files. If there are errors in conversion, then an error file is created instead of svg file. Finally the result is seen in form of a webpage where the original PNG files are shown next to the svg file. If both appear similar then the test for that particular file is successful. In case of errors the error message is shown.
 
  
==== Running the testsuite ====
+
==== XML Suite ====
Copy testsuite folder in libredwg folder and run the script test.sh in it.
 
  
==== Viewing the results ====
+
XML suite contains various dwg files. Each dwg file contains one single object like ''Line, Ray, Construction Line,'' etc. XML Suite also contains a jpg file for each dwg file. All entity information of each file is stored in the form of text file. These text file were automatically generated by AutoLISP script. These text files are then converted into XML by a python script.
After running the test, a new results.htm file will be created. Open the file in a browser to view the results.
 
  
==== Limitations ====
+
Every DWG file will have a corresponding XML file. The XML file will have all properties of elements in DWG file.
SVG do not support many features that are available in DWG. Thus many features of DWG can not be tested using the current testsuite
 
 
 
==== XML based TestSuite ====
 
This is just an idea open for discussions.
 
Every DWG file used for test will have a corresponding XML file. The XML file will have all properties of elements in DWG file.
 
 
For Example
 
For Example
 
A DWG file with a single line with starting coordinate as (1.2354668,4.5698759,-12.567988), end coordinate as (-4.26648,56.5648985,54.567989), color as "red", lineweight as 2.25, layer as "LAYERNAME", linetype as "dotted", linetypescale as "1.25" and so on...
 
A DWG file with a single line with starting coordinate as (1.2354668,4.5698759,-12.567988), end coordinate as (-4.26648,56.5648985,54.567989), color as "red", lineweight as 2.25, layer as "LAYERNAME", linetype as "dotted", linetypescale as "1.25" and so on...
 
The xml file can have a strucutre as follows
 
The xml file can have a strucutre as follows
  
<source lang="xml">
+
<pre>
 
<?xml version="1.0" encoding='UTF-8'?>
 
<?xml version="1.0" encoding='UTF-8'?>
<DWGELEMENT>
+
<DwgEntity>
<line id="123456789" StartX="1.2354668" StartY="4.5698759" StartZ="-12.567988" EndX="-4.26648" EndY="56.5648985" EndZ="54.567989" Color="red" Lineweight="2.25" Layer="LAYERNAME" Linetype="dotted" Linetypescale="1.25" />
+
<line id="123456789" StartX="1.2354668" StartY="4.5698759" StartZ="-12.567988" EndX="-4.26648" EndY="56.5648985"  
</DWGELEMENT>
+
EndZ="54.567989" Color="red" Lineweight="2.25" Layer="LAYERNAME" Linetype="dotted" Linetypescale="1.25" />
</source>
+
</DwgEntity>
 +
</pre>
 +
 
 +
When the XML Suite is executed, the same DWG files are then read by a C Program which then outputs the XML in the same format as above. Then both the XML's are compared to generate the report regarding the support of LibreDWG for each format.
 +
 
 +
Current output of XML Suite is as follows:
 +
<pre>
 +
Output for 2000 Format
  
This xml file can be created manually or using a autolisp, VBA in Autocad
+
Circle.xml was read 20%
 +
 
 +
Attribute Details
 +
The value of radius is 5.25, It should be 5.2564
 +
...
 +
...
 +
</pre>
 +
 
 +
==== Unit Tests ====
 +
 
 +
DejaGNU has been used to write Unit Tests. Each file contains tests for specific group of functions. Each file has a corresponding EXP file which runs the tests. It is needed by DejaGNU as it depends on expect for the result. All these tests are executed when you run the testsuite. The result of Tests will be displayed in your terminal when you run TestSuite. The format would be similar to this
 +
<pre>
 +
# no of passes : 51
 +
# no of fails  : 5
 +
</pre>
 +
 
 +
==== TestSuite Requirements ====
 +
 
 +
TestSuite requires the following packages to be installed. Just execute the following command in terminal
 +
<pre>
 +
sudo apt-get install dejagnu libxml2 libxml2-dev python-libxml2
 +
</pre>
 +
 
 +
==== Running the testsuite ====
 +
 
 +
To run the testsuite, you just have to run <pre>make check</pre>. It will first run the XML Suite and then execute the Unit Tests.
 +
 
 +
==== Viewing the results ====
 +
 
 +
After running the test, the results of the unit tests will be displayed in your terminal in the end. The result of the XML Suite will be displayed on the terminal as well as an HTML file will be created. The terminal output doesn't contains information about attributes mismatch. The HTML file will display the detailed result. Open the HTML in the browser to view the result.
 +
 
 +
==== Limitations ====
  
The testSVG script can be modified to generate an XML file as above. The XML file generate by testSVG can be comapred with the XML from the TESTSUITE which was created manually or using a autolisp, VBA in Autocad. If both the XML files are matching then the reading capabilities of LibreDwg for that particular drawing file is OK.
+
Many of the attributes don't match and there is no information regarding them. The HTML Result generated contains only result of XML Suite. DejaGNU has not provision to output html file.

Latest revision as of 04:12, 25 June 2018

Test Suite for LibreDwg

The aim of the Test Suite is to test the reading and writing capabilities of LibreDwg for various versions of DWG files. The Test Suite is divided in four parts.

1) The test-data: DWG and matching DXF files for all versions, some other data.

2) dejagnu unit tests

3) other unit tests

4) XML Suite


XML Suite

XML suite contains various dwg files. Each dwg file contains one single object like Line, Ray, Construction Line, etc. XML Suite also contains a jpg file for each dwg file. All entity information of each file is stored in the form of text file. These text file were automatically generated by AutoLISP script. These text files are then converted into XML by a python script.

Every DWG file will have a corresponding XML file. The XML file will have all properties of elements in DWG file. For Example A DWG file with a single line with starting coordinate as (1.2354668,4.5698759,-12.567988), end coordinate as (-4.26648,56.5648985,54.567989), color as "red", lineweight as 2.25, layer as "LAYERNAME", linetype as "dotted", linetypescale as "1.25" and so on... The xml file can have a strucutre as follows

<?xml version="1.0" encoding='UTF-8'?>
<DwgEntity>
<line id="123456789" StartX="1.2354668" StartY="4.5698759" StartZ="-12.567988" EndX="-4.26648" EndY="56.5648985" 
EndZ="54.567989" Color="red" Lineweight="2.25" Layer="LAYERNAME" Linetype="dotted" Linetypescale="1.25" />
</DwgEntity>

When the XML Suite is executed, the same DWG files are then read by a C Program which then outputs the XML in the same format as above. Then both the XML's are compared to generate the report regarding the support of LibreDWG for each format.

Current output of XML Suite is as follows:

Output for 2000 Format

Circle.xml was read 20%

Attribute Details
The value of radius is 5.25, It should be 5.2564
...
...

Unit Tests

DejaGNU has been used to write Unit Tests. Each file contains tests for specific group of functions. Each file has a corresponding EXP file which runs the tests. It is needed by DejaGNU as it depends on expect for the result. All these tests are executed when you run the testsuite. The result of Tests will be displayed in your terminal when you run TestSuite. The format would be similar to this

# no of passes : 51
# no of fails  : 5

TestSuite Requirements

TestSuite requires the following packages to be installed. Just execute the following command in terminal

sudo apt-get install dejagnu libxml2 libxml2-dev python-libxml2

Running the testsuite

To run the testsuite, you just have to run

make check

. It will first run the XML Suite and then execute the Unit Tests.

Viewing the results

After running the test, the results of the unit tests will be displayed in your terminal in the end. The result of the XML Suite will be displayed on the terminal as well as an HTML file will be created. The terminal output doesn't contains information about attributes mismatch. The HTML file will display the detailed result. Open the HTML in the browser to view the result.

Limitations

Many of the attributes don't match and there is no information regarding them. The HTML Result generated contains only result of XML Suite. DejaGNU has not provision to output html file.