DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report

Build Tests While Building Applications

Frank Cohen user avatar by
Frank Cohen
·
Oct. 02, 08 · Interview
Like (0)
Save
Tweet
Share
8.80K Views

Join the DZone community and get the full member experience.

Join For Free
I've been doing some thinking lately about how we build and test applications. I'm no agile expert but I am impressed with the concepts of test-first and iterative development. Waterfall seems like it is designed to kill developers, testers, and projects by its nature.

I've never really understood the test-first thing in its entirety. In an SOA environment, it seems to me that test-first would put the emphasis on defining interfaces first and building tests against the interface (both good things.) The interface is just an interface. So I wonder if having some of the application logic implemented behind the interface is required to really do test-first right.

It seems to me that some sort of enhancement of agile could help here. One where I build the application and the test at the same time and iteratively.

I am trying this out using an open-source Ajax development framework (Appcelerator) and my test framework (TestMaker.) This is just a bunch of notes right now. I'm hoping to have something coded in the next 2 weeks. Here's how it would work:

Appcelerator uses non-standard tags in HTML to implement Ajax functions. For example:

<script src="javascripts/appcelerator.js"
type="text/javascript"></script>


This provides Appcelerator's function library to a page.

<input type="text" id="username" validator="required" decorator="required" fieldset="login"/>


When the page loads Appcelerator provides Ajax functions for validator, decorator, and fieldset attributes of the <input> tag.

<input type="button" value="login" activators="username,password" id="button"
on="click then r:login.request" fieldset="login"/>


The fieldset attribute is used to link <input> elements (or divs, spans) for the purpose of sending a message. The example above links the username to the submit button. When the user clicks submit the "on" attribute tells Appcelerator to click the submit button and send a login.request message to the server handling the log-in. (Appcelerator implements the server side component and the messaging for you.)

This kind of tag framework approach to application composition and development is wide spread and makes application development easier. In the above example, I didn't have to do any JavaScript work to deliver an Ajax enabled log-in page.

My thought is to extend the tags to include test definition tags. For instance:

<script src="javascripts/testmaker.js" type="text/javascript"></script>

<input type="text" id="username" validator="required" decorator="required" fieldset="login" test_input_data="dpl:mycsvfile field:username"/>

<input type="button" value="login" activators="username,password" id="button" on="click then r:login.request" fieldset="login"
test_verify="verifyTitle:Main menu"
/>



In the example above, when the page loads the testmaker.js functions respond to the test_input_data tag by reading from a comma-separated-value (csv) file using a Data Production Library (DPL.) The first row of the csv file defines field titles. TestMaker sets the username input field with the username value in the csv file.

When I want to test the page I use a test runner that loads the page and clicks the login button. The response to the login must be a page with a title of "Main menu". Otherwise, the test throws an exception and I could that as a failed functional test.

What I'm after here is a way to build the tests as we build the application.

I would love your feedback, thoughts, and ideas on this.

-Frank

From The Cohen BlogĀ 

Testing application Build (game engine)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Demystifying the Infrastructure as Code Landscape
  • Strategies for Kubernetes Cluster Administrators: Understanding Pod Scheduling
  • Integrate AWS Secrets Manager in Spring Boot Application
  • Tackling the Top 5 Kubernetes Debugging Challenges

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: