Category:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
Position:IcFull.com » IC Electronic information » Category: J

IC Electronic information

JavaPOS based on embedded system test design and implementation

In Electronic Infomation Category: J | on December 08,2010

Abstract: UnifiedPOS JavaPOS standard and ADS7816U datasheet and its derivatives, cash registers in the hardware devices on the specification. JUnit unit testing tool for use in embedded system device interface JavaPOS were white-box testing, analysis of the lack of mainstream cash registers, cash registers are given the embedded test method and ADS7816U price and test cases POSDouble. The results show that the embedded JavaPOS JavaPOS successfully introduced the system specification, standardized interface definitions of various peripheral devices, the use of Java language, to solve the portability, dynamic loading, security and ADS7816U suppliers and many other issues.

0 Introduction

With the development of embedded computer technology, embedded technology has been widely applied to all aspects of modern life. In the retail systems, retail cash registers is an important area of embedded applications. Currently, cash registers on the market can be divided into three categories: the first is based on the PC and DOS / Windows system, such products now account for most of the market, a high-end product, the price is too high, suitable for large shopping centers and marketing systems; the second category is based on the microcontroller (51 mostly), and virtually no operating system support, features also weak, mainly for dining and entertainment, accounting for middle and low market; third category is growing rapidly based on embedded chips and embedded operating systems, lower prices, more powerful for high-end market, these products will be the future mainstay of the market. Development platform for more than three cash registers all kinds, basically each one is a development platform, there is no uniform specification, development and debugging platform. System upgrades and migration problems, especially for one and other third-party development of software applications needed, resulting in a greater development difficult. Improved VM virtual machine, Java applications, speed is not much of a problem.

1 JUnit Analysis and Applications

MUnit is a subset of JUnit, using methods similar to JUnit, JUnit only here to do analysis. JUnit is an open source Java testing framework, it is XUnit testing an implementation of the architecture. JUnit unit testing framework in the design, set three overall objectives, the first is to simplify the writing test, including testing framework that simplifies the study and the preparation of the actual test unit; the second is to test the unit to maintain persistent ; the third is to use existing test preparation of related tests. Therefore, these objectives are the root cause of why the use of models. JUnits design to Patterns Generate Architectures way to structure the system. The design idea is to apply design patterns from scratch, and then one by one, until the final appropriate system architecture. JUnit is a test Framework, testing the ability to develop test cases, then these test cases (TestCase) composed of the request (which may be one or more), sent to JUnit, and then by the JUnit execution, the final report details the test results. Among them, including the implementation of the time, wrong way, wrong location. This test case developers do not need to know the internal details of JUnit, a request that they meet the definition of its format. From the perspective of JUnit, TestCase it does not need to know the specific operation request information, just put it as a command to execute, then execute the test results sent to testers. This allows TestCase JUnit framework and open to independent developers, so do not know that the receiving party to request more information on the requesting party, not to know how to be received, and how to be executed to achieve loosely coupled systems.

Junit. Framework package contains the JUnit test class all the required base class, in fact, this package is the basis of the JUnit framework. TestCase class is the package of core classes, test classes inherited staff to develop their own TestCase class test driver. The rest of the class used to support the TestCase class, such as aggregate number of test cases using class TestSuite (Testcase), Assert class implements the expected and actual values of the validation, TestResult collects all the results of test cases executed. Test interface is the key to this package, it establishes the relationship between the TestCase and TestSuite also made for the entire framework of the extended reservation. In the simple J2SE application example:


right-click the project name and select New → JUnit test cases

(running) → JUnit test in debug mode. Figure 1 shows the running results.


JUnit in J2SE applications may be good, but the J2ME application under the existing difficulties of large because there is no reflection under J2ME. In the actual test can use its advantages to the biggest play.

2 POSDouble test

under the MIDP 1.0 does not support floating point (float) operations, it must develop under the floating-point operations for J2ME methods. This main achievement of the following methods, these methods of testing were conducted by white-box testing JUnit, test data selection is mainly based on the actual needs of the market set to ensure the actual needs at this stage; and under the MIDP 2.0 to support floating-point operations, floating-point operations do not develop their own methods.

class name: POSDouble, mainly used for floating point calculations, the main test the following methods:

POSDouble: convert a string to POSDouble number.

POSDouble. Add: additions.

POSDouble. Sub: subtraction.

POSDouble. Mult: multiplication.

POSDouble. Div: division.

POSDouble isMax: Comparison of floating-point size.

POSDouble tolong: the number of transforming growth will POSDouble integer.

POSDouble test cases (in POSDouble.Add: addition example):


3 General Interface Test

the POSDouble was developed under J2SE, so use the JUnit tools, and other interface functions are under development in J2ME, so the interface is tested with the MUnit (JUnit subset ) tool. MUnit to use the tool, the rules refer to "MUnit Specifications for the test set."

(1) testing framework

directory structure of the general principle is: the source code directory and test code directory separation, without disturbing each other; test code directory with the source code directory structure the same branch easy to find and maintain.

(2) simulation environment for test execution process

first write test code, test code and source code as possible on the corresponding test directory. Modify the test program entry, such as the use ePos. set. FunctionFormFactory.

(3) the target environment test execution process

write test code, modify the test program entry, build the test code Jar file, download Jar file to the target machine is running.

(4) test the shortcut

Typically, the test in the target environment, you need to write test cases, and then compile, then download, then run, if you suddenly think of a test case and the need for repeat the above steps, would be very time consuming. To enhance the flexibility of the test, you can add keyboard * events. * First class keyboard writing, all the test step corresponds to a different button up, that is to perform an operation by a key step. Such as: "a" corresponds to open operation, "b" corresponds to claim operations, "c" corresponds to setDeviceEnable (true) operation. To perform a complete test process, step by step according to the corresponding button. To perform a different test cases by a different order on the corresponding button, so no longer need to write test cases, compile, build, download, can save a lot of time, test efficiency is greatly improved. At the same time the original test cases can be combined to allow different buttons correspond to different (complete) test case, so do not take program entry, the same can be achieved and the implementation of the original test cases.

(5) rapid regression testing

bug amendments need to do regression testing to regression testing in the target environment, must go through the following steps:

① from the updated with the latest CVS source code;

② Java source code will be compiled into C files;

③ Construction Elf file;

④ Download Elf file; < P> ⑤ implementation of test cases to do regression testing.

steps ② ~ ④ which will cost a lot of time. To improve the efficiency of regression testing, the device DeviceServices spun off from the Elf file, create a separate Jar file updates if only DeviceSer-Vices, only need to recompile DeviceServices the Jar file, do not change Elf file. Jar file updates Elf than updated files from the steps and time are far more efficient.

4 Example

(1) take an entrance, adding keyboard * events, as shown in Figure 2.


(2) write in keyboardlistener key corresponding test cases or methods, as shown in Figure 3 .


(3) compile build Elf file. Compiled first evm, ejpos two projects; compile ROMJavaWin. c, NativeFunctionTable. c used to build Elf (including evm, ejpos); in LambdaIDE Elf file under the build and optimize; by LBOOT downloaded to the target environment.

(4) compile the test case of the Jar file.

(5) keys on the target machine on the basis of the implementation of different test cases.

bug regression testing, the update DeviceService content, repeat steps (5) to complete regression testing.

ADS7816U datasheetADS7816U suppliersADS7816U Price

Related technical information

All right reserved:icfull.com © 2010-2016 Certificate