|Re: how to map Code units artifacts to java/.c/.h files? [message #757241 is a reply to message #722633]
||Thu, 17 November 2011 10:16
| Swapna Missing name
Registered: July 2009
We can extend the OSEE code-units to store workspace location of the file , this can be done by adding an attribute Content-URL, which can be used to map the code unit to the java/.c/.h file with workspace relative path.|
Linking of requirements to code can be done using the TraceUnitHandler extension point.The attached mail contents can also help in establishing the tracing between requirements to code. This reply was from the OSEE core team,
I believe what you want to do is import trace units. You can do this via the import wizard. You'll need to implement a couple of classes and make extensions from them.
Take a look at DemoTraceUnitResourceLocator. You will need to make your own ITraceUnitResourceLocator. This locator basically validates files that you select from the import wizard. So if you select a directory, each file will go through this locator. Add logic here to determine if the file is a valid source file that you want to create a trace unit from. The locator you implement will also determine what type of artifact gets created during import. We have a locator that locates test scripts and returns TestCase as the type. If our trace unit is of type TestCase, we have a Tagger that will put an annotation with the guid of the TestCase artifact in the source file. Look at the process method in TraceUnitToArtifactProcessor.
Next, you'll want to implement your own ITraceParser. Take a look at the DemoTraceParser. The most important method is getTraceMarks. That method should parse your source file, pull out trace marks that relate that file to a requirement, and return them. We do this via regular expressions.
Example:You can include traceability in comments // TRACEABILITY(Uses, SW_REQ_1)
Then you would have a regex search for those marks and the TraceMark created would be TraceMark("Uses", "SW_REQ_1"). The requirement being traced to needs to be some type of abstract software requirement.
Once everything is imported, you can easily go from your source file in package explorer to the associated artifact (which will be related to the requirements that it had trace marks for and vice versa. To go from artifact explorer, right click on your trace artifact, and select "Reveal in Workspace." If you have the associated source file in your workspace, it will open it up. Depending on how your source files are named and what artifact type your locator returns, you might have to make changes. The code for this is in RevealInWorkspaceOperation.
To go from the source file to the associate artifact, have the source file opened in the editor, right click and select "Find Trace Unit Artifact". Use the one on the top level menu, not the one under OSEE menu. This search uses the guid added in the annotation from importing.
Hopefully this can get you started.
Powered by FUDForum
. Page generated in 0.03940 seconds