Flow service code coverage

Is there a way to extract code coverage statistics for a flow service? lets say we test a flow service with a set of inputs and i want to see a report that shows the % of code coverage based on the test data. This is basically to identify dead code in the service.

Is it possible to use some kind of “profiler” for this ? Any inputs would be appreciated.

1 Like

No there is no way out of box:

Are you talking about flow code in a HTML page view?

There is a flag DISABLED=“true” in the flow.xml when a step is disabled in a service that you are trying to find dead code. You will have to build your custom code profiler (to parse XML) that would look up the flow.xml and get the parent XML node or current node when that property is set to true. I believe you could also remove the dead code for a service if you have the first part of the code profiler working (identifying dead code).

May be you can log a feature request from SAG that they might consider including in future release.

Ex:


<INVOKE TIMEOUT="" SERVICE="test.pub:deletefiles" VALIDATE-IN="$none" VALIDATE-OUT="$none" DISABLED="true">
<COMMENT></COMMENT>

Akshit,

Thanks for chimming in and further clarification details on this:

So is this a standard way of editing the flow.xml rather than a extended setting globally? Is this setting usage documented well in the Developers or IS guides any pointers?

TIA,
RMG

No this is not documented anywhere or at least i could not find anything, i came across this setting a while ago during my research on something similar (BPM models) to what Balachandar needs here. The only reference that i see about this setting is one line sentence in the developers guide “Be aware that disabling a step sets a persistent attribute that is saved in the flow service”. This DISABLED=“true” is not a manual setting, this gets auto generated when you disable a step in the flow.

In the past i have seen some customers who have used custom Flow code generators which would generate a flow.xml (also node.ndf) file with standard try\catch blocks with the client specific Framework services like logging, error handling service etc. In general these code generators would create the skeleton code on click of a DSP page with the client standards where by the Developer can develop the core logic and use this skeleton to implement it.

I do not know of any extended setting that is related to the enable\disable code functionality.

Thanks for the response :!:

The dead code for me is not a disabled step. Its basically a step in the flow which could be a branch/loop which did not get called or executed at all because the test data that i used for my unit testing did not have the required data to go thru those branch or loop steps. This is one of the major challenge we face today in unit testing a big service with lots of logic in it. No matter how hard we try to test all possible scenarios there are always misses. That’s the reason why i wanted to see if there are any ways to get a report every time i test/trace a service that shows the code coverage % based on the test data inputs i used. I was wishing for something like this 4 years back and I still see the value in this especially if SAG themselves provide something out of box. If I am not wrong i believe we have something like this in the Java world.

One of the short term solution/suggestion that came up internally was to take the screen shots of the trace results with a grey box on every step. But again here there are 2 issues, I will not always be able to have one test data covering all scenarios so i will have to run multiple times and take multiple screen shots. Also the grey boxes are again not that clearly visible.

Any other ideas on how we can achieve this would be appreciated.

Hi Bala,
I don’t think this might cover all test scenario’s even if you pass through all pieces of code. A branch on a variable would have worked fine with a right value, and the same can lead to an exception with a ‘null’ value and the result of this null might be based on the previous statement. I see the probabilities are more if you want to test each and every scenario.

Eg., a 3 step service can lead to 9 scenarios. 0-0-0, 0-0-1,… to 1-1-1. Testing just last scenario 1-1-1 cannot give an assurance that all the other 8 scenario’s would work.

In general, breaking the larger piece of code to smaller units of flow services would help a lot for re-usability, debugging, fixing, testing etc.,

My 2 cents.

-Senthil

Hi, I am not saying that I will treat the visual representation of the code coverage % of a flow service as a means for signing off the quality :slight_smile: The quality check via unit testing is a must and every developer should do it with due diligence. There is no second thoughts on this. Breaking the logic in to small services will definitely help in improving the quality by making it easier for the developers to consider all scenarios.

However a visual representation showing the extent of the code coverage will provide some hint to the developer so that he can work more on getting/preparing the required test data. Also at a high level a team lead or a manager can have a look at this coverage % report.

I think i misunderstood the term dead code, i thought dead code is something that is never used or executed during run-time.

I am not sure there is a way to do it in WM tool set, a basic Google search for what you are asking resulted in this URL, it might help. I never used it but looks like it is the only dedicated WM Service profiler provided by a third party vendor. From the screen shots it looks similar to profiler in J2EE Eclipse.

I believe there used to be a company called Green hat that provided something similar but i can not find it anymore.

May be there is no ways for visual representation and could be a feature request for SAG? :smiley:

Well this is a good topic to start with not seen this type of req recently…continue:

I have added this request in Brainstorm and ID is 1057849. Pls vote for this whenever you have time. Lets see :slight_smile:

we will …thx

You need to build a custom untility… some have it

you bet:)

I bet, I heard some developed

Believed: :smiley:

Here’s what I’d like, as an offshoot of the same idea: if I have code folders like pub, priv, docs, adapters, etc, I’d love to be able to run a scanner that showed what packages were using services in adapters, priv etc in other packages, ie services they shouldn’t be using.

Not as good as making Flow better, but it’d be a start!

Yes you are right to start with.

Hi,

We have created this tool for our service monitoring:
[url]http://techcommunity.softwareag.com/web/guest/pwiki/-/wiki/Main/RichStatistics+-+how+to+easly+monitor+the+service+activity+on+your+Integration+Server[/url].

It is not exactly a code coverage took, but you can see the full stack of a service execution.

br,
Vlad

Hi Vlad, Eventhough this is not related to code coverage this looks very interesting. Let me check this out :slight_smile:

I am sure each one of us are implementing lots of functionalities like this which ideally should be offered out of box. SAG should also focus on such items in addition to launching new versions e.g. 9.5 :lol:

Thanks for sharing :!: