Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newman-reporter-htmlextra 'not found' when running in kubernetes cluster #433

Closed
1 task done
mastafadhil opened this issue Apr 4, 2024 · 5 comments
Closed
1 task done
Labels
area: newman-related This issue relates to the Newman project state: triaged This issue has been triaged

Comments

@mastafadhil
Copy link

Is There An Existing Issue

What Are You Seeing

I am running my pipeline by using kubernetes cluster with docker image that installs :
node - v20.11.1
npm - v9.4.0
newman - v6.1.2
newman-reporter-htmlextra - v1.23.1

the issue appears that the pipeline is not able to detect newman-reporter-htmlextra after successfully installed it, thus unable to generate reports from the run. Would really appreciate if anyone could help me on this. Thank you so much in advance.

Steps To Reproduce The Issue

stage('Run Postman Tests') {
steps {
script {
try {
container('python') {
sh '''
cd Postman

                            npm install -g newman-reporter-htmlextra --cache=".htmlextra_global"
                            newman-reporter-htmlextra -v
                            newman run https://api.postman.com/collections/abc' -e "env.postman_environment" -r cli,htmlextra --reporter-htmlextra-export "/home/jenkins/agent/workspace/QA Pipeline/Postman/Reports/Test-Server_IT-Manager_$(date +'%Y%m%d_%H%M%S').html"
                            
                        '''
                    }
                } catch (Exception e) {
                    // Handle the error here if needed
                    echo "An error occurred: ${e.message}"
                }
            }
        }

Full Newman Command Or Node Script

+ npm install -g newman-reporter-htmlextra '--cache=.htmlextra_global'
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 165 packages in 8s

13 packages are looking for funding
  run `npm fund` for details
+ newman-reporter-htmlextra -v
1.23.1
+ date '+%Y%m%d_%H%M%S'
+ newman run 'https://api.postman.com/collections/abc' -e env.postman_environment -r cli,htmlextra --reporter-htmlextra-export '/home/jenkins/agent/workspace/QA Pipeline/Postman/Reports/Test-Server_IT-Manager_20240404_062218.html'
**newman: could not find "htmlextra" reporter
  ensure that the reporter is installed in the same directory as newman
  please install reporter using npm**

HTMLEXTRA Version

1.23.1

Newman Version

6.1.2

Additional Context

No response

@mastafadhil mastafadhil added state: needs-triage This issue needs to be triaged type: bug Something isn't working labels Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

Hey @mastafadhil: 👋 - Thanks for helping to make the reporter better by raising this ticket. I will take a look as soon as I can and get back to you. Cheers, Danny.

@DannyDainton
Copy link
Owner

Hey @mastafadhil

Newman and the reporter need to be installed in the same directory.

Are you able to do a which command or the equivalent on that OS to see where they are both getting installed?

@DannyDainton DannyDainton added area: newman-related This issue relates to the Newman project state: triaged This issue has been triaged state: awaiting-response Waiting the for the author to respond and removed type: bug Something isn't working state: needs-triage This issue needs to be triaged labels Apr 4, 2024
@mastafadhil
Copy link
Author

mastafadhil commented Apr 5, 2024

hey Danny,

Sorry for the late response. I tried to do 'which' for both newman and newman-reporter-htmlextra and apparently theyre not installed on the same directory, but even when i tried to do a 'cp' to transfer newman-reporter-htmlextra into the same directory in the script it still couldnt be found.

However, i finally managed to make it work by installing it directly in the pipeline, instead of having it pre-installed in the Dockerfile, now the pipeline is able to run the postman scripts and generate reports into the correct directory declared in the script. Here's a snippet of a working pipeline script :

stage('Run Postman Tests') {
            steps {
                script {
                    try {
                        container('python') {
                            sh '''
                                cd Postman
                                
                                npm install -g newman-reporter-htmlextra --cache=".htmlextra_global"
                                newman-reporter-htmlextra -v
                                newman run https://api.postman.com/collections/abc?access_key=abc -e "env.postman_environment" -r cli,htmlextra --reporter-htmlextra-export "/home/jenkins/agent/workspace/QA Pipeline/Postman/Reports/Test-Server_IT-Manager_$(date +'%Y%m%d_%H%M%S').html"
                            '''
                        }
                    } catch (Exception e) {
                        // Handle the error here if needed
                        echo "An error occurred: ${e.message}"
                    }
                }
            }

@DannyDainton DannyDainton removed the state: awaiting-response Waiting the for the author to respond label Apr 6, 2024
@DannyDainton
Copy link
Owner

It seems like you have solved the issue. That's great.

That error message doesn't come from my reporter, it's from the Newman code and happens for any reporter that's been mentioned in the command but not in the same directory.

I'm going to close this issue now.

Thanks for using the reporter!! ❤️

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: newman-related This issue relates to the Newman project state: triaged This issue has been triaged
Projects
None yet
Development

No branches or pull requests

2 participants