Tuesday, September 11, 2012
Weekly Status report template
• Progress this week (planned & actual begin/end/duration)
• Unplanned activities this week (begin/end/duration)
• Pending: planned this week but not yet completed (and the reason e.g. dependencies to previous not-yet-solved bugs, coding which is not finished yet)
• Planned activities next week (with priority lists)
• Change requests (e.g. requirement change/additional requirements)
• Issues (new issues, pending issues/bugs with severity lists, dependencies, roadblocks, ESCALATION) and risks e.g. unavailability of resources (holidays), extra resources needed, firewall adjustment by infrastructure team.
• Impact to the overall delivery deadline, impact to the planning of next activities (e.g. acceptance test by users)
Remember KISS (Keep it simple) principle, you don't have to write all these items every time. Your manager has no time to read your long weekly report.
Please share your comment.
Source: Steve's blog http://soa-java.blogspot.com
Further reading:
http://workarrow.com/burn-your-weekly-status-report-on-second-thought/
Labels:
project management
Monday, September 10, 2012
Test Checklists
Notes:
• This is a continuation from the blog about Development Test http://soa-java.blogspot.nl/2012/09/development-test.html
• For these checklist items sometime I use questions instead of mandatory compliance checks (e.g. "how to setup test data" instead of "checklist: test data should always via database"). The goal of the checklist is to instigate our mind to be aware to certain issues, not to force to a specific/narrow solution. The "best" choice is depend on the project context (e.g. test goal, security environment, etc.).
• The symbol "»" in the begining of the line means that the item is relatively important.
Test Plan template
• Datum, version, test objectives & scopes (e.g. functional requirements acceptance test, security penetration system test, performance unit test)• Process definitions (can be defined in the dev-team level, so don't have to be written in each test plans): metrics (e.g. #bugs & severity), defect classification, exit criteria, defect management, defect reporting (e.g. Trac), deliverables (e.g. test case library), if review or approval is needed for this test plan (e.g. test manager, clients).
• Assumptions (e.g. firewall and server configurations mimic the production environment)
• Pre-condition for the whole test cases e.g. licenses for software, database production is cloned in the LabManager/virtual machine test environment
• » For each test cases:
o Test case name and short description
o Traceability with requirement/usecase docs (i.e. the requirement ID)
o Preconditions for this test case (e.g. certain data states in the database, certain inputs from mock web services)
o Test steps and inter-dependencies with other test cases: e.g. fill-in employees' salaries steps: ....., dependency: add new employees (test case#1)
o Input data e.g. birth date 31-2-1980 (which is an incorrect datum)
o Expected results
o Part of system (e.g. GUI/presentation tier)
o Area (e.g. security, functional, performance)
o Test method (e.g. manual, unit test)
o Priority / risk / test effort / test coverage (e.g. high, low)
• » Resources:
o roles, who will build/execute the tests and how many man-hours needed (including external resources & trainings needed due to skills-gap)
o server/database/software/tools/hardware needed
• Schedule/plan
Test Report template
• » Test date, version, tester name, artifact (which jar, svn revision), test environment (which server/LabManager), test code version (svn rev)• » Test objectives & scopes (e.g. functional requirements acceptance test, security penetration system test, performance unit test
• » For each test result:
• Test result ID number
• Traceability (test case ID number in the test plan, requirement ID number in the requirement docs)
• Expected result e.g. web service respond time below 2 seconds (average) and 5 seconds (max).
• Actual result and impact, e.g. result: the web service respond time is 90 seconds, impact: the user waiting time with GUI is 2 minutes (unacceptable according to the SLA)
• Status:
• Ok/green: tested ok
• Bug/red(high priority)/yellow(low priority): defects, a ticket has to be made in bugzilla/trac (with priority level & targeted version/milestone)
• No-bug/gray: won't fix, false-positive
• Hasn't been tested/white
• Follow-up actions (e.g. reworks by developers)
• Part of system (e.g. GUI/presentation tier)
• Area (e.g. security, functional, performance)
• Priority / risk (e.g. high, low)
• Root causes analysis and recommendations e.g. excessive bugs in authentication classes, root causes: inadequate knowledge, recommendation: training, code review.
• Resources (roles, planned & actual man-hours)
• List non-testable requirements e.g. the GUI should be beautiful.
Weekly Status report
Please see http://soa-java.blogspot.nl/2012/09/weekly-status-report-template.htmlTest data
• » How to setup test input data (e.g. via database copy or DDL-DML database scripts) each time we setup a new Labmanager/test environment.• » Make test cases for: too little data (e.g. empty input, null), too much data, invalid data (wrong format, out of range), boundary cases
• » Make sure the positive cases have correct data (e.g. validated according to xml schema, LDAP attributes & tree structures are correct)
• » How to mask sensitive test data (e.g. password, bank account)
• » How realistic the data are?
• How to collect / create test input data (e.g. sampling the actual traffic from jms topic or populate fake customers data using pl/sql).
• How to recover/reinitialized data after test (to fullfill the precondition for the next test)
• How to maintain / versioned test data (i.e. test data for current version and for the next software version)
• How to collect and save the test result data if needed (for further test or analysis)
Functional & Design
• » Test that the product correctly implements (every) requirements and use-cases (including alternative use-cases)• » The product works according to the design and its assumptions (e.g. deployment environment, security environment, performance loads)
• » Test the conformance to relevant standards: the company standard/guideline as well as common standard such as Sarbanes-Oxley (US) / WBP (Netherlands)
• Test that (every) functions give correct result ( including rounding-error for numerical functions)
• Test that (every) application logics (e.g. flow control, business rules)
Performance test
• » Find out the typical data traffic (size, frequency, format) & number of users/connections in the production• » Response time (UI, webservice) / throughput (web service, database) meet the requirements/SLA.
• » Load test: at what load the performance degrades or fails
• » Stress test: running the system for long time under realistic high loads while monitoring resource utilization( CPU/memory/storage/network) e.g. to check memory leak, unclosed connections,tune timeout, tune thread pools.
• In case of unacceptable performance: profiling the system parts that affect the performance (e.g. database, queue/messaging, file storage, networks).
• Scale out (capacity planning for future) e.g. 3x today peak usage
• Test the time to complete of offline operation (e.g. OLAP/ETL bulk scheduled every night). Is the processing time is scallable? What to do if the bulk operation doesn't finish yet at 8.00/working hours?
• Rerun the performance test periodically in case of changes in usage patterns (e.g. growing number of users), change configurations, addition of new modules /services. So we can plan the capacity ahead and prevent the problems before it happens.
Realibility test
• Test (every) fault possibilities, test behaviour & error messages when an exception/failure occurs (e.g. simulate network failure or url-endpoint connection error in the configuration plan)• Test that faults don't compromise the data integrity (e.g. compensation, rollback the transaction) and security. Data loss should be prevented whenever possible.
• Test failover mechanism, check the data integrity after failover.
Environment/compatibility test:
• » Tests for different browser (for UI projects), application servers (e.g. vendor, version), database (e.g. vendor, version), hardware (memory, cpu, networks), OS (& version)• » Tests for different encoding (e.g. UTF-8 中文), different time-zone, different locales (currencies, language, format) e.g. 2,30 euro vs $ 2.30, test conversion between different components (e.g. database and LDAP servers can have different date format).
• » Test file system permissions using different process owner (e.g. generate files with oracle-user & consume the files with weblogic-user during applications integration)
• » Test if the configuration files (e.g. deployment plan, web.xml, log4j-config.xml) work
• Integration test: the connections between components (e.g. the endpoints in the configuration plan)
• Install & uninstall, deployment documentation
GUI
• » All GUI messages (including error messages) are clear/understandable by end users and match with user terminologies• » How frequent are the errors? how the system reacts to user error (e.g. invalid input, invalid workflow)? how the users recover from errors?
• All navigations/menu/links are correct
• Check whether all GUI components (menu/commands/buttons) described in the user instructions are exists
• The fonts are readble
• The GUI consistent is with user environment (e.g. web style in your organization)
• The software state is visible to the users (e.g. waiting for the backend response, error state, waiting user input/action)
• Validate de (X)HTML, CSS: Doctype, syntax/structuur valid
• Another GUI testing checklists: http://www.sitepoint.com/ultimate-testing-checklist/
Tips for organizing usability test
• Identified the test subjects• Provide a simple test guideline & result questionnaire, beware that your test subjects may be not so technical
• Is the software intuitive, easy to use, how much training is needed when you roll out this product in the production?
• Is online help or reference to user documentation available? User documentations should be complete enough and easy to understand for the intended audience
• Attend at least one test as test participant
Coding
• Test that variables are correctly initialized• Test multi-threading scenarios (race condition, deadlock)
Tools selection
• do any team member already have experiences with this tool• how easy to use
• customer review, popularity, how active the discussion groups/blogs to learn
• maturity
• support
• how active the development
• memory, processor requirement
• price/open-source
• easy to install/configure
• functionality, does this tool meet the requirement of the company tests
• demo/try before buy
Security
• Authentication: login, logout, guest, password strength• Authorisation: permissions, admin functions,
• Data overflow, huge input attack/DOS
For more complete security checklists see http://soa-java.blogspot.nl/2012/09/security-checklists.html
Source: Steve's blogs http://soa-java.blogspot.com/
Any comments are welcome :)
References:
• Software Testing and Continuous Quality Improvement by Lewis• Code complete by McConnell
• Department Of Health And Human Services, Enterprise Performance Life Cycle Framework, Checklist.
Labels:
java,
soa,
software testing
Development Test
Since I am involved in the design/code/test review team at my work, I want to share some knowledge with you in this blog.
This document discusses the development test (test the code by developers before sending the artifacts to the QA/test team).
• Reduce bug fix costs by detecting the defects earlier before the code is delivered to QA/Test team.
• Early and frequent development tests give early feedbacks to the developer team.
• The statistics and the trend charts can be useful for the management team to assess the maturity/reliability of the product and if early actions are necessary to correct the process. For example it would be late when you found that you need to hire a security expert if you have sent the product to the external party with security bugs on it. The QA manager can use the test statistics to decide whether or not to accept the product from the development team.
• Determine how the developer do the test in the software process, e.g.
o build the test before the developer start coding (TDD/agile),
o run the test after the code is mature enough before delivery to the test team (waterfall)
o perform automatic continous integration test after every SCM commit (Agile)
o perform exploratory tests (Agile)
o scrum demo / user test for user feedback at the end of each Sprint (Agile)
o spiral/incremental test: run the test iteratively, add new tests for the integration of new SOA components (while keep running the previous tests as regression test) at each Scrum sprint
• Do you need a test plan / documented test cases?
• Does the test plan need to be review (e.g. completeness)?
• Define the process/how tests will be conducted e.g. automatic test (unit test, GUI Selenium), manual user test, manual exploratory tests?
• Determine entry criteria (e.g. code is mature enough)
• Determine exit criteria (e.g. approval by developer manager, approval by QA manager that the code is mature enough to be delivered to the QA/test team)
• Determine metrics (e.g. error list with severity & type)
• Are tools available to assist test process (e.g. SOAPUI test, yslow)?
• Determine defect reporting/communication channel: how to report test results (e.g. Trac, bugzilla), how to archive test cases & results (e.g. svn, wiki), defect management (e.g. how to track the test status, reworks en retesting)
• Determine who will play the tester role. You may have several testers assigned to specific areas (e.g. security developer specialist for penetration testing, or invite customers for use cases testing).
• Determine the time needed to develop and perform tests. Discuss the time/plan with project manager / team lead to obtain management support. Schedule the meetings. Set time-limits.
• Do the tests, register the anomalies.
• Discuss whether or not a fix is needed.
• Discuss the fix, decide which version the fix should be done, who will do the reworks, estimate/plan the reworks
• Determine the exit decision e.g. re-inspection after required reworks, minor reworks with no further verification needed.
• Reschedule the follow up/ reinspection for reworks.
• Collect "lessons to learn" to improve the development process.
• Do you need permission or need to inform other department? (e.g. you'd better seek permission from the infrastructure-manager before bombing the servers with DoS penetration test or performance stress testing). This is also in the case of the red-team testers (which perform penetration test without pre-knowledge about the system and without IT staffs awareness), always seek the permission from the management first.
• Test is performed not by the developer who implements the code: to avoid blind spots, objective, to make sure good documentation.
• Determine how to share the test codes with other developers & the QA team (for code reuse and reproducible results). Reuse tests with test libraries / knowledge repository (e.g. test case library). Use version control (e.g. svn)
• Regression test: rerun the past tests to detect if the current fix has introduced new bugs
• Automatic tests is better than manual test: repeatable, less error-prone, more efficient to run and reuse, can be run frequently (e.g. continous integration)
• Discuss with your client / user for realistic scenarios when defining the test data
• Find-out the typical use (e.g. the average message size, how many requests per minute) by asking the users
• Find-out the typical failures in the production (e.g. network outage) by asking the production-team
• Find out the typical environment/configuration in the production (e.g. browser, OS). Do you need to consider old environtment/data for back compatibility (e.g. IE 5.0) ?
• Build a test case for every requirement / use case items. Mention the requirement number in the test case document for traceability.
• Determine which tests to be perform within limited time e.g. installation/configuration/uninstall test, user functional test, performance test, security test, compatibility test.
• Don’t try to cover everything. Prioritize the test cases base on the most likely error (e.g. which functional area, which class) and the risk.
• Avoid overlap of test cases
• Use test case with hand-convenient values (e.g. 10000 instead of 47921)
• Make sure that the testers have business knowledge about the domain (e.g. terminologies, business logics, workflow, typical inputs)
• Consider automatic test case generator
• Review and test the test code
• GUI prototyping/pilot test: involve only limited numbers of testers & use easier scenarios
• Consider positive (e.g. good data) as well as negative (e.g. wrong data, database connection failure) test cases
• Use test framework/tools (avoid reinventing the wheel) e.g. SOAPUI, Selenium, JMeter.
• Keep, interpret and report the test statistics, useful charts:
o defect gap analysis: found bugs and solved bugs vs time
o number of bugs per function/module/area (bugs tend to be concentrated in certain modules)
o number of bugs per severity level (e.g. critical, major, minor)
o number of bugs per status (e.g. ok, solved, unsolved, not yet tested)
o test burnout graph: number of unsolved bugs and not yet being ran test-cases vs time
o number of bugs per root causes (e.g. incomplete requirement, database data/structure, etc).
Please see http://soa-java.blogspot.nl/2012/09/test-checklists.html
• Level 1: automatic unit tests
• Level 2: service integration tests (e.g. the connection between services)
• Level 3: user acceptance / system tests (e.g. GUI, security, performance)
• Service functional tests e.g. SOAPUI
• Performance tests e.g. SOAP UI, Jmeter, yslow (GUI)
• Security tests e.g. SOAPUI, paros, spike, wireshark
• GUI tests e.g. Selenium, httpunit
Please share your comment.
Source: Steve's blog http://soa-java.blogspot.com
• Code complete by McConnell
Scope
This document discusses the development test (test the code by developers before sending the artifacts to the QA/test team).
Benefits of developer testing
• Reduce bug fix costs by detecting the defects earlier before the code is delivered to QA/Test team.• Early and frequent development tests give early feedbacks to the developer team.
• The statistics and the trend charts can be useful for the management team to assess the maturity/reliability of the product and if early actions are necessary to correct the process. For example it would be late when you found that you need to hire a security expert if you have sent the product to the external party with security bugs on it. The QA manager can use the test statistics to decide whether or not to accept the product from the development team.
Define the process
• Determine how the developer do the test in the software process, e.g. o build the test before the developer start coding (TDD/agile),
o run the test after the code is mature enough before delivery to the test team (waterfall)
o perform automatic continous integration test after every SCM commit (Agile)
o perform exploratory tests (Agile)
o scrum demo / user test for user feedback at the end of each Sprint (Agile)
o spiral/incremental test: run the test iteratively, add new tests for the integration of new SOA components (while keep running the previous tests as regression test) at each Scrum sprint
• Do you need a test plan / documented test cases?
• Does the test plan need to be review (e.g. completeness)?
• Define the process/how tests will be conducted e.g. automatic test (unit test, GUI Selenium), manual user test, manual exploratory tests?
• Determine entry criteria (e.g. code is mature enough)
• Determine exit criteria (e.g. approval by developer manager, approval by QA manager that the code is mature enough to be delivered to the QA/test team)
• Determine metrics (e.g. error list with severity & type)
• Are tools available to assist test process (e.g. SOAPUI test, yslow)?
• Determine defect reporting/communication channel: how to report test results (e.g. Trac, bugzilla), how to archive test cases & results (e.g. svn, wiki), defect management (e.g. how to track the test status, reworks en retesting)
• Determine who will play the tester role. You may have several testers assigned to specific areas (e.g. security developer specialist for penetration testing, or invite customers for use cases testing).
• Determine the time needed to develop and perform tests. Discuss the time/plan with project manager / team lead to obtain management support. Schedule the meetings. Set time-limits.
• Do the tests, register the anomalies.
• Discuss whether or not a fix is needed.
• Discuss the fix, decide which version the fix should be done, who will do the reworks, estimate/plan the reworks
• Determine the exit decision e.g. re-inspection after required reworks, minor reworks with no further verification needed.
• Reschedule the follow up/ reinspection for reworks.
• Collect "lessons to learn" to improve the development process.
• Do you need permission or need to inform other department? (e.g. you'd better seek permission from the infrastructure-manager before bombing the servers with DoS penetration test or performance stress testing). This is also in the case of the red-team testers (which perform penetration test without pre-knowledge about the system and without IT staffs awareness), always seek the permission from the management first.
Best practices
• Test is performed not by the developer who implements the code: to avoid blind spots, objective, to make sure good documentation.• Determine how to share the test codes with other developers & the QA team (for code reuse and reproducible results). Reuse tests with test libraries / knowledge repository (e.g. test case library). Use version control (e.g. svn)
• Regression test: rerun the past tests to detect if the current fix has introduced new bugs
• Automatic tests is better than manual test: repeatable, less error-prone, more efficient to run and reuse, can be run frequently (e.g. continous integration)
• Discuss with your client / user for realistic scenarios when defining the test data
• Find-out the typical use (e.g. the average message size, how many requests per minute) by asking the users
• Find-out the typical failures in the production (e.g. network outage) by asking the production-team
• Find out the typical environment/configuration in the production (e.g. browser, OS). Do you need to consider old environtment/data for back compatibility (e.g. IE 5.0) ?
• Build a test case for every requirement / use case items. Mention the requirement number in the test case document for traceability.
• Determine which tests to be perform within limited time e.g. installation/configuration/uninstall test, user functional test, performance test, security test, compatibility test.
• Don’t try to cover everything. Prioritize the test cases base on the most likely error (e.g. which functional area, which class) and the risk.
• Avoid overlap of test cases
• Use test case with hand-convenient values (e.g. 10000 instead of 47921)
• Make sure that the testers have business knowledge about the domain (e.g. terminologies, business logics, workflow, typical inputs)
• Consider automatic test case generator
• Review and test the test code
• GUI prototyping/pilot test: involve only limited numbers of testers & use easier scenarios
• Consider positive (e.g. good data) as well as negative (e.g. wrong data, database connection failure) test cases
• Use test framework/tools (avoid reinventing the wheel) e.g. SOAPUI, Selenium, JMeter.
• Keep, interpret and report the test statistics, useful charts:
o defect gap analysis: found bugs and solved bugs vs time
o number of bugs per function/module/area (bugs tend to be concentrated in certain modules)
o number of bugs per severity level (e.g. critical, major, minor)
o number of bugs per status (e.g. ok, solved, unsolved, not yet tested)
o test burnout graph: number of unsolved bugs and not yet being ran test-cases vs time
o number of bugs per root causes (e.g. incomplete requirement, database data/structure, etc).
Test checklists
Please see http://soa-java.blogspot.nl/2012/09/test-checklists.html
The test pyramid
• Level 1: automatic unit tests• Level 2: service integration tests (e.g. the connection between services)
• Level 3: user acceptance / system tests (e.g. GUI, security, performance)
Tools
• Unit tests: junit, nunit• Service functional tests e.g. SOAPUI
• Performance tests e.g. SOAP UI, Jmeter, yslow (GUI)
• Security tests e.g. SOAPUI, paros, spike, wireshark
• GUI tests e.g. Selenium, httpunit
Please share your comment.
Source: Steve's blog http://soa-java.blogspot.com
References:
• Software Testing and Continuous Quality Improvement by Lewis• Code complete by McConnell
Labels:
software testing
Friday, September 7, 2012
Sending attachment: MTOM / XOP vs SWA and inline attachment
So you want to send a large binary/files via web services. This blog will describe why MTOM (Message Transmission Optimization Mechanism) / XOP (XML-binary Optimized Packaging) is better than inline-attachment and SWA.
Inline base64 attachment
The binary content as an inline element inside the SOAP message:
SOA with attachment (SWA)
Using MIME message (originally for SMTP email protocol), the SOAP message becomes the first MIME content and the attachments are in the following MIME contents:
• it's break the SOAP web service model: the SOAP message being XML
• interoperability problems (e.g. different implementations of message-level security)
MTOM/XOP standard as a better solution:
• Similar to SWA approach: using MIME messages
• interoperability: the MIME attachment contents logically become inline contents within XML document so it's easy to handle these contents with standard approach (e.g. XSL transformation, standard security treatment using WS-Security for encryption/signature, WS-RM for QoS)
• interoperability with different web service clients thanks to MTOM policy declaration in the wsdl which is understood by different vendors (I have tested in .Net, Java.)
• optimized (e.g. compressed in Weblogic framework)
to include the attachment content.
How: server side (JAX-WS in Weblogic)
use @MTOM annotation or mtom.xml policy
How: client side (JAX-WS in Weblogic)
Pass MTOMFeature() as argument:
MtomService port = service.getMailServicePort(new MTOMFeature());
Using SOAPUI as a test client
MTOM attachment via SOAPUI, 3 steps:
1. Set Enable MTOM = true in the request properties
2. Upload the attachment (e.g.. A3.pdf), notice the contentID
3. Set the MTOM contentID in the xml request
Improving your MTOM service:
• Security: validation & sanitation (against code injection), limit the attachment/body size (againts DOS attack), content scan (against virus)
• adding reliability with guaranteed delivery queue as the front end of the proxy
If you're an Oracle OSB fans
In OSB you can use also email-transport, but using a Java webservice with JavamailAPI offers more configuration flexibility (e.g. unicode support, custom content handlers, etc) and better performance (throughput). A good book about how to use email-transport in OSB: OSB Development Cookbook by Schmutz et.al.
Javamail tips
Html & Unicode support in the Javamail API (Java library to send mails to the SMTP servers):
messageBodyPart.setContent(thecontent, "text/plain; charset= UTF-8");
Source: Steve's blogs http://soa-java.blogspot.com/
Any comments are welcome :)
References:
Developing Web Services with Apache CXF and Axis2 by Tong
MTOM using open source Java (Axis2 & CXF): using document-wrap or RPC style and DataHandler.
Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server
http://docs.oracle.com/cd/E17904_01/web.1111/e13734/mtom.htm#i281179
MTOM using JAX-WS (with example code)
http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom/
Inline base64 attachment
The binary content as an inline element inside the SOAP message:
<Envelope> <Body> <sendImage> <filename>mybeautifulwife.jpg</filename> <image>.... JPEG image base64 .....</image> </sendImage> </Body> </Envelope>We need to convert the binary to base64 since we use XML. The problem with this method is that the base64 representation will expand the size of the message, so it's not an effecient method.
SOA with attachment (SWA)
Using MIME message (originally for SMTP email protocol), the SOAP message becomes the first MIME content and the attachments are in the following MIME contents:
type=text/xml;
start="<rootpathID>"
Content-Length: ...
--_MIME_boundary_
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpathID >
<soapenv:Envelope>
<soapenv:Body>
<sendImage>
< filename>mooiemarjo.jpg</filename>
<image href="cid:imgID"/>
</sendImage>
</soapenv:Body>
</soapenv:Envelope>
--_MIME_boundary_
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <imgID>
...JPEG image bytes...
--_MIME_boundary_--
The problems with SWA: • it's break the SOAP web service model: the SOAP message being XML
• interoperability problems (e.g. different implementations of message-level security)
MTOM/XOP standard as a better solution:
• Similar to SWA approach: using MIME messages
• interoperability: the MIME attachment contents logically become inline contents within XML document so it's easy to handle these contents with standard approach (e.g. XSL transformation, standard security treatment using WS-Security for encryption/signature, WS-RM for QoS)
• interoperability with different web service clients thanks to MTOM policy declaration in the wsdl which is understood by different vendors (I have tested in .Net, Java.)
• optimized (e.g. compressed in Weblogic framework)
Content-Type: Multipart/Related;
boundary=_MIME_boundary_;
type= application/xop+xml;
start="<rootpathID>"
Content-Length: ...
--_MIME_boundary_
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpathID >
<soapenv:Envelope>
<soapenv:Body>
<sendImage>
< filename>mooiemarjo.jpg</filename>
<image>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:xmlmime="://www.w3.org/2004/11/xmlmime"
xmlmime:contentType="image/jpeg" href="cid:imgID"/>
</image>
</sendImage>
</soapenv:Body>
</soapenv:Envelope>
--_MIME_boundary_
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <imgID>
...JPEG image bytes...
--_MIME_boundary_--
Note that the MIME content type is application/xop+xml and we use How: server side (JAX-WS in Weblogic)
use @MTOM annotation or mtom.xml policy
How: client side (JAX-WS in Weblogic)
Pass MTOMFeature() as argument:
MtomService port = service.getMailServicePort(new MTOMFeature());
Using SOAPUI as a test client
MTOM attachment via SOAPUI, 3 steps:
1. Set Enable MTOM = true in the request properties
2. Upload the attachment (e.g.. A3.pdf), notice the contentID
3. Set the MTOM contentID in the xml request
Improving your MTOM service:
• Security: validation & sanitation (against code injection), limit the attachment/body size (againts DOS attack), content scan (against virus)
• adding reliability with guaranteed delivery queue as the front end of the proxy
If you're an Oracle OSB fans
In OSB you can use also email-transport, but using a Java webservice with JavamailAPI offers more configuration flexibility (e.g. unicode support, custom content handlers, etc) and better performance (throughput). A good book about how to use email-transport in OSB: OSB Development Cookbook by Schmutz et.al.
Javamail tips
Html & Unicode support in the Javamail API (Java library to send mails to the SMTP servers):
messageBodyPart.setContent(thecontent, "text/plain; charset= UTF-8");
Source: Steve's blogs http://soa-java.blogspot.com/
Any comments are welcome :)
References:
Developing Web Services with Apache CXF and Axis2 by Tong
MTOM using open source Java (Axis2 & CXF): using document-wrap or RPC style and DataHandler.
Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server
http://docs.oracle.com/cd/E17904_01/web.1111/e13734/mtom.htm#i281179
MTOM using JAX-WS (with example code)
http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom/
Labels:
soa,
web service
Wednesday, September 5, 2012
The Review Process
As a continuation of my blog about Software Review http://soa-java.blogspot.nl/2012/04/software-review.html
Review Process checklist
• Determine when to do the review in the software process e.g.
* code review after finishing the code implementation before delivering to QA/test team (waterfall)
* requirement/product backlog review before sprint planning (Scrum)
* design review before starting coding (well... even with Agile process you need to start with some kind of design in your mind that you can discuss with your peer reviewers).
• Define the process/how review will be conducted e.g.
* code reading (most effective)
* formal review meeting (less effective)
* informal walk-through (less effective)
* customer demo (mainly for functional requirements).
• Determine entry criteria (e.g. specification documents are available)
• Determine exit criteria (e.g. approval by product owner & SOA governance board)
• Determine metrics (e.g. LOC/hour, time spend, error list with severity & type)
• Are tools available to assist review process (e.g. checkstyle, PMD, spelling checker, xml/html validator, test suites)?
• Determine communication channel (e.g. Trac wiki, bugzilla)
• Determine who will play the reviewer role, e.g. architects, security specialist, external auditor, customer. You may have several reviewers assigned to specific areas (e.g. security specialist, database specialist, customer to review use cases).
• Determine the time needed for review (based on code complexity/size/maturity, programmer's skills, risk analysis). Discuss the time/plan with project manager / team lead to obtain management support. Schedule the meetings. Set time-limits for meetings & other review works.
• Do the review, register the anomalies.
• Discuss whether or not a fix is needed.
• Discuss the fix, decide which version the fix should be done, who will do the reworks, estimate/plan the reworks
• Determine the exit decision e.g. re-inspection after required reworks, minor reworks with no further verification needed.
• Reschedule the follow up/ reinspection for reworks.
• Collect "lessons to learn" to improve the development & review process, for example in a company wiki knowledge repository.
Review Outputs
• List of anomalies with severity/risk and types (e.g. missing functional requirement, doesn't conform standard/guidelines, security, performance, etc.). The list is documented for example in Trac/Bugzilla and made available to the developer team, QA team, product owner and management.
• List of actions for each anomalies (e.g. don't fix, fix for further release, fix immediately in the current Scrum sprint), who will implement, when the follow up is
Best practices
• use checklist, rather shorter than A4
• The process can be enforced by software infrastructure (eg deployment script, TracWorkflowAdmin plugin)
• the reviewer must be someone other than the author of the requirement / design / code.
• limit the review time, make a clear agreeement / planning between developers, reviewes, project manager and customer. Waiting for a review shouldn't become an excuse to block the progress of the project.
Other tips
Read this article:
http://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/
* don't review too much code at once
* take your time
* the quality of the code is improved if the author has done self-review and annotate (explain, defend the rationale) it before the review
* verify that the defects are actually fixed
* ego effect: the review process will motivate the author to be less sloppy even if you only review small percentages of the code
* use automated review tools (e.g. checkstyle in java eclipse)
Review Process checklist
• Determine when to do the review in the software process e.g.
* code review after finishing the code implementation before delivering to QA/test team (waterfall)
* requirement/product backlog review before sprint planning (Scrum)
* design review before starting coding (well... even with Agile process you need to start with some kind of design in your mind that you can discuss with your peer reviewers).
• Define the process/how review will be conducted e.g.
* code reading (most effective)
* formal review meeting (less effective)
* informal walk-through (less effective)
* customer demo (mainly for functional requirements).
• Determine entry criteria (e.g. specification documents are available)
• Determine exit criteria (e.g. approval by product owner & SOA governance board)
• Determine metrics (e.g. LOC/hour, time spend, error list with severity & type)
• Are tools available to assist review process (e.g. checkstyle, PMD, spelling checker, xml/html validator, test suites)?
• Determine communication channel (e.g. Trac wiki, bugzilla)
• Determine who will play the reviewer role, e.g. architects, security specialist, external auditor, customer. You may have several reviewers assigned to specific areas (e.g. security specialist, database specialist, customer to review use cases).
• Determine the time needed for review (based on code complexity/size/maturity, programmer's skills, risk analysis). Discuss the time/plan with project manager / team lead to obtain management support. Schedule the meetings. Set time-limits for meetings & other review works.
• Do the review, register the anomalies.
• Discuss whether or not a fix is needed.
• Discuss the fix, decide which version the fix should be done, who will do the reworks, estimate/plan the reworks
• Determine the exit decision e.g. re-inspection after required reworks, minor reworks with no further verification needed.
• Reschedule the follow up/ reinspection for reworks.
• Collect "lessons to learn" to improve the development & review process, for example in a company wiki knowledge repository.
Review Outputs
• List of anomalies with severity/risk and types (e.g. missing functional requirement, doesn't conform standard/guidelines, security, performance, etc.). The list is documented for example in Trac/Bugzilla and made available to the developer team, QA team, product owner and management.
• List of actions for each anomalies (e.g. don't fix, fix for further release, fix immediately in the current Scrum sprint), who will implement, when the follow up is
Best practices
• use checklist, rather shorter than A4
• The process can be enforced by software infrastructure (eg deployment script, TracWorkflowAdmin plugin)
• the reviewer must be someone other than the author of the requirement / design / code.
• limit the review time, make a clear agreeement / planning between developers, reviewes, project manager and customer. Waiting for a review shouldn't become an excuse to block the progress of the project.
Other tips
Read this article:
http://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/
* don't review too much code at once
* take your time
* the quality of the code is improved if the author has done self-review and annotate (explain, defend the rationale) it before the review
* verify that the defects are actually fixed
* ego effect: the review process will motivate the author to be less sloppy even if you only review small percentages of the code
* use automated review tools (e.g. checkstyle in java eclipse)
Wednesday, July 25, 2012
Marital status in the Netherlands
In
Indonesia we have only 2 states of marital status: married, unmarried. When
working on the human-resource software integration project (the software
registers personal data of employees including their marital status), I found
out that in the Netherlands it appears that we have more marital status due to
different kinds of living together/half-marriage
(samenwonen, partnerschap) and divorce (gescheiden) contracts:
- Samenwonen (notariele acte)
- Samenwonend(relatieverklaring)
- Gescheiden
- Gescheiden
van tafel en bed
- Kostwinner
- Gehuwd
- Geregistreerd
partnerschap
- Ongehuwd
- Onbekend
- Weduwe/weduwnaar
Thursday, April 26, 2012
Software Review
Since I am involved in the software review & guideline team at my work, I've spent sometime to study about review process, which I want to share with you in this blog.
The benefits of software review:
• Increase software quality, reduce bugs.
• Opportunities to learn (for both the code authors and the reviewers), as a mean for knowledge transfer to junior developers.
• To foster communication between developers.
• Various study showed that review process save costs (e.g. $21 million reported by HP). It's cheaper to fix the bugs in the earlier phases (design, development) than in the later phases (QA/test phase, shipped products)
• As a part of best practices/standard e.g. PSP, CMMI3.
• Motivate the developers to improve their code quality in order to avoid "bad scores" during review. This ego-effect still works even when the random-review covers only 30% of the total codes
The disadvantages of review:
• Cost time. Solution: limit time (e.g. max 1-2 hours)
• Developers have to wait for the reviewers, might create delay in the pipeline. Solution: the project manager has to include software review process in the plan including the time & resources (the reviewers for review, the developers for rework).
• The code author feels hurt when someone else points their mistakes. Solutions: be sensitive/friendly when discussing the findings, both the reviewers & authors agree on the positive benefits, the reviewers give also positive feedbacks to the authors, focus on the codes not the authors.
• The developers think that they have better things to do. Solution: support from the management (e.g. enforce the review process formally).
An example of a review process, which is consisting of 3 steps:
1. "Over the shoulder" short session (30min)
The author guide the reviewer through the code: the entry point, most important classes and the relationships between them. He also explains the flow, sequence & concurrency mechanism and the patterns/algorithms used. This session is similar to a pair programming session. However we need to aware of the disadvantages of this method:
• the author has too much control with the scope & pace of the review.
• The reviewer has barely time to check properly.
• The reviewer tends to condone the mistakes after hearing the authors explanations.
That's why we need to keep this session short and follow this session with a private-review session.
2. Private-review (30-90min)
Without involvement of the author, the reviewers check out the code from SCM (e.g. svn), check some documentations (usecase, specs, design), do fast sanity check, perform some test/validation (e.g. soapui), check against checklists & specifications, and read some parts of the codes.
3. Past review activities:
• The reviewer discussing the findings with the author (30 min)
• consult with the product owner, architect, team-lead, project-manager regarding the risks, bug priorities & reworking impact for the plan
• create bug tickets in the trac/bugzilla
• make an appointment for follow up
Some best practices:
Determine the scope / part of the project for review, based on: risk analysis and author's error log, e.g. Based on his personal log, Bob (the author) knew that he often made mistakes with web security, so he advised Alice (the reviewer) to concentrate to the security issues of his web codes.
To improve the process, you need to define metrics in order to measure the effect of the changes. These metrics can be external (e.g. #bugs reported by QA team, #customer tickets) or internal (e.g. #bugs found, time spent, loc, defect density, complexity measure). Based on the #bugs found by 2 reviewers, you can guess the estimated total bugs and review yield.
Checklist is the most efficient tool for reviewer. The checklist should be short (less than one A4) and describe the reasons, risk level (based on damage/impact, popularity, simplicity to perform), references for further information.
Perform self-review using personal checklists (since everybody has a unique tendency for certain mistakes).
Take advantage of automatic tests (e.g. checkstyle, findbugs, pmd in java). Some companies include these tests in their continuous integration test and their metrics then can be showed in a graph to highlight the quality trend (e.g. bug reduction vs sprint cycles).
Review meeting is not the most effective way to review. It costs more man-hours. It's better for the reviewer to be alone concentrating reading the code.
Maintain reviewer's concentration by limiting the time for each review (max 1.5 hour, 400 loc (line of code)/review). Slowing down to read the code carefully (max 500 loc/review).
Having the code authors annotate the code appropriately (e.g. the patterns/algorithms used: visitor pattern, quick sort, etc.).
The code authors provide notes for his/her project: starting point/files to begin, important classes, dependency/class diagram, patterns used, where to find the documentations (use case, specs, design doc, installation guide), test cases (e.g. web service request-response examples). This information is useful not only for the reviewers but also in case the author leaves the company (e.g. a temporary external consultant). You can use a trac/wiki as a collection point for the information.
Verify/follow up if the bugs is really fixed.
Beware not to compare orange with apple: the #bugs found in a code is not only depend on the developer expertise but also:
• how complex the problem is
• how many reviewers, time spent, their expertises
• specification & code maturity (development version, beta version, shipped product)
• programming languages
• tools (IDE, validator, etc)
Review-team lead / process owner responsibilities:
• maintain expert knowledge of the reviewers, arrange trainings if necessary
• establish and enforce review policies
• lead the writing and implementation of the review process and action plans
• define the metrics, make sure that they're collected and used
• monitor the review practices and evaluate their effectiveness
Process assets:
• process description
• guidelines & checklists
• issues tracking system e.g. trac/bugzilla
Where to do the review in a typical software process:
To be continued: http://soa-java.blogspot.nl/2012/09/the-review-process.html
Source: Steve's blogs http://soa-java.blogspot.com/
Any comments are welcome :)
Literatures:
11 Best Practices for Peer Code Review
http://support.smartbear.com/resources/cc/11_Best_Practices_for_Peer_Code_Review.pdf
Best Kept Secrets of Peer Code Review by Jason Cohen
Plus: recently new, supported by scientific analysis of literature & field studies, down to earth advices (instead of management jargons high in the clouds). minus: repetitive advertisements for their review-tools.
Peer Reviews in Software: A Practical Guide
by Karl Wiegers (Paperback)
Seven Truths About Peer Reviews by Karl E. Wiegers
http://www.processimpact.com/articles/seven_truths.html
OWASP code review guide
https://www.owasp.org/images/2/2e/OWASP_Code_Review_Guide-V1_1.pdf
Subscribe to:
Posts (Atom)







