Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58598

Nunit Integratiion in Jenkins Pipeline

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • groovy-plugin
    • None
    • Windows Server 2016

      Hi,
       
      I have a Groovy DSL where i want to calculate the code coverage using Dotcover. I am executing the Powershell script to calculate the code coverage. The powershell is working fine in Jenkins inline Pipeline script. But when i use the same powershell script in groovy file it's throwing error. Any inputs on this scenario?
       
      build.groovy:
       
      def artifacts_path = "${workspace}/artifacts"
      def tests_path = powershell(returnStdout: true, script: '''(get-childitem -include \'.Tests.dll\' -recurse -Path ${workspace}| select -expand FullName | where {$_ -like \'\\bin\\Release\\*\'})''')
      powershell label: '', script: """
      & ${dotCover_path} cover \"/TargetExecutable=${nunit_path}\"  \"/TargetArguments=\"${tests_path}\" /result=${workspace}\\artifacts
      Testresult.xml \"  \"/ReportType=HTML\" /Output=\"${artifacts_path}\\dotCover.html\"
      """
       
      Error:
       ++ 
      [Pipeline] powershell powershell.exe : At C:\home\jenkins\OXP-Test@tmp\durable-d28e3d6a\powershellScript.ps1:14 char:5 At C:\home\jenkins\OXP-Test@tmp\durable-d28e3d6a\powershellWrapper.ps1:3 char:1 + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (At C:\home\jenk...t.ps1:14 char:5 :String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError + " " "/ReportType=HTML" /Output="/home/jenkins/OXP-Test/artifacts\dotC ... + ~~~~~~~~~~~~~~~~~~ Unexpected token '"/ReportType=HTML"' in expression or statement. At C:\home\jenkins\OXP-Test@tmp\durable-d28e3d6a\powershellScript.ps1:14 char:25 + " " "/ReportType=HTML" /Output="/home/jenkins/OXP-Test/artifacts\dotC ... + ~ You must provide a value expression following the '/' operator.

            vjuranek vjuranek
            alfredantony012 Antony Alfred
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: