Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
Is it possible to create Try Catch block which will run every single function?

So, my question is generally about some debugging and troubleshooting for people who don't really understand programming at all. Is it possible to create a method like:

public foo(method){
try(){
method();
}
catch(error){
console.log(method().name + 'caused an error'); 
throw Error;
}

is it generally okay to do something like that, yes, I know that errors are shown very good even without something similar but if, for example I'm doing testing for a client who wants to know about everything and see what's exactly goes wrong. I'd like to let him know about problems as much as I can, I already have allure reporter on my project but it is not enough

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Probably it is. But there are so many good ways to use logger to use allure report with step description for every single method that you run.

So people will see every action which is called in human-readable form. They will have a stack trace with screenshot and video, it can't get better than that.

To use allure in playwright.config file use

reporter: [
    ["allure-playwright"],
    ["list"]
],

also, list

"allure-commandline": "^2.13.0",
"allure-playwright": "^2.0.0-beta.14",

in package.json

You can cal every method like this

await test.step('Exatc action in method described in human readable language e.g. Click Send Button', async () => {
    // ...your method
  });

Also, there is a test error built-in playwright, so you do not need to build your own. See section:

testStep.error
type: <TestError>

on: https://playwright.dev/docs/api/class-teststep#test-step-error

For opening allure use:

"open-allure": "allure generate ./target/allure-results -c ./allure-report && allure open",

And one more thing. Playwright has the best debug mode on market, it shows your code and every action in browser see: https://playwright.dev/docs/inspector

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda