Giter VIP home page Giter VIP logo

Comments (18)

kinow avatar kinow commented on August 25, 2024

Hi konobi!

You're right, I had trouble setting up this part in tap4j, and also wanted to have more time to replace the regex parser by a more robust one.

I will have a look on it as soon as I find some spare time.

Feel free to ping me here if I take too long, or send pull requests ;)

Thanks!

from tap4j.

konobi avatar konobi commented on August 25, 2024

Unfortunately I'm not a java guy at all, I'm just using the TAP plugin for jenkins (thanks for that btw).

from tap4j.

kinow avatar kinow commented on August 25, 2024

Don't mention it. Would you have some spare time to test an alpha version of the plug-in? :-) Always good have somebody else to check the changes in the code.

from tap4j.

konobi avatar konobi commented on August 25, 2024

Yeah, I should be able to get a spare install up and running to test, just let me know.

from tap4j.

konobi avatar konobi commented on August 25, 2024

Ping? any progress?

from tap4j.

kinow avatar kinow commented on August 25, 2024

Hi konobi! I'm currently working on an issue in Jenkins TestLink Plug-in (https://issues.jenkins-ci.org/browse/JENKINS-11894) with due date for this week.

My next development cycle (that starts probably tomorrow) will be on tap4j :)

from tap4j.

kinow avatar kinow commented on August 25, 2024

Hi konobi!

I found some spare time today after lunch and decided to take a look on this issue :-) Here's a summary of my actions:

  • I cloned tap4j repository here from Github and tried to parse the TAP Stream you provided here in the same way the plug-in does
  • It raised an error. Damn! heh
  • Debugged to see where the error was occurring. It was occurring, obviously, in a YAML processing part of tap4j code.
  • Then I copied the YAML content, and pasted in a new file.
  • Created a sample project using SnakeYaml (API that tap4j relies for YAML) to parse this YAML content.
  • It raised an error. Damn again! But now it was complaining of a ':' (don't know the name of this symbol in English heh). It was occurring here:" message: Command failed:".
  • To make sure it was a YAML error, I went to InstantYAML (http://instantyaml.appspot.com/) and pasted the YAML content there. Invalid.
  • Removed the ':' from your original TAP Stream, in the YAML section of the first test result.
  • Worked like a charm! YAY!

This is from YAML entry in Wikipedia:

"Strings

YAML allows one to avoid quoted strings which can enhance readability and avoid the need for nested escape sequences. However, this leads to a pitfall when inline strings are ambiguous single words (e.g. digits or boolean words) or when the unquoted phrase accidentally contains a YAML construct (e.g., a leading exclamation point or a colon-space after a word: "!Caca de vaca!" or "Caution: lions ahead!"). This is not an issue that anyone using a proper YAML emitter will confront, but can come up in ad hoc scripts or human editing of files. In such a case a better approach is to use block literals ( | or > ) rather than inline string expressions as these have no such ambiguities to resolve."

Could you try quote the invalid String, or use block or literals, please? I don't know in which context you are using Jenkins TAP Plug-in, but if you need any help with this too, I would be glad to help.

Let me know if that helps.

All the best,
Bruno

from tap4j.

konobi avatar konobi commented on August 25, 2024

So having looked at it more... it turns out that these sections of a TAP stream aren't actually YAML... they're YAMLish http://testanything.org/wiki/index.php/YAMLish

So producers only need to follow these guidelines and not produce full valid YAML. This is the case with the producers that I'm testing with.

from tap4j.

kinow avatar kinow commented on August 25, 2024

So having looked at it more... it turns out that these sections of a TAP stream aren't actually YAML... they're YAMLish

You're right indeed.

So producers only need to follow these guidelines and not produce full valid YAML

Again, you're right. But a consumer needs to know how to parse the YAMLish generated by you. Let's use Perl here as example (as TAP was created for Perl long ago).

Perl TAP::Parser is a parser for TAP, and it supports YAMLish. I believe the YAML support in TAP::Parser was created based on YAML::Tiny. If you try to parse:


name: John:

YAML::Tiny isn't able to parse it. If you remove the second ':', or if you surround it by ' or ", it will work. It doesn't support the whole YAML specification, but instead of this, it's compliant with an old version I guess. Even though, it's YAML'ish' in a certain way :)

Do you see a solution for this issue in tap4j, without dropping SnakeYAML and standard YAML support? I could write a simple YAML parser, but I would feel like reinventing the wheel.

Do you know a YAML producer (could be in Perl, Python, ...) capable of parsing your YAMLish output?

Cheers, B

from tap4j.

konobi avatar konobi commented on August 25, 2024

Currently I'm using node-tap which has a module on npm called "yamlish" that provides the support. I'll try and get some time to try the output with things like smolder, etc.

from tap4j.

kinow avatar kinow commented on August 25, 2024

I will have a look at both, node-tap and yamlish. As well as at other projects by isaacs :D thanks!

from tap4j.

winrid avatar winrid commented on August 25, 2024

I think I'm having an issue related to this:

while parsing a block mapping; expected , but found Scalar; in 'string', line 1, column 43:
... ssage: "Expected '<table class="email_template_main" cellpadding ...
^
at org.tap4j.parser.Tap13Parser.parseDiagnostics(Tap13Parser.java:494)
at org.tap4j.parser.Tap13Parser.parseLine(Tap13Parser.java:274)
at org.tap4j.parser.Tap13Parser.parse(Tap13Parser.java:199)
... 14 more
Caused by: while parsing a block mapping
in 'string', line 1, column 9:
message: "Expected '<table class ...
^
expected , but found Scalar
in 'string', line 1, column 43:
... ssage: "Expected '<table class="email_template_main" cellpadding ...

Any suggestions? Using TAP plugin with Jenkins (which is awesome!).

from tap4j.

kinow avatar kinow commented on August 25, 2024

Hi @winrid

Any suggestions? Using TAP plugin with Jenkins (which is awesome!).

Thanks :)

If I recall correctly, the problem with this issue was missing surrounding a string with quotes or double quotes. Could you take a look if your YAMLish contains any entries with missing quotes?

from tap4j.

winrid avatar winrid commented on August 25, 2024

We're containing the strings using double quotes but there are also double quotes within the strings... I could escape these strings before sending to TAP (would have to patch Testem/Jasmine) but I think it would be a more solid fix if it escaped the quotes while generating the TAP report (if that's how it works).

from tap4j.

kinow avatar kinow commented on August 25, 2024

I believe both ways would fix your issue, but I'm not aware how Testem/Jasmine work :-( but let me know if there is anything I can do to help you.

from tap4j.

winrid avatar winrid commented on August 25, 2024

Well, all we're doing is running testem which generates the tap file to be processed. Testem does the actual testing.

You can help me I think... I figured out how to escape the quotes in testem (debugged the library for a while until I found where it's printing the error messages to the TAP file) but now TAP is failing on strings like:

while scanning a double-quoted scalar; found unknown escape character .(46); in 'string', line 1, column 621:
... lidate:{pattern:/^([a-zA-Z0-9-.+ ]){1,20}$/i, messages:{patte ...
^
at org.tap4j.parser.Tap13Parser.parseDiagnostics(Tap13Parser.java:501)
at org.tap4j.parser.Tap13Parser.parseLine(Tap13Parser.java:280)
at org.tap4j.parser.Tap13Parser.parse(Tap13Parser.java:199)
... 14 more
Caused by: while scanning a double-quoted scalar
in 'string', line 1, column 18:
message: "Expected '<div class=''form_inp ...
^
found unknown escape character .(46)
in 'string', line 1, column 621:
... lidate:{pattern:/^([a-zA-Z0-9-
.+ ]){1,20}$/i, messages:{patte ...

Is there a library I can use to escape all the characters before parsing?
If you can't answer that... is there a way I can set the TAP plugin to not crash when things like this happen? I think I saw in your code you have the actual parsing done in a try{} statement... If I edit your code (very new to Java) how hard is it to get the compiled result into a Jenkins plugin?

Thanks! I'll consider donating.

from tap4j.

winrid avatar winrid commented on August 25, 2024

Disregard me bugging you about making the Jenkins plugin - that looks easy.

If I fix this I'll send you my fix.

from tap4j.

kinow avatar kinow commented on August 25, 2024

You can help me I think... I figured out how to escape the quotes in testem (debugged the library for a while until I found where it's printing the error messages to the TAP file) but now TAP is failing on strings like:

tap4j delegates the YAML parsing to Snake YAML. The following link is a web app that lets you test YAML streams. I think that copy/pasting the YAML parts of your output in there may help you understand what is happening :)

http://instantyaml.appspot.com/

Is there a library I can use to escape all the characters before parsing?

Not that I'm aware of. Maybe some Apache component will have that method, but I have never needed or used it before. Sorry.

If you can't answer that... is there a way I can set the TAP plugin to not crash when things like this happen? I think I saw in your code you have the actual parsing done in a try{} statement... If I edit your code (very new to Java) how hard is it to get the compiled result into a Jenkins plugin?

Hmmm, off the top of my head, I believe there is a checkbox,in the advanced config section, where you can disable YAMLish... I think.

Thanks! I'll consider donating.

Thanks, that's a great way to motivate me to work more hours in the plug-ins.

You can also use http://freedomsponsors.org. Posting offers there allow any developer to work on the issue too ;) not necessarily or only me.

from tap4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.