In his great lecture on the Crusade against errors in software
the first Swiss Testing Night of 12 June of the year, reports Jerome Mueller of developers who can literally think of everything and just about anything. When asked after the draft of their application, they give so clever things to like:
The business layer then uses the Persistence Layer. The Persistence Layer, we have to ensure database independence. And the business layer, we can deploy on different machines and so scale.
The software is designed for everything! Switching from Oracle to XML files? No problem! Switching from Windows to Linux? No problem! Instead of the log files are the log entries be sent to a web service? Piece of cake!
which concepts he has built, that the application "testable" is. Can I open each screen mask within 3 seconds and set the condition of the data displayed, so I can test the UI behavior? How do I create test data?
But, according to Müller, one of
can not answer the developer, namely the question of
etc. The answer is unfortunately often very short and can be summarized in zero words.
To me this complaint to suspend, I have written for our current project, a BSP program that accurately this can be: Every picture - and that means in our MVC framework: each panel - go to a mouse click.
The report not only helps in testing the UI behavior, but also displays a log of the HTML code inspections by Dave Raggett
HTML Tidy program so that you recognize as Schachtelungsfehler in the source code. The program calls for entering a BSP application and one in this application according to the Flow Logic defined panels with an internal HTTP request exactly this panel and shows three aspects of representation: The browser view using an embedded HTML viewer control, and the HTML source code and the protocol of tests on HTML Tidy. Here is a screenshot with a our "Hello World" applications of the MVC frameworks:
The images that appear in this test program, are always with the same test data filled, regardless of the amount actually maintained in the system master or transaction data. How is this possible?
A small intervention in the MVC Framework allows the artifice, rather than using the "productive" Models of the business logic decoupled subclasses that implement a tagging interface zif_testdata . The application parameter structure zif_mvc_framework , which is responsible to call, the application to use the models, controllers and views. The standard implementation zcl_mvc_framework takes this information to the config.xml file
, which is in MIME part of the BSP application filed. In the development system I have held this standard implementation of an alternative implementation
zcl_mvc_framework_test deposited:
These attacks exactly one point: In assessing the models. It provides instead of the model itself returns a subclass that implements the interface zif_testdata - if such exist. The only place with a different Logic is therefore the method get_model () :
method zif_mvc_framework ~ get_model.
es_model = go_framework-> get_model (iv_model_id).
* Model substitute test class
replace_class_by_testclass (changing cs_model = es_model).
ENDMETHOD.
The data that the user interface needs to be fixed now established in this test model. Thus, the UI looks in the UI test mode from the same and may be protected by periodically running automated tests to verify the example that the HTML document has the expected DOM tree.
the program HTML Tidy can be accessed easily by the way in the ABAP stack be because there is an ABAP wrapper: class cl_htmltidy . If go_tidy
an object variable of this class known, one can configure HTML Tidy at load time of his class or his reports or the creation time his object, as follows:
go_tidy cl_htmltidy = => create (). define _set_option. call method go_tidy-> set_options
exporting
option = & 1
value = & 2 end-of-definition.
_set_option:
'indent' 'auto',
'indent-spaces' '2 '' input-encoding 'utf8'. ! Must be written (not "utf-8")
Calling is important to note that the class
cl_htmltidy
expecting her input always in UTF-8
format and returns the results in this format. So you have the HTML code first with the conversion class
cl_abap_conv_out_ce
a XSTRING produce the text in the character encoding UTF-8 contains
. Only then can you call HTML Tidy:
* ---
get_tidy form.
data: lv_in type xstring,
lo_error type ref to cx_root.
statics: so_conv type ref to cl_abap_conv_out_ce.
if so_conv is not bound.
so_conv? Cl_abap_conv_out_ce = => create ( encoding = '4110' ).
endif.
try.
call method so_conv->convert
exporting data = gv_code importing
buffer = lv_in.
call method go_tidy->repair
exporting input = lv_in diagnostics = 'X'
importing
* --> In einem TextEditControl anzeigen:
errors = gv_tidy.
catch cx_root into lo_error.
zcl_messages=>show_exception( lo_error ).
endtry.
endform. "tidy_get
Tidy can not only be like this to validate websites eisetzen, but can also convert HTML to XHTML. There are many practical applications: Tidy could be a bit of help to migrate to the view content of a project or application from HTML to XHTML. Also, Tidy can be combined with the built-in ABAP XML parser as an HTML parser to use, so that one can also examine the HTML DOM of a Web application with ABAP resources.
pop operations to copy data into the stack and take from him. It is this stack is used to manage local data: The need for local data storage space is easy on the current stack pointer is added [2] This is very quick and shall, at the deepest level, that local data actually used only within a procedure. can be.