tcunit / TcUnit-Runner

Program that makes it possible to automate runs of TcUnit unit tests
Other
34 stars 17 forks source link

Explicit execution of static analysis via the AI #18

Closed kumaraswamygaviyappa closed 3 years ago

kumaraswamygaviyappa commented 3 years ago

Would it be possible to include RunStaticAnalysis in TcUnit-Runner arguments/options when there are no BuildError

The use case as mentioned in TcUnit/issues/93.

  1. The USB license stick in the server. Test server architecture is as mentioned Example2-_Separate_Jenkins_master_Jenkins_agent
  2. Developers pushes the code to server, static analysis will be triggered by Jenkins in the Server.

I tested this in tcunit/ExampleProjects by adding below code and it worked well.

image

If this included in TcUnit-Runner , it will be a All in one Framework :)

sagatowski commented 3 years ago

This should be in a separate tool, that can be included in your Jenkins pipeline as a separate step after execution of the tests. So you basically create a pipeline, where you have the TcUnit-Runner running, and then (depending on result), the Static Code analysis tool.

I wrote a very basic implementation of a tool like that several years ago that's also MIT open-source, and with a bunch of documentation to it. It's available at: https://github.com/sagatowski/TcStaticAnalysisLoader

kumaraswamygaviyappa commented 3 years ago

Hi @sagatowski , Yes, i used same implementation to learn TwinCat programming/Jenkins and tested RunStaticAnalysis. My understanding is, when Jenkins pipeline is implemented, visual studio process will be enabled two times.

  1. visual studio process will build the project if no errors RunStaticAnalysis.
  2. visual studio process initiated by TcUnit-Runner which builds the project and runs Tcunit frame work.

Is that possible to merge. Is my understanding correct?

sagatowski commented 3 years ago

It depends on what your definition of "to merge" is. If it means to run as a single workflow in Jenkins, then yes.

sagatowski commented 3 years ago

Have you experimented with pipelines in Jenkins? https://www.jenkins.io/pipeline/getting-started-pipelines/

I think you could probably put these two programs into a pipeline.

kumaraswamygaviyappa commented 3 years ago

@sagatowski

I could achieve this using pipeline. Thank you for the suggestion.

image

VS is invoked 3 times. In Stages Build,TE1200 and Unit Testing. I used TcStaticAnalysisLoader here. And again VS is invoked by TcUnit-Runner in stage Report Analysis

I feel this not the efficient way but it's working as i wanted.