Share and open source a simple and crude redmine Test Report System

Source: Internet
Author: User
Tags redmine
Background

The last tedious task of software testing is to compile a test report. Handwritten test reports consume a lot of time and effort in data statistics and analysis. Previously, the studio used mantis to manage bugs. The company has an internal system that can directly obtain data from mantis and conduct statistics to generate a test report. Later I changed to a studio, and the Bug Management Platform also changed from mantis to redmine (http://www.redmine.org /). Then I took the road to writing a test report (the tester recommended writing the test report in the early stage ). As we all know about games, it is sufficient to work overtime. A redmine test report system is urgently needed.

So far, I want to write such a simple test report system.

Requirements or requirements:
  • Easy enough
  • Independent Systems as much as possible

Development Technology: Java/jsp

Design ConceptData source:

As a matter of fact, the redmine built in the studio should be able to directly read the redmine database for data retrieval. I think the system is highly dependent and independent. I also asked mantis about the development of the test report system. They crawled data directly from Mantis. In the end, I crawled data directly from redmine.

Data storage:

Because the testing report system is generally used by testers (especially dynamic web pages), at most others can view static testing reports. Therefore, the system does not have high performance requirements. So I didn't use database software. I directly used text files to record data. One reason is that I think it is relatively troublesome to configure and deploy databases when using databases. There are no performance requirements. Use the text directly.

Simple Architecture

The system crawls data from the remote redmine and crawls data of a specific version according to the user's choice. Read the test report template and data to generate a test report. Send the test report to the corresponding personnel and save the static file of the test report (you can view the historical test report ).

 

Several core issues and technologies
  • HTTP request -- httpclient
  • Data Statistics and Image Generation-jfreechart
  • Front-end display of data statistics -- charts. js
  • Mail database -- mail
  • Data storage-gson
Crawling and filtering

The crawled HTML file needs to extract the required data from the HTML file. Here we use regular expressions to extract the data.

Data Statistics

The data statistics front-end mainly uses charts. js to display data results in real time. The JS in the email is invalid. Therefore, the final statistical results are converted to images using a third-party jfreechart library.

Data Storage

In fact, it uses text storage, so it only uses Java file read and write operations. Gson is used because the stored data adopts the JSON format. Gson is easy to use.

Mail

The mail. Jar library is used to send emails. I don't know why this library can happen without a password. This may be related to the email supplier.

In addition, due to the need to send images in the case of an email, it is a bit difficult here. If the image is stored on the server, once the server is abnormal (power failure or network disconnection), the test report cannot display the image. Therefore, you can use attachments to send them out. However, attachments may be identified as spam. Finally, convert the image into data and directly write it into HTML to solve the problem ~. The following is the source code for converting an image into data.

 /*     * Convert PNG to Base64     * path the PNG path     * */    public static String getBase64Png(String path) throws Exception {        String msg=”";        try{             BufferedImage image = ImageIO.read(new File(path));            ByteArrayOutputStream baos = new ByteArrayOutputStream();            ImageIO.write(image, ”png”, baos);            msg = Base64.encode(baos.toByteArray());         }catch(IOException e){            e.printStackTrace();        }         return msg;    }
  A small problem

I directly changed the redmine address to the redmine official address http://www.redmine.org, the results of the data crawling error. It is because the table structure is different when I crawl a table. The official remine is missing a field in a table than the redmine used by our studio. If you encounter this problem, you may need to modify the source code to make it possible.

Example

Project and version selection page

Test report compilation page

A static test report example. Click: http://www.veiyn.com/study/TestReport.html to view. (Click to view the source code to find that the image is saved in HTML)

Out-of-Question

Source code: https://github.com/rondsny/TestReport/

Remember to configure the config. properties file before using it:

Pt_url = http://www.redmine.org # redmine platform address required mail_host = mail.test.com # mail server address required mail_from = [email protected] # default sender unrequired mail_tos [email protected] | [email protected] # default recipient not Required

 

Sharing!

Personal blog original address: http://www.veiyn.com /? P = 66

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.