Rational Test

 View Only
Expand all | Collapse all

Documented Custom Code snippet is deprecated

  • 1.  Documented Custom Code snippet is deprecated

    Posted Wed February 03, 2021 07:19 PM

    All,

    The IBM Knowledge Center suggest using this Custom Code Java snippet to add a custom counter (https://www.ibm.com/support/knowledgecenter/SSMMM5_10.0.1/com.ibm.rational.test.lt.common.doc/topics/creportcounter.html):

    {tes.getStatisticsManager().getStatTree().getDistribution(new String[]{"Custom Counter","MyTest","MyValue"}) .submitDataPoint(Double.valueOf(Math.random()*100.).longValue());

    However, the Java editor reports that the methods getStatisticsManager(), setStatTree() and getDistribution are all deprecated (although they do seem to work).

    Are there different/newer methods to create/manipulate custom counters?

    Thanks,

    Michael


    #SupportMigration
    #RationalPeformanceTester
    #Support


  • 2.  RE: Documented Custom Code snippet is deprecated



  • 3.  RE: Documented Custom Code snippet is deprecated

    Posted Thu February 04, 2021 03:42 PM

    This example still has errors, we're investigating this internally and will update the example, no ETA yet.


    #RationalPeformanceTester
    #SupportMigration
    #Support


  • 4.  RE: Documented Custom Code snippet is deprecated

    Posted Thu February 04, 2021 04:28 PM

    Thanks Paul.


    For the most part, we can figure out what to do from here using the link you provided. However, we would also like to be able to reference the Java Interface documentation for these methods (as is available here for the IStatTree Interface: https://www.ibm.com/support/knowledgecenter/SSBLQQ_10.0.2/com.ibm.rational.test.lt.tes.doc.isv/reference/api/IBM_RPT_TES/com/ibm/rational/test/lt/kernel/statistics/IStatTree.html#getStat(java.lang.String,%20com.ibm.rational.test.lt.kernel.statistics.impl.StatType.


    I looked on the IBM site, but could not find anything. Can you provide a link?


    Thanks again,

    Michael


    #Support
    #RationalPeformanceTester
    #SupportMigration


  • 5.  RE: Documented Custom Code snippet is deprecated

    Posted Fri February 05, 2021 02:36 PM

    our crack dev team is working on a better example for the custom counter example, but in interim I was provided this more simpler example with caveat it works with 10.1 or later. You'll have to customize the report to show the custom counters.

    -------

    package customcode;

    import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;

    import com.ibm.rational.test.lt.kernel.services.stats.IStatisticsManager2;

    import com.ibm.rational.test.lt.kernel.services.stats.IValueCounter;

    /**

    * L3 Support

    */

    public class CustomCounters implements com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {

    /**

    * Instances of this will be created using the no-arg constructor.

    */

    public CustomCounters() {

    }

    /**

    * This custom code reports two custom values, a "Hits" counter and a "RandomValue" measurement (0-14).

    * When adding counters to a report, Both values will appear under Custom in the available counters:

    *

    * Custom

    * CustomCount

    * Hits

    * CustomStat

    * RandomValue

    *

    * This code will work with RPT 10.1 and later; it is not applicable to earlier releases.

    **/

    public String exec(ITestExecutionServices tes, String[] args) {

    IStatisticsManager2 mgr = tes.getStatisticsManager2();

    mgr.getCountCounter("Custom", "CustomCount", "Hits").increment();

    IValueCounter value = mgr.getValueCounter("Custom", "CustomStat", "RandomValue");

    value.addMeasurement(System.currentTimeMillis() % 15);

    return null;

    }

    }


    #SupportMigration
    #Support
    #RationalPeformanceTester


  • 6.  RE: Documented Custom Code snippet is deprecated

    Posted Fri February 05, 2021 02:45 PM

    Hello, can we get clarification on exactly which methods are meant by "these methods"?


    Thank you


    #SupportMigration
    #Support
    #RationalPeformanceTester


  • 7.  RE: Documented Custom Code snippet is deprecated

    Posted Fri February 05, 2021 07:26 PM

    Paul-

    We're looking for any documentation on usage for any/all of the endpoint methods in the example code as well as you're pasted code above. Given the following from your example:

    IStatisticsManager2 mgr = tes.getStatisticsManager2();


    We're looking for documentation on, e.g.:

    • mgr.getCountCounter()
    • mgr.getValueCounter()
    • mgr.getValueCounter().addMeasurement()


    More importantly, from the example page, where is the documentation for every endpoint method? E.g.:

    • path()
    • CountAggregationLevel.RATE_RANGE
    • ValueAggregationLevel.RANGE
    • CounterUnits.MILLISECONDS
    • mgr.getFolder()
    • database.DatabaseAccess
    • database.TransactionResult
    • unit()
    • VerdictEvent.VERDICT_PASS


    I've left things out above, but we need to be able to understand all of the methods shown in the example code and things that weren't shown! Note that we still only have RPT 10.1.0 right now https://help.hcltechsw.com/onetest/hclonetestperformance/10.1/com.ibm.rational.test.lt.common.doc/topics/creportcounter.html


    We don't need a separate URL for each method, but we do need to know the root documentation location for every area so we can drill down. Some sort of high-level link should be on the example page, but we have an immediate use for these counters, so anything you can give us now would be great.


    Thanks.


    #SupportMigration
    #Support
    #RationalPeformanceTester


  • 8.  RE: Documented Custom Code snippet is deprecated

    Posted Mon February 08, 2021 02:11 PM

    Hi, I'm checking with the development team on this, thank you


    #Support
    #RationalPeformanceTester
    #SupportMigration


  • 9.  RE: Documented Custom Code snippet is deprecated

    Posted Wed February 10, 2021 06:36 PM

    1) Start

    RPT and go to Help->Help Contents->IBM Rational Performance

    Tester API Reference->IBM Rational Performance Tester TES

    Click on the "Frames" option:


    2)Click on IStatisticsManager2 to see information on the classes available for custom counters:


    #SupportMigration
    #RationalPeformanceTester
    #Support


  • 10.  RE: Documented Custom Code snippet is deprecated

    Posted Tue February 23, 2021 02:21 PM

    Thanks for the info Paul.


    For the most part, StatisticsManager2 does what we need except one capability - the ability to retrieve the current value for a given Counter (for instance Response Time For All Pages - Average). Is it possible to get the current value for existing counters via Custom Code?


    Thanks,

    Michael


    #RationalPeformanceTester
    #SupportMigration
    #Support