jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sonam Chauhan" <sonam.chau...@ce.com.au>
Subject RE: JMeter SLOC estimation
Date Sat, 18 Oct 2008 13:29:39 GMT
Hi Sebb - 
 
I reckon each element (eg, an HTTP Sampler element, its Response Assertion element) count
as distinct lines of code. I see elements as method calls, and fields as mere parameters,
(so an element is equivalent to 1 LOC or 'K' LOC) with one exception though - fields which
are typically specified as arrays (say, HTTP POST variables in the HTTP Sampler) would count
each specified array element as a separate line of code. 
 
Thanks for your detailed reply and excellent (as always) insights and suggestions. I hope
to follow those up soon. 
 
Just an out-there question: do you think its possible to use instrument JMeter to count elements
as the JMX file is parsed by JMeter on startup -- say, use something like AspectJ to report
on XStream deserialization calls?
 
Regards,
Sonam
 

________________________________

From: sebb [mailto:sebbaz@gmail.com]
Sent: Fri 10/17/2008 9:20 PM
To: JMeter Users List
Subject: Re: JMeter SLOC estimation



On 17/10/2008, Sonam Chauhan <sonam.chauhan@ce.com.au> wrote:
> Hi  - Not-so-quick software estimation question: How can one analyse a
>  JMeter testscript (.jmx) file to get an approximate source lines of code
>  (SLOC) count for it?
>

Interesting question. Depends on what you mean by SLOC ...

I suppose one measure might start with counting the number of test elements.
But is nesting important, or is that taken care of by the need to have
parent controllers?

Also, what about fields in the elements? Are these to be counted?
In which case, do you count all fields, even empty ones?
Or are fields akin to parameters in languages such as Java and C (i.e.
they can appear on the same line)?

>
>  To complicate matters, some testscripts I need to estimate are JMeter
>  1.9 vintage and have this structure:
>
>  ---------------------------------------
>
>  <?xml version="1.0" encoding="UTF-8"?>
>
>  <node>
>
>  <testelement class="org.apache.jmeter.testelement.TestPlan">
>
>  ---------------------------------------
>
>
>
>  Some others are JMeter 2.x and seem to have a different structure. For
>  eg:

Yes, the later plans are usually somewhat smaller as they use XStream
(with custom aliases) for serialisation.

>  ---------------------------------------
>
>  <?xml version="1.0" encoding="ISO-8859-1"?>
>
>  <jmeterTestPlan version="1.2" properties="2.0">
>
>   <hashTree>
>
>     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="...
>
>  ---------------------------------------
>

In both the old and the new formats, the files are reasonably
well-formatted (plenty of line breaks) which means that one does not
necessarily need to use XML tools.

One way to establish which elements in the plan need to be counted
would be to fill the relevant fields (i.e. element name and
parameters) with marker value(s) that don't appear in the test plan -
e.g. 12345 - and see where these appear. This does not allow for
choice buttons - but you can compare two test plans with different
settings to find those.

Having established the items to scan for, you could use grep with a
data file to count the occurrences, or of course XSLT (if you are
familiar with that).

>
>  Regards,
>
>  Sonam Chauhan
>
>
>
>
>  The information contained in this email and any attached files are strictly
>  private and confidential. This email should be read by the intended addressee
>  only.  If the recipient of this message is not the intended addressee, please
>  call Corporate Express Australia Limited on +61 2 9335 0555 or Corporate Express
>  New Zealand Limited on +64 9 279 2555 and promptly delete this email and any
>  attachments.  The intended recipient of this email may only use, reproduce,
>  disclose or distribute the information contained in this email and any attached
>  files with Corporate Express' permission. If you are not the intended addressee,
>  you are strictly prohibited from using, reproducing, disclosing or distributing
>  the information contained in this email and any attached files.  Corporate
>  Express advises that this email and any attached files should be scanned to
>  detect viruses. Corporate Express accepts no liability for loss or damage
>  (whether caused by negligence or not) resulting from the use of any attached
>  files.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org




The information contained in this email and any attached files are strictly
private and confidential. This email should be read by the intended addressee
only.  If the recipient of this message is not the intended addressee, please
call Corporate Express Australia Limited on +61 2 9335 0555 or Corporate Express
New Zealand Limited on +64 9 279 2555 and promptly delete this email and any
attachments.  The intended recipient of this email may only use, reproduce,
disclose or distribute the information contained in this email and any attached
files with Corporate Express' permission. If you are not the intended addressee,
you are strictly prohibited from using, reproducing, disclosing or distributing
the information contained in this email and any attached files.  Corporate
Express advises that this email and any attached files should be scanned to
detect viruses. Corporate Express accepts no liability for loss or damage
(whether caused by negligence or not) resulting from the use of any attached
files.

Mime
View raw message