├── .github ├── FUNDING.yml └── workflows │ ├── codeql-analysis.yml │ └── main.yml ├── .gitignore ├── AUTHORS ├── LICENSE ├── README.md ├── SECURITY.md ├── pom.xml └── src ├── changes └── changes.xml ├── config ├── checkstyle-suppressions.xml └── checkstyle.xml ├── documents ├── diagrams │ ├── drawing1.jpg │ └── drawing1.vsd ├── regex │ ├── README │ ├── bailout │ ├── comment │ ├── footer │ ├── header │ ├── indentation │ ├── meta │ ├── testline │ └── testplan └── uml │ ├── ClassDiagram1.jpg │ └── tap4j.uml ├── etc ├── announcement.msg ├── eclipse-code-format.xml └── header.txt ├── main ├── java │ └── org │ │ └── tap4j │ │ ├── consumer │ │ ├── TapConsumer.java │ │ ├── TapConsumerException.java │ │ ├── TapConsumerFactory.java │ │ ├── TapConsumerImpl.java │ │ └── package-info.java │ │ ├── model │ │ ├── BailOut.java │ │ ├── Comment.java │ │ ├── Directive.java │ │ ├── Footer.java │ │ ├── Header.java │ │ ├── Patterns.java │ │ ├── Plan.java │ │ ├── SkipPlan.java │ │ ├── TapElement.java │ │ ├── TapElementFactory.java │ │ ├── TapResult.java │ │ ├── TestResult.java │ │ ├── TestSet.java │ │ ├── Text.java │ │ └── package-info.java │ │ ├── parser │ │ ├── Parser.java │ │ ├── ParserException.java │ │ ├── StreamStatus.java │ │ ├── Tap13Parser.java │ │ └── package-info.java │ │ ├── producer │ │ ├── Producer.java │ │ ├── ProducerException.java │ │ ├── TapProducer.java │ │ ├── TapProducerFactory.java │ │ └── package-info.java │ │ ├── representer │ │ ├── DumperOptions.java │ │ ├── Representer.java │ │ ├── RepresenterException.java │ │ ├── Tap13Representer.java │ │ ├── TapJunitRepresenter.java │ │ └── package-info.java │ │ └── util │ │ ├── DirectiveValues.java │ │ ├── StatusValues.java │ │ ├── TapVersionValues.java │ │ └── package-info.java └── xsd │ └── jtl.xsd ├── site ├── apt │ ├── download.apt.vm │ ├── index.apt │ ├── junit_support.apt │ ├── perl.apt │ ├── related_projects.apt │ ├── roadmap.apt │ ├── subtests.apt │ ├── tapconsumer.apt │ ├── tapdirectives.apt │ ├── tapproducer.apt │ ├── testng_support.apt │ └── yamlish.apt ├── fml │ └── faq.fml ├── resources │ └── images │ │ ├── drawing1.jpg │ │ ├── logo.png │ │ ├── tap4j-project.png │ │ └── tap4j-project.xcf └── site.xml └── test ├── java └── org │ └── tap4j │ ├── BaseTapTest.java │ ├── TestProduceConsume.java │ ├── consumer │ ├── TestTap13Consumer.java │ ├── TestTap13YamlConsumer.java │ ├── TestTap13YamlConsumer2.java │ ├── TestTap13YamlConsumerWithMoreThanTenResults.java │ ├── TestTapConsumerExceptionTest.java │ ├── TestTapConsumerFactory.java │ ├── issue3311330 │ │ ├── TestTap13YamlConsumerWithMultipleFiles.java │ │ └── package-info.java │ ├── issue3504508 │ │ ├── TestIssue3504508.java │ │ └── package-info.java │ ├── package-info.java │ └── subtestOrder │ │ ├── TestSubtestOrder.java │ │ └── package-info.java │ ├── model │ ├── TapElementFactoryTest.java │ ├── TestDirective.java │ ├── TestTAPBailOut.java │ ├── TestTAPFooter.java │ ├── TestTAPHeader.java │ ├── TestTAPPlan.java │ ├── TestTAPTestResult.java │ ├── TestTestSet.java │ ├── TestText.java │ └── package-info.java │ ├── package-info.java │ ├── parser │ ├── TestConstants.java │ ├── TestMemento.java │ ├── TestParserExceptionTest.java │ ├── TestTap13Parser.java │ ├── issue3406964 │ │ ├── TestDirectives.java │ │ └── package-info.java │ ├── issue3409478 │ │ ├── TestDoneTesting.java │ │ └── package-info.java │ ├── issue3525603 │ │ ├── Test3525603.java │ │ └── package-info.java │ ├── issue3525607 │ │ ├── TestIssue3525607.java │ │ └── package-info.java │ ├── issueGitHub12 │ │ ├── TestSubtestAsFirstTest.java │ │ └── package-info.java │ ├── issueGitHub14 │ │ ├── TestDiagnostics.java │ │ └── package-info.java │ ├── issueGitHub15 │ │ ├── TestSubtestAsFirstTestNoPlan.java │ │ └── package-info.java │ ├── issueGitHub16 │ │ ├── TestOptionalTestNumbers.java │ │ └── package-info.java │ ├── issueGitHub17 │ │ ├── TestLastYamlishBeingCut.java │ │ └── package-info.java │ ├── issueGitHub20 │ │ ├── TestYamlExitWithThreeDotsInYaml.java │ │ └── package-info.java │ ├── issueGitHub22 │ │ ├── TestAllowTapPlanTBeOptional.java │ │ └── package-info.java │ ├── issueGitHub33 │ │ ├── TestYamlWithYamlInDiagnostics.java │ │ └── package-info.java │ ├── issueGitHub37 │ │ ├── TestSkipDirective.java │ │ └── package-info.java │ ├── issueGitHub41 │ │ ├── FalseDupPlanTest.java │ │ └── package-info.java │ ├── issueGitHub5 │ │ ├── TestRandomStdoutAfterTestPlanAtEnd.java │ │ └── package-info.java │ ├── issueGitHub6 │ │ ├── TestMissingTapPlan.java │ │ └── package-info.java │ ├── issueYaml │ │ ├── YamlIssueTest.java │ │ └── package-info.java │ └── package-info.java │ ├── perl │ ├── TestPerlIntegration.java │ └── package-info.java │ ├── producer │ ├── TestTap13Producer.java │ ├── TestTap13YamlProducer.java │ ├── TestTapProducerExceptionTest.java │ ├── TestTapProducerFactory.java │ └── package-info.java │ ├── representer │ ├── TestDumperOptions.java │ ├── TestRepresenterExceptionTest.java │ ├── TestTap13Representer.java │ ├── TestTap13YamlRepresenter.java │ ├── TestTapJunitRepresenter.java │ ├── TestTapProducerFactory.java │ └── package-info.java │ └── util │ ├── TestDirectiveValues.java │ ├── TestStatusValues.java │ ├── TestTapVersion.java │ └── package-info.java ├── perl └── metatap.pl └── resources └── org └── tap4j ├── consumer ├── 1.tap ├── 2.tap ├── 3.tap ├── 4.tap ├── 5.tap ├── README ├── comment_planskipall.tap ├── header_plan.tap ├── header_plan_tr.tap ├── header_plan_tr_footer.tap ├── header_planskipall.tap ├── header_tr_plan.tap ├── invalid_comment_tr_bailout_header.tap ├── invalid_header_tr.tap ├── invalid_plan_header_plan.tap ├── invalid_plan_tr_header.tap ├── invalid_tr.tap ├── invalid_tr_footer.tap ├── invalid_tr_header_header_tr.tap ├── invalid_tr_plan_header.tap ├── issue3311330 │ ├── 1.tap │ ├── fala.tap │ └── oi.tap ├── issue3504508 │ └── sample.tap ├── org.tap4j.testng.TestGoogleBrunoKinoshita.tap ├── org.tap4j.testng.konobi.tap ├── plan_comment_tr_footer.tap ├── plan_tr.tap ├── single_tr.tap ├── subtestOrder │ └── subtest.tap ├── tap_with_diagnostic_and_without_lastparsedtestresult.tap ├── tap_with_diagnostic_and_wrong_indentation.tap ├── tap_with_yaml_comments_bailout_directives.tap └── two_tr.tap ├── ext ├── jmeter │ ├── SI.MCA.ASECheckList-all.xml │ ├── expected │ │ ├── SI.MCA.ASECheckList-all.tap │ │ └── jmeter-template.tap │ └── jmeter-template.xml ├── junit │ ├── RunJUnitSuiteWithListener │ │ └── org.tap4j.ext.junit.RunJUnitSuiteWithListener$FailingTest-SUITE.tap │ ├── RunJUnitTestWithListener │ │ ├── org.tap4j.ext.junit.RunJUnitTestWithListener$FailingTest.tap │ │ └── org.tap4j.ext.junit.TestTap13JUnit1.tap │ └── suiteTapReporterTest.xml └── testng │ └── suiteTapReporterTest.xml └── parser ├── issue3406964 ├── ihaveskips.tap └── ihavetodoes.tap ├── issueFalseDupPlan └── npm-test.tap ├── issueGitHub12 └── issue-12-tap-stream.tap ├── issueGitHub14 └── issue-14-tap-stream.tap ├── issueGitHub15 └── issue-15-tap-stream.tap ├── issueGitHub16 └── issue-16-tap-stream.tap ├── issueGitHub17 └── issue-17-tap-stream.tap ├── issueGitHub20 └── issue-20-tap-stream.tap ├── issueGitHub22 └── issue-22-tap-stream.tap ├── issueGitHub33 └── issue-33_tap_stream.tap ├── issueGitHub6 └── test-report.tap └── issueYaml ├── jsdom_test_result.tap └── phantomjs.tap /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | ko_fi: kinow 4 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '16 19 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'java' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v2 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v1 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 52 | 53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 54 | # If this step fails, then you should remove it and run the build manually (see below) 55 | - name: Autobuild 56 | uses: github/codeql-action/autobuild@v1 57 | 58 | # ℹ️ Command-line programs to run using the OS shell. 59 | # 📚 https://git.io/JvXDl 60 | 61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 62 | # and modify them (or add more) to build your code if your project 63 | # uses a compiled language 64 | 65 | #- run: | 66 | # make bootstrap 67 | # make release 68 | 69 | - name: Perform CodeQL Analysis 70 | uses: github/codeql-action/analyze@v1 71 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # The MIT License 2 | # 3 | # Copyright (c) 2010-2021 tap4j team (see AUTHORS) 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | # THE SOFTWARE. 22 | 23 | name: CI 24 | 25 | on: 26 | push: 27 | branches: [ master ] 28 | pull_request: 29 | workflow_dispatch: 30 | 31 | jobs: 32 | build: 33 | runs-on: ${{ matrix.os }} 34 | continue-on-error: ${{ matrix.experimental }} 35 | strategy: 36 | matrix: 37 | os: [ ubuntu-latest ] 38 | java: [ 8, 11 ] 39 | experimental: [ false ] 40 | include: 41 | - java: 17 42 | os: ubuntu-latest 43 | experimental: true 44 | - java: 8 45 | os: windows-latest 46 | experimental: true 47 | steps: 48 | - uses: actions/checkout@v2.4.0 49 | - name: Set up JDK ${{ matrix.java }} 50 | uses: actions/setup-java@v2 51 | with: 52 | distribution: adopt 53 | java-version: ${{ matrix.java }} 54 | - name: Build with Maven 55 | run: mvn -V --no-transfer-progress 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .classpath 3 | .settings/ 4 | target/ 5 | test-output/ 6 | .idea 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 tap4j team (see AUTHORS below) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | The PRIMARY AUTHORS are (and/or have been): 24 | 25 | * Bruno P. Kinoshita 26 | * Cesar Fernandes de Almeida 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010-2021 tap4j team (see AUTHORS) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tap4j 2 | 3 | [![Build status](https://github.com/tupilabs/tap4j/actions/workflows/main.yml/badge.svg)](https://github.com/tupilabs/tap4j/actions/workflows/main.yml) 4 | 5 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/X8X1618T2) 6 | 7 | tap4j - Simple implementation of the 8 | [Test Anything Protocol](http://www.testanything.org) (TAP) for Java. 9 | 10 | tap4j was created in 2010 with the intention of implementing a producer and a 11 | consumer for TAP in Java. 12 | 13 | 1..2 14 | not ok 1 - Something went wrong 15 | --- 16 | timestamp: 2012-12-10-20:31:01:021sss 17 | extensions: 18 | files: 19 | apache.err.log: 20 | File-Type: text/plain 21 | File-Content: 22 | File-Size: 685 23 | File-Name: apache.err.log 24 | ... 25 | ok 2 # SKIP skipping due to previous errors 26 | 27 | # Test Anything Protocol 28 | 29 | TAP is a test protocol that can be used to report test execution. It has been 30 | created with Perl 1, around 1988, and is the main format in Perl. A test 31 | harness executes tests and generates TAP, in the same way that a test harness 32 | can execute tests and generate other formats such as TestNG, JUnit or SubUnit. 33 | 34 | TAP can be extended, what is not true with TestNG and JUnit. 35 | There is a specification for the protocol where, by using YAML(ish), you can 36 | include extra information about your tests, such as attachments. 37 | 38 | ## Projects using tap4j 39 | 40 | * [Jenkins TAP Plug-in](https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin) 41 | 42 | * [Jenkins TestLink Plug-in](https://wiki.jenkins-ci.org/display/JENKINS/TestLink+Plugin) 43 | 44 | * [JinFeng](http://www.sqaopen.net/blog/en/?p=63) 45 | 46 | ## Build status 47 | 48 | [![Build Status](https://buildhive.cloudbees.com/job/tupilabs/job/tap4j/badge/icon)](https://buildhive.cloudbees.com/job/tupilabs/job/tap4j/) 49 | 50 | ## Authors and licensing 51 | 52 | See AUTHORS or pom.xml for information regarding the authors and LICENSE 53 | or pom.xml for Licensing. 54 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | 6 | | Version | Supported | 7 | | ------- | ------------------ | 8 | | 5.x-SNAPSHOT | :white_check_mark: | 9 | | 4.x | :white_check_mark: | 10 | | < 4.0 | :x: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | Please contact @kinow on GitHub or Twitter if you have found any vulnerabilities. Thank you! 15 | -------------------------------------------------------------------------------- /src/config/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/config/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/documents/diagrams/drawing1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/documents/diagrams/drawing1.jpg -------------------------------------------------------------------------------- /src/documents/diagrams/drawing1.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/documents/diagrams/drawing1.vsd -------------------------------------------------------------------------------- /src/documents/regex/README: -------------------------------------------------------------------------------- 1 | http://www.cis.upenn.edu/~matuszek/General/RegexTester/regex-tester.html -------------------------------------------------------------------------------- /src/documents/regex/bailout: -------------------------------------------------------------------------------- 1 | \s*Bail out!\s*([^#]+)?\s*(#\s*(.*))? -------------------------------------------------------------------------------- /src/documents/regex/comment: -------------------------------------------------------------------------------- 1 | \s*#\s*(.*) -------------------------------------------------------------------------------- /src/documents/regex/footer: -------------------------------------------------------------------------------- 1 | \s*TAP\s*([^#]*)?\s*(#\s*(.*))? -------------------------------------------------------------------------------- /src/documents/regex/header: -------------------------------------------------------------------------------- 1 | \s*TAP\s*version\s*(\d+)\s*(#\s*(.*))? -------------------------------------------------------------------------------- /src/documents/regex/indentation: -------------------------------------------------------------------------------- 1 | (\s*|\t).* -------------------------------------------------------------------------------- /src/documents/regex/meta: -------------------------------------------------------------------------------- 1 | \s*(.*)\s*:\s*(.*) -------------------------------------------------------------------------------- /src/documents/regex/testline: -------------------------------------------------------------------------------- 1 | \s*(ok|not ok)\s*(\d+)?\s*([^#]*)?\s*(#\s*(SKIP|skip|TODO|todo)\s*([^#]+))?\s*(#\s*(.*))? -------------------------------------------------------------------------------- /src/documents/regex/testplan: -------------------------------------------------------------------------------- 1 | \s*(\d+)(\.{2})(\d+)\s*(skip\s*([^#]+))?\s*(#\s*(.*))? -------------------------------------------------------------------------------- /src/documents/uml/ClassDiagram1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/documents/uml/ClassDiagram1.jpg -------------------------------------------------------------------------------- /src/etc/announcement.msg: -------------------------------------------------------------------------------- 1 | From: Bruno P. Kinoshita 2 | To: tap4j@lists.sourceforge.net 3 | Subject: [ANN] tap4j 4.0 is available 4 | 5 | ========================== 6 | Announcing tap4j-4.0 7 | ========================== 8 | 9 | A new release of tap4j is now available: 10 | 11 | http://tupilabs.github.io/tap4j 12 | 13 | This release delivers a new recursive descent parser as well as other minor 14 | changes and bug fixes. 15 | 16 | The complete list of changes is here: http://tupilabs.github.io/tap4j/tap4j/changes-report.html 17 | 18 | Resources 19 | ========== 20 | 21 | tap4j homepage: http://tupilabs.github.io/tap4j 22 | 23 | JAR package: http://repo2.maven.org/maven2/org/tap4j/tap4j/4.0/tap4j-4.0.jar 24 | Reports: http://tupilabs.github.io/tap4j/tap4j/project-reports.html 25 | 26 | tap4j git repository: https://github.com/tupilabs/tap4j 27 | Submit a bug report: https://github.com/tupilabs/tap4j/issues/new 28 | 29 | TAP homepage: http://testanything.org/ 30 | TAP mailing list: http://testanything.org/mailman/listinfo/tap-l 31 | 32 | About tap4j 33 | ================ 34 | 35 | tap4j was created in 2010 with the intention of implementing a producer and a 36 | consumer for TAP in Java. 37 | 38 | Copyright 39 | ========== 40 | tap4j is released under the MIT License 41 | -------------------------------------------------------------------------------- /src/etc/header.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ -------------------------------------------------------------------------------- /src/main/java/org/tap4j/consumer/TapConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import java.io.File; 27 | import java.io.InputStreamReader; // referenced in JavaDoc 28 | 29 | import org.tap4j.model.TestSet; 30 | import org.tap4j.parser.Parser; 31 | 32 | /** 33 | * TAP Consumer is the responsible for generating the TAP Stream. 34 | * 35 | * @since 1.0 36 | */ 37 | public interface TapConsumer { 38 | 39 | /** 40 | * Parses a TAP File. 41 | * 42 | * Note: this method only works if the {@code TapConsumer} was constructed 43 | * with an assumed character set encoding, and {@code file} really 44 | * is encoded in that assumed encoding. 45 | * 46 | * For a more flexible approach, the caller (who should know best about the 47 | * encoding of any given input file) should have already 48 | * wrapped the file in an {@link InputStreamReader}, and should pass that to 49 | * {@link #load(Readable)}. 50 | * 51 | * @param file TAP File. 52 | * @return TestSet 53 | * @throws TapConsumerException error reading 54 | */ 55 | TestSet load(File file); 56 | 57 | /** 58 | * Parses a TAP Stream. 59 | * 60 | * @param tapStream TAP Stream 61 | * @return TestSet 62 | * @throws TapConsumerException error reading 63 | */ 64 | TestSet load(Readable tapStream); 65 | 66 | /** 67 | * Parses a TAP Stream. 68 | * 69 | * @param tapStream TAP Stream 70 | * @return TestSet 71 | * @throws TapConsumerException error reading 72 | */ 73 | TestSet load(String tapStream); 74 | 75 | /** 76 | * Returns the TestSet resulted from parsing a TAP File or TAP Stream. 77 | * 78 | * @return TestSet 79 | */ 80 | TestSet getTestSet(); 81 | 82 | /** 83 | * Returns the Parser used in the Consumer. 84 | * 85 | * @return Parser 86 | */ 87 | Parser getParser(); 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/consumer/TapConsumerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | /** 27 | * This exception is thrown by the Tap Parser. 28 | * 29 | * @since 1.0 30 | */ 31 | public class TapConsumerException extends RuntimeException { 32 | 33 | /** 34 | * Serial version UUID. 35 | */ 36 | private static final long serialVersionUID = -4463077483065538121L; 37 | 38 | /** 39 | * Default constructor. 40 | */ 41 | public TapConsumerException() { 42 | super(); 43 | } 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param message Exception message. 49 | */ 50 | public TapConsumerException(String message) { 51 | super(message); 52 | } 53 | 54 | /** 55 | * Constructor with parameter. 56 | * 57 | * @param cause Exception cause. 58 | */ 59 | public TapConsumerException(Throwable cause) { 60 | super(cause); 61 | } 62 | 63 | /** 64 | * Constructor with parameters. 65 | * 66 | * @param message Exception message. 67 | * @param cause Exception cause. 68 | */ 69 | public TapConsumerException(String message, Throwable cause) { 70 | super(message, cause); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/consumer/TapConsumerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import org.tap4j.parser.Tap13Parser; 27 | 28 | /** 29 | * Factory class to produce TAP Consumers. 30 | * 31 | * @since 1.0 32 | */ 33 | public final class TapConsumerFactory { 34 | 35 | /** 36 | * Default constructor. 37 | */ 38 | private TapConsumerFactory() { 39 | super(); 40 | } 41 | 42 | /** 43 | * Produces a new TAP version 13 Consumer. 44 | * 45 | * @return TAP Consumer. 46 | */ 47 | public static TapConsumer makeTap13Consumer() { 48 | return new TapConsumerImpl(); 49 | } 50 | 51 | /** 52 | * Produces a new TAP version 13 Consumer with YAML diagnostics. 53 | * 54 | * @return TAP Consumer with YAML support. 55 | */ 56 | public static TapConsumer makeTap13YamlConsumer() { 57 | return new TapConsumerImpl(new Tap13Parser(true)); 58 | } 59 | 60 | /** 61 | * Produces a new TAP version 13 Consumer with YAML diagnostics. 62 | * 63 | * @return TAP Consumer with YAML support. 64 | */ 65 | public static TapConsumer makeTap13YamlConsumerWithoutSubtests() { 66 | return new TapConsumerImpl(new Tap13Parser(false)); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/consumer/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * TAP consumers. 27 | */ 28 | package org.tap4j.consumer; 29 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/BailOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * Represents a Bail Out TAP Line. The test execution should be suspended if 28 | * there is a Bail Out. 29 | * 30 | * @since 1.0 31 | */ 32 | public class BailOut extends TapResult { 33 | 34 | /** 35 | * Serial Version UID. 36 | */ 37 | private static final long serialVersionUID = -354950715195034445L; 38 | 39 | /** 40 | * Reason to Bail Out. 41 | */ 42 | private final String reason; 43 | 44 | /** 45 | * Constructor with parameter. 46 | * 47 | * @param reason Reason to Bail Out. 48 | */ 49 | public BailOut(String reason) { 50 | super(); 51 | this.reason = reason; 52 | } 53 | 54 | /** 55 | * Get the reason for bailing out. 56 | * 57 | * @return Reason to Bail Out. 58 | */ 59 | public String getReason() { 60 | return this.reason; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * A TAP Comment. In TAP files the comments have a # before the text. 28 | * 29 | * @since 1.0 30 | */ 31 | public class Comment extends TapElement { 32 | 33 | /** 34 | * Serial Version UID. 35 | */ 36 | private static final long serialVersionUID = 6694406960961188778L; 37 | 38 | /** 39 | * Comment text. 40 | */ 41 | private final String text; 42 | 43 | /** 44 | * Whether the comment is inline or not. 45 | */ 46 | private boolean inline; 47 | 48 | /** 49 | * Constructor with text. A comment must always have a text. 50 | * 51 | * @param text Text of the comment. 52 | */ 53 | public Comment(String text) { 54 | this(text, false); 55 | } 56 | 57 | /** 58 | * Constructor with text. A comment must always have a text. 59 | * 60 | * @param text Text of the comment. 61 | * @param inline Whether the comment is inline or not. 62 | */ 63 | public Comment(String text, boolean inline) { 64 | super(); 65 | this.text = text; 66 | this.inline = inline; 67 | } 68 | 69 | /** 70 | * @return Comment text. 71 | */ 72 | public String getText() { 73 | return this.text; 74 | } 75 | 76 | /** 77 | * @return the inline 78 | */ 79 | public boolean isInline() { 80 | return inline; 81 | } 82 | 83 | /** 84 | * @param inline the inline to set 85 | */ 86 | public void setInline(boolean inline) { 87 | this.inline = inline; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/Directive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import java.io.Serializable; 27 | 28 | import org.tap4j.util.DirectiveValues; 29 | 30 | /** 31 | * Represents a Test Directive. Usually it would be a TO DO or SKIP directive. 32 | * 33 | * @since 1.0 34 | */ 35 | public class Directive implements Serializable { 36 | 37 | /** 38 | * Serial Version UID. 39 | */ 40 | private static final long serialVersionUID = 8183935213177175225L; 41 | 42 | /** 43 | * Directive Value (TO DO, SKIP). 44 | */ 45 | private final DirectiveValues directiveValue; 46 | 47 | /** 48 | * Reason for the directive. 49 | */ 50 | private final String reason; 51 | 52 | /** 53 | * Constructor with parameters. 54 | * 55 | * @param directiveValue Directive Value. 56 | * @param reason Reason for the directive. 57 | */ 58 | public Directive(DirectiveValues directiveValue, String reason) { 59 | super(); 60 | this.directiveValue = directiveValue; 61 | this.reason = reason; 62 | } 63 | 64 | /** 65 | * @return Directive Value. 66 | */ 67 | public DirectiveValues getDirectiveValue() { 68 | return this.directiveValue; 69 | } 70 | 71 | /** 72 | * @return Reason for the directive. 73 | */ 74 | public String getReason() { 75 | return this.reason; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/Footer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * This class represents a Footer in the TAP Stream. A Footer, or tail is a mere 28 | * line with some text. In the very beginning there is a 'TAP' token and then 29 | * the text. For instance, 'TAP done' is a valid Footer. 30 | * 31 | * @since 1.0 32 | */ 33 | public class Footer extends TapElement { 34 | 35 | /** 36 | * Serial Version UID. 37 | */ 38 | private static final long serialVersionUID = 6941329821890027928L; 39 | 40 | /** 41 | * Footer text. 42 | */ 43 | private final String text; 44 | 45 | /** 46 | * Constructor that calls super class constructor. 47 | * 48 | * @param text Footer text 49 | */ 50 | public Footer(String text) { 51 | this(text, null); 52 | } 53 | 54 | /** 55 | * Constructor that calls super class constructor. 56 | * 57 | * @param text Footer text 58 | * @param comment Footer comment 59 | */ 60 | public Footer(String text, String comment) { 61 | super(); 62 | this.text = text; 63 | if (comment != null) { 64 | this.comment = new Comment(comment); 65 | } 66 | } 67 | 68 | /** 69 | * @return Footer's text. 70 | */ 71 | public String getText() { 72 | return text; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/Header.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * TAP Header. Each TAP File has at most one header in the beginning of it. The 28 | * only thing that can precede the Header are comments. However a Header is not 29 | * required in a TAP File (i.e. the Header is optional). 30 | * 31 | * @since 1.0 32 | */ 33 | public class Header extends TapElement { 34 | 35 | /** 36 | * Serial Version UID. 37 | */ 38 | private static final long serialVersionUID = -3823455733333632836L; 39 | 40 | /** 41 | * TAP file version. 42 | */ 43 | private final Integer version; 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param version TAP file version. 49 | */ 50 | public Header(Integer version) { 51 | super(); 52 | this.version = version; 53 | } 54 | 55 | /** 56 | * @return The TAP file version. 57 | */ 58 | public Integer getVersion() { 59 | return this.version; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/SkipPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import java.io.Serializable; 27 | 28 | /** 29 | * TAP element for a plan that is skipped. 30 | * 31 | * @since 1.0 32 | */ 33 | public class SkipPlan implements Serializable { 34 | 35 | /** 36 | * Serial Version UID. 37 | */ 38 | private static final long serialVersionUID = 9108007596777603763L; 39 | 40 | /** 41 | * The reason for the skip. 42 | */ 43 | private final String reason; 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param reason Skip reason. 49 | */ 50 | public SkipPlan(String reason) { 51 | super(); 52 | this.reason = reason; 53 | } 54 | 55 | /** 56 | * @return Skip reason. 57 | */ 58 | public String getReason() { 59 | return this.reason; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/TapElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import java.io.Serializable; 27 | import java.util.LinkedHashMap; 28 | import java.util.Map; 29 | 30 | /** 31 | * A TAP element. 32 | * 33 | * @since 1.0 34 | */ 35 | public class TapElement implements Serializable { 36 | 37 | /** 38 | * Serial Version UID. 39 | */ 40 | private static final long serialVersionUID = 9108597596777603763L; 41 | 42 | /** 43 | * Input line indentation. 44 | */ 45 | protected int indentation; 46 | 47 | /** 48 | * Iterable object returned by SnakeYAML. 49 | */ 50 | private Map diagnostic = new LinkedHashMap<>(); 51 | 52 | /** 53 | * Comment. 54 | */ 55 | protected Comment comment; 56 | 57 | /** 58 | * Get the indentation of the corresponding input line. 59 | * 60 | * @return Indentation in the original stream 61 | */ 62 | public int getIndentation() { 63 | return indentation; 64 | } 65 | 66 | /** 67 | * YAML diagnostic information. 68 | * @return the YAML diagnostic as a map 69 | */ 70 | public Map getDiagnostic() { 71 | return this.diagnostic; 72 | } 73 | 74 | /** 75 | * YAML diagnostic information setter. 76 | * @param diagnostic TAP element YAML diagnostic map 77 | */ 78 | public void setDiagnostic(Map diagnostic) { 79 | this.diagnostic = diagnostic; 80 | } 81 | 82 | /** 83 | * @param comment Comment. 84 | */ 85 | public void setComment(Comment comment) { 86 | this.comment = comment; 87 | } 88 | 89 | /** 90 | * @return Comment. 91 | */ 92 | public Comment getComment() { 93 | return this.comment; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/TapResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * A TAP Line. A TAP line represents a TestResult or a BailOut. 28 | * 29 | * @since 1.0 30 | */ 31 | public class TapResult extends TapElement { 32 | 33 | /** 34 | * Serial Version UID. 35 | */ 36 | private static final long serialVersionUID = 5602024143464978179L; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/Text.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | /** 27 | * An ordinary text. It can be added to the TestSet, however it isn't parsed by 28 | * the TAP Consumer. Used only for debugging, customization or back 29 | * compatibility. 30 | * 31 | * @since 1.0 32 | */ 33 | public class Text extends TapResult { 34 | 35 | /** 36 | * Serial Version UID. 37 | */ 38 | private static final long serialVersionUID = 5408008204269040841L; 39 | 40 | /** 41 | * Value of Text. 42 | */ 43 | private final String value; 44 | 45 | /** 46 | * Indentation string. 47 | */ 48 | protected String indentationString; 49 | 50 | /** 51 | * Constructor with parameter. 52 | * 53 | * @param value String value. 54 | */ 55 | public Text(String value) { 56 | super(); 57 | this.value = value; 58 | } 59 | 60 | /** 61 | * @return Value of the String. 62 | */ 63 | public String getValue() { 64 | return this.value; 65 | } 66 | 67 | /** 68 | * @return the indentation string 69 | */ 70 | public String getIndentationString() { 71 | return indentationString; 72 | } 73 | 74 | /** 75 | * @param indentationString the new indentation string 76 | */ 77 | public void setIndentationString(String indentationString) { 78 | this.indentationString = indentationString; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/model/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Model classes for tap4j. 27 | */ 28 | package org.tap4j.model; 29 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/parser/Parser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser; 25 | 26 | import java.io.File; 27 | import java.io.InputStreamReader; // referenced in JavaDoc 28 | 29 | import org.tap4j.model.TestSet; 30 | 31 | /** 32 | * TAP regex parser. 33 | * 34 | * @since 1.0 35 | */ 36 | public interface Parser { 37 | 38 | /** 39 | * Parses a TAP Stream. 40 | * 41 | * @param tapStream TAP Stream 42 | * @return Test Set 43 | */ 44 | TestSet parseTapStream(Readable tapStream); 45 | 46 | /** 47 | * Parses a TAP Stream. 48 | * 49 | * @param tapStream TAP Stream 50 | * @return Test Set 51 | */ 52 | TestSet parseTapStream(String tapStream); 53 | 54 | /** 55 | * Parses a TAP File. 56 | * 57 | * Note: this method must only be used if this Parser was created with 58 | * a specified character set encoding and {@code tapFile} is 59 | * known to be written in that same encoding. Otherwise, the caller (which 60 | * probably knows best the file's encoding) can wrap the file in an 61 | * {@link InputStreamReader} and pass that to 62 | * {@link #parseTapStream(Readable) parseTapStream(Readable)}. 63 | * 64 | * @param tapFile TAP File 65 | * @return Test Set 66 | */ 67 | TestSet parseFile(File tapFile); 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/parser/ParserException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser; 25 | 26 | /** 27 | * Exception thrown by parsers. 28 | * 29 | * @since 1.0 30 | */ 31 | public class ParserException extends RuntimeException { 32 | 33 | /** 34 | * Serial Version UID. 35 | */ 36 | private static final long serialVersionUID = 8375457492239728975L; 37 | 38 | /** 39 | * Default constructor. 40 | */ 41 | public ParserException() { 42 | super(); 43 | } 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param message Exception message 49 | * @param cause Exception cause 50 | */ 51 | public ParserException(String message, Throwable cause) { 52 | super(message, cause); 53 | } 54 | 55 | /** 56 | * @param message Exception message 57 | */ 58 | public ParserException(String message) { 59 | super(message); 60 | } 61 | 62 | /** 63 | * @param cause Exception cause 64 | */ 65 | public ParserException(Throwable cause) { 66 | super(cause); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/parser/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * TAP parsers. 27 | */ 28 | package org.tap4j.parser; 29 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/producer/Producer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.producer; 25 | 26 | import java.io.File; 27 | import java.io.Writer; 28 | 29 | import org.tap4j.model.TestSet; 30 | import org.tap4j.representer.Representer; 31 | 32 | /** 33 | * Produces a TAP Stream. 34 | * 35 | * @since 1.0 36 | */ 37 | public interface Producer { 38 | 39 | /** 40 | * Returns a String representing the TAP Stream produced from a TestSet. 41 | * 42 | * @param testSet TestSet 43 | * @return TAP Stream 44 | * @throws ProducerException error writing 45 | */ 46 | String dump(TestSet testSet); 47 | 48 | /** 49 | * Writes the TAP Stream produced from a TestSet into a Writer. 50 | * 51 | * @param testSet TestSet 52 | * @param writer Writer 53 | * @throws ProducerException error writing 54 | */ 55 | void dump(TestSet testSet, Writer writer); 56 | 57 | /** 58 | * Writes the TAP Stream into an output File. 59 | * 60 | * This will choose an encoding for the output written to the file, using 61 | * the following rules. If this Producer's {@code Representer} is a 62 | * {@code Tap13Representer}, the chosen encoding will be taken from its 63 | * {@code Charset} option. In any other case, the chosen encoding will be 64 | * the system's default encoding. If that is not the correct encoding for 65 | * the file, the caller should wrap the file in a {@link Writer} for the 66 | * correct encoding, and pass that to {@link #dump(TestSet,Writer)}. 67 | * 68 | * @param testSet TestSet 69 | * @param output Output File 70 | * @throws ProducerException error writing 71 | */ 72 | void dump(TestSet testSet, File output); 73 | 74 | /** 75 | * Returns the Representer used in the Producer. 76 | * 77 | * @return Representer 78 | */ 79 | Representer getRepresenter(); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/producer/ProducerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.producer; 25 | 26 | /** 27 | * Runtime exception used by TAP producers. 28 | * 29 | * @since 1.0 30 | */ 31 | public class ProducerException extends RuntimeException { 32 | 33 | /** 34 | * Serial Version UID. 35 | */ 36 | private static final long serialVersionUID = 5579591125440097408L; 37 | 38 | /** 39 | * Default constructor. 40 | */ 41 | public ProducerException() { 42 | super(); 43 | } 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param message Exception message 49 | */ 50 | public ProducerException(String message) { 51 | super(message); 52 | } 53 | 54 | /** 55 | * @param cause Exception cause 56 | */ 57 | public ProducerException(Throwable cause) { 58 | super(cause); 59 | } 60 | 61 | /** 62 | * @param message Exception message 63 | * @param cause Exception cause 64 | */ 65 | public ProducerException(String message, Throwable cause) { 66 | super(message, cause); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/producer/TapProducerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.producer; 25 | 26 | import org.tap4j.representer.DumperOptions; 27 | import org.tap4j.representer.Tap13Representer; 28 | import org.tap4j.representer.TapJunitRepresenter; 29 | 30 | 31 | /** 32 | * Factory class to produce TAP Producers. 33 | * 34 | * @since 3.1 35 | */ 36 | public final class TapProducerFactory { 37 | 38 | /** 39 | * Private constructor. 40 | */ 41 | private TapProducerFactory() { 42 | throw new AssertionError("Private constructor called!"); 43 | } 44 | 45 | /** 46 | * Create a TAP 13 producer. 47 | * 48 | * @return TapProducer 49 | */ 50 | public static TapProducer makeTap13Producer() { 51 | return new TapProducer(); 52 | } 53 | 54 | /** 55 | * Create a TAP 13 producer with YAMLish. 56 | * 57 | * @return TapProducer 58 | */ 59 | public static TapProducer makeTap13YamlProducer() { 60 | DumperOptions options = new DumperOptions(); 61 | options.setPrintDiagnostics(true); 62 | return new TapProducer(new Tap13Representer(options)); 63 | } 64 | 65 | /** 66 | * Create a TAP 13 producer with YAMLish. 67 | * 68 | * @param options the {@link DumperOptions} 69 | * @return TapProducer 70 | */ 71 | public static TapProducer makeTap13YamlProducer(DumperOptions options) { 72 | return new TapProducer(new Tap13Representer(options)); 73 | } 74 | 75 | /** 76 | * Create a TAP JUnit producer. 77 | * 78 | * @param name JUnit file name 79 | * @return TapProducer 80 | */ 81 | public static TapProducer makeTapJunitProducer(String name) { 82 | return new TapProducer(new TapJunitRepresenter(name)); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/producer/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * TAP producers. 27 | */ 28 | package org.tap4j.producer; 29 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/representer/Representer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.representer; 25 | 26 | import org.tap4j.model.TestSet; 27 | 28 | /** 29 | * Responsible for knowing how to represent a TestSet as String. 30 | * 31 | * @since 1.0 32 | */ 33 | public interface Representer { 34 | 35 | /** 36 | * Get Test Set as text. 37 | * 38 | * @param testSet TestSet 39 | * @return TestSet represented as String 40 | * @throws RepresenterException error producing representation of a TestSet 41 | */ 42 | String representData(TestSet testSet); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/representer/RepresenterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.representer; 25 | 26 | /** 27 | * Exception thrown by representers. 28 | * 29 | * @since 1.0 30 | */ 31 | public class RepresenterException extends RuntimeException { 32 | 33 | /** 34 | * Serial Version UID. 35 | */ 36 | private static final long serialVersionUID = 5273452940014536172L; 37 | 38 | /** 39 | * Default constructor. 40 | */ 41 | public RepresenterException() { 42 | super(); 43 | } 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param message Exception message 49 | * @param cause Exception cause 50 | */ 51 | public RepresenterException(String message, Throwable cause) { 52 | super(message, cause); 53 | } 54 | 55 | /** 56 | * @param message Exception message 57 | */ 58 | public RepresenterException(String message) { 59 | super(message); 60 | } 61 | 62 | /** 63 | * @param cause Exception cause 64 | */ 65 | public RepresenterException(Throwable cause) { 66 | super(cause); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/representer/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * TAP representers. 27 | */ 28 | package org.tap4j.representer; 29 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/util/DirectiveValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | /** 27 | * Test Directive value. Valid values are SKIP and TOD O, represent respectively 28 | * "SKIP" and "TOD O". (Extra space added purposefully to avoid task scanning 29 | * problems). 30 | * 31 | * @since 1.0 32 | */ 33 | public enum DirectiveValues { 34 | 35 | /** 36 | * Valid values. 37 | */ 38 | SKIP("SKIP"), TODO("TODO"); 39 | 40 | /** 41 | * The text of the directive. 42 | */ 43 | private final String textValue; 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param textValue Directive text value. 49 | */ 50 | DirectiveValues(String textValue) { 51 | this.textValue = textValue; 52 | } 53 | 54 | /** 55 | * {@inheritDoc} 56 | */ 57 | @Override 58 | public String toString() { 59 | return this.textValue; 60 | } 61 | 62 | /** 63 | * Get a directive value for a given string. 64 | * @param textValue String 65 | * @return Directive value 66 | */ 67 | public static DirectiveValues get(String textValue) { 68 | if ("skip".equalsIgnoreCase(textValue)) { 69 | return DirectiveValues.SKIP; 70 | } else if ("todo".equalsIgnoreCase(textValue)) { 71 | return DirectiveValues.TODO; 72 | } 73 | return null; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/util/StatusValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | /** 27 | * Test Status. Valid values are OK and NOT OK, represent respectively "ok" and 28 | * "not ok". 29 | * 30 | * @since 1.0 31 | */ 32 | public enum StatusValues { 33 | 34 | /** 35 | * Valid values. 36 | */ 37 | OK("ok"), NOT_OK("not ok"); 38 | 39 | /** 40 | * Status value. 41 | */ 42 | private final String textValue; 43 | 44 | /** 45 | * Constructor with parameter. 46 | * 47 | * @param textValue Status text value 48 | */ 49 | StatusValues(String textValue) { 50 | this.textValue = textValue; 51 | } 52 | 53 | /** 54 | * {@inheritDoc} 55 | */ 56 | @Override 57 | public String toString() { 58 | return this.textValue; 59 | } 60 | 61 | /** 62 | * Get status value for a given string. 63 | * @param textValue String 64 | * @return Status value 65 | */ 66 | public static StatusValues get(String textValue) { 67 | if ("ok".equals(textValue)) { 68 | return StatusValues.OK; 69 | } 70 | if ("not ok".equals(textValue)) { 71 | return StatusValues.NOT_OK; 72 | } 73 | return null; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/util/TapVersionValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | /** 27 | * TAP versions. 28 | * 29 | * @since 1.0 30 | */ 31 | public enum TapVersionValues { 32 | 33 | //CHECKSTYLE:OFF 34 | /** 35 | * Valid values. 36 | */ 37 | TAP_1(1), TAP_2(2), TAP_3(3), TAP_4(4), TAP_5(5), TAP_6(6), TAP_7(7), TAP_8(8), TAP_9(9), TAP_10(10), TAP_11(11), TAP_12(12), TAP_13(13); 38 | //CHECKSTYLE:ON 39 | 40 | /** 41 | * The TAP version. 42 | */ 43 | private final Integer version; 44 | 45 | /** 46 | * Constructor with parameter. 47 | * 48 | * @param version TAP version number 49 | */ 50 | TapVersionValues(Integer version) { 51 | this.version = version; 52 | } 53 | 54 | /** 55 | * Get the TAP version value. 56 | * 57 | * @return TAP version value 58 | */ 59 | public Integer getValue() { 60 | return this.version; 61 | } 62 | 63 | /** 64 | * {@inheritDoc} 65 | */ 66 | @Override 67 | public String toString() { 68 | return this.version.toString(); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/tap4j/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Utility classes. 27 | */ 28 | package org.tap4j.util; 29 | -------------------------------------------------------------------------------- /src/site/apt/download.apt.vm: -------------------------------------------------------------------------------- 1 | Download 2 | 3 | * Maven artifact 4 | 5 | If you are using Maven then you can add a dependency to tap4j. 6 | 7 | +---+ 8 | 9 | org.tap4j 10 | tap4j 11 | ${project.version} 12 | 13 | +---+ 14 | -------------------------------------------------------------------------------- /src/site/apt/index.apt: -------------------------------------------------------------------------------- 1 | tap4j 2 | 3 | tap4j is an implementation of the TAP - <> - for <>. 4 | TAP is a standard way to document test execution. There are two main roles in 5 | TAP, a producer and a consumer. 6 | 7 | The <> is responsible for producing a . Usually the TAP Stream is written to a file. 8 | The following is an example of a TAP Stream. 9 | 10 | +---+ 11 | 1..4 12 | ok 1 - Input file opened 13 | not ok 2 14 | ok 3 - Read the rest of the file 15 | # Yeah, you can comment your TAP Stream 16 | not ok 4 - Summarized correctly # TODO Not written yet 17 | +---+ 18 | 19 | Test your TAP with {{{http://instanttap.appspot.com/}InstantTAP}}. 20 | 21 | * Open source licenses donated for this project 22 | 23 | [./images/stan4j-88x31-o1.png] 24 | 25 | {{{http://stan4j.com}Stan4J}} 26 | 27 | YourKit is kindly supporting open source projects with its full-featured 28 | Java Profiler. 29 | 30 | YourKit, LLC is the creator of innovative and intelligent tools for profiling 31 | Java and .NET applications. Take a look at YourKit's leading software products: 32 | 33 | {{{http://www.yourkit.com/java/profiler/index.jsp}YourKit Java Profiler}} 34 | and {{{http://www.yourkit.com/.net/profiler/index.jsp}YourKit .NET Profiler}}. 35 | 36 | * Presentations 37 | 38 | [./images/JCertif_Conf2011_2.png] 39 | 40 | {{{http://www.jcertif.com}JCertif}} - Make your tests speak TAP, by Bruno P. 41 | Kinoshita. September, 2011 - Brazzaville/Congo. 42 | -------------------------------------------------------------------------------- /src/site/apt/perl.apt: -------------------------------------------------------------------------------- 1 | Perl Integration Tests 2 | 3 | In version 1.4.6 new tests were created to integrate tap4j and Perl. This is 4 | done by using {{{http://search.cpan.org/~patl}Patrick LeBoutiliier}} 5 | fantastic metatap script. This is metatap's description from 6 | {{{http://search.cpan.org/~patl/metatap-0.01/}CPAN}}. 7 | 8 | "metatap is a simple testing tool for TAP producers. It reads TAP from standard 9 | input, along with the expected results on the command line. It then produces 10 | (and optionally runs) TAP describing how the input TAP was interpreted by 11 | TAP::Harness." 12 | 13 | If you are building tap4j from source you can execute the tests by running 14 | . This command executes a TestNG class 15 | that creates a TapProducer, dumps its contents to a temporary file and then 16 | reads it with metatap. 17 | 18 | This test requires having "perl" in PATH. We tested this in Windows with 19 | Perl Strawberry and in Linux with Perl 5. 20 | 21 | We are happy to announce that tap4j passed in all integration tests :) 22 | -------------------------------------------------------------------------------- /src/site/apt/related_projects.apt: -------------------------------------------------------------------------------- 1 | Related projects 2 | 3 | This page lists projects similar to ours. 4 | 5 | * {{{http://testanything.org/wiki/index.php/JTap}JTap}} 6 | 7 | * {{{http://code.google.com/p/taps-testing}Taps}} 8 | 9 | * {{{http://openjsan.org/doc/t/th/theory/Test/Simple/}Test.Simple}} 10 | 11 | * {{{http://search.cpan.org/~mschwern/Test-Simple-0.96/lib/Test/Builder.pm}Test::Builder}} 12 | 13 | * {{{http://search.cpan.org/dist/Test/}Test.pm}} 14 | 15 | * {{{http://git.codesimply.com/?p=PyTAP.git;a=summary}PyTAP}} 16 | 17 | * {{{https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin}Jenkins TAP Plug-in}} 18 | 19 | * {{{http://instanttap.appspot.com/}InstantTAP}} 20 | 21 | For a more complete list of TAP producers and consumers, check out 22 | {{{http://testanything.org/wiki/index.php/TAP_Producers#tap4j}TAP homepage}}. 23 | -------------------------------------------------------------------------------- /src/site/apt/roadmap.apt: -------------------------------------------------------------------------------- 1 | Roadmap 2 | 3 | * Wishlist 4 | 5 | * Record sample videos 6 | 7 | * Review Logging throughout the API -------------------------------------------------------------------------------- /src/site/apt/subtests.apt: -------------------------------------------------------------------------------- 1 | Subtests 2 | 3 | Subtests are test sets linked to test results. It is easier to 4 | understand this by looking at a simple example. 5 | 6 | +---+ 7 | 1..3 8 | ok 1 - First test 9 | 1..2 10 | ok 1 - This is a subtest 11 | ok 2 - So is this 12 | 1..2 13 | ok 1 - This is a subtest 14 | ok 2 - So is this 15 | ok 2 - An example subtest 16 | ok 3 - Third test 17 | +---+ 18 | 19 | In the example above, we have a test set with three tests. But the 20 | first test has another test set, with two tests. This is an example 21 | of subtests. 22 | 23 | This feature has been added in tap4j version 3.0. -------------------------------------------------------------------------------- /src/site/apt/tapconsumer.apt: -------------------------------------------------------------------------------- 1 | TAP Consumer 2 | 3 | A TAP Consumer can interpret the output of a TAP Producer to determine how 4 | many tests were run, which tests succeeded, and which diagnostic information 5 | might be usefully reported to the user. In tap4j the consumers are created 6 | using the class {{{http://tap4j.sourceforge.net/apidocs/org/tap4j/consumer/TapConsumerFactory.html}TapConsumerFactory}}. 7 | 8 | +---+ 9 | TapConsumer consumer = TapConsumerFactory.makeTap13Consumer(); 10 | TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer(); 11 | TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumerWithoutSubtests(); 12 | +---+ 13 | 14 | The consumer interprets a TAP Stream and transforms it into a {{{http://tap4j.sourceforge.net/apidocs/org/tap4j/model/TestSet.html}TestSet}} 15 | object. A TAP Stream consists of one test set. A test set, by its turn, 16 | consists of zero or more test results and exactly one plan. A test set can be 17 | determined to have failed or passed. 18 | 19 | +---+ 20 | TestSet testSet = consumer.load( 21 | "1..2\n" + 22 | "ok 1 - no error" + 23 | "not ok 2 - io error" 24 | ); 25 | System.out.println( "Number of tests found: " + testSet.getNumberOfTestResults() ); 26 | System.out.println( "Test Set failed? " + testSet.containsNotOk() ); 27 | +---+ 28 | 29 | {{{http://testanything.org/wiki/index.php/Testing_with_Java#Reading_TAP_using_a_TAP_Consumer}Reading TAP using a TAP Consumer}} 30 | from {{{http://testanything.org/}Test Anything Protocol Wiki}}. 31 | 32 | -------------------------------------------------------------------------------- /src/site/apt/tapdirectives.apt: -------------------------------------------------------------------------------- 1 | TAP Directives 2 | 3 | Directives are notes that change the meaning of a Test Result. TAP has two 4 | directives, SKIP and TODO. 5 | 6 | When a Test Result is marked as SKIP it is counted as having been skipped. 7 | 8 | e.g.: ok 3 - # SKIP Module RPC::XML is not present 9 | 10 | On the other hand, a TODO directive tells the test harness that a Test Result 11 | is missing something that will be corrected later. 12 | 13 | e.g.: ok 3 - # TODO install module RPC::XML 14 | 15 | Before version 2.0.5, tap4j Parser ignored lower case skip or todo directives. 16 | However after an issue about this was raised in {{{https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin}Jenkins TAP Plug-in}} we re-read 17 | the specification and checked in {{{http://hexten.net/mailman/listinfo/tap-l}tap-l}} (the TAP mailing list) if it would be 18 | correct to use upper and lower case for directives. Now tap4j Parser interprets 19 | both lower and upper case directives, i.e., # SKIP or # skip, and # TODO 20 | or # todo. 21 | 22 | H.Merijn Brand, Steffen Schwigon and {{{http://overseas-exile.blogspot.com/}Ovid}} contributed with their thoughts 23 | on parsing upper and lower case directives in tap-l. Thank you guys. 24 | -------------------------------------------------------------------------------- /src/site/apt/tapproducer.apt: -------------------------------------------------------------------------------- 1 | TAP Producer 2 | 3 | A TAP Producer produces a TAP Stream. A TAP Stream exists as a file, data 4 | stream, encoded in another medium (stored in a PDF file, for instance) or in 5 | any other form which can be parsed by a TAP Consumer. In tap4j the producers 6 | are created using the class {{{http://tap4j.sourceforge.net/apidocs/org/tap4j/producer/TapProducerFactory.html}TapProducerFactory}}. 7 | 8 | +---+ 9 | TapProducer tapProducer = TapProducerFactory.makeTap13Producer(); 10 | TapProducer tapProducer = TapProducerFactory.makeTap13YamlProducer(); 11 | TapProducer tapProducer = TapProducerFactory.makeTapJunitProducer(); 12 | +---+ 13 | 14 | The TAP Stream produced by a TAP Producer must be consumable by a {{{http://tap4j.sourceforge.net/tapconsumer.html}TAP Consumer}}. 15 | The produce and consume processes are decoupled. It means that a server can 16 | produce a TAP Stream and another one can download and process it. 17 | 18 | +---+ 19 | TestSet testSet = new TestSet(); 20 | testSet.setPlan( new Plan( 2 ) ); 21 | 22 | TestResult testResult = new TestResult( StatusValues.OK, 1 ); 23 | testResult.setDescription( "- no error" ); 24 | testSet.addTestResult( testResult ); 25 | 26 | TestResult anotherTestResult = new TestResult( StatusValues.NOT_OK, 2 ); 27 | anotherTestResult.setDescription( "- io error" ); 28 | testSet.addTestResult( anotherTestResult ); 29 | 30 | String tapStream = tapProducer.dump( testSet ); 31 | System.out.println(tapStream); 32 | +---+ 33 | 34 | {{{http://testanything.org/wiki/index.php/Testing_with_Java#Generating_TAP_using_a_TAP_Producer}Generating TAP using a TAP Producer}} 35 | from {{{http://testanything.org/}Test Anything Protocol Wiki}}. -------------------------------------------------------------------------------- /src/site/apt/testng_support.apt: -------------------------------------------------------------------------------- 1 | TestNG support 2 | 3 | If you have tests written with TestNG, you can easily annotate your tests 4 | to run with one of the listeners from tap4j, or specify a listener in 5 | your project pom. 6 | 7 | * TAP TestNG listeners 8 | 9 | The TAP TestNG listeners are organized under the 10 | <> package. 11 | 12 | *-----------+-----------+ 13 | || Listener || Feature | 14 | *-----------+-----------+ 15 | | TapListenerClass | Outputs TAP per class | 16 | *-----------+-----------+ 17 | | TapListenerClassYaml | Outputs TAP per class with YAML | 18 | *-----------+-----------+ 19 | | TapListenerMethod | Outputs TAP per method | 20 | *-----------+-----------+ 21 | | TapListenerMethodYaml | Outputs TAP per method with YAML | 22 | *-----------+-----------+ 23 | | TapListenerSuite | Outputs TAP per suite | 24 | *-----------+-----------+ 25 | | TapListenerSuiteYaml | Outputs TAP per suite with YAML | 26 | *-----------+-----------+ 27 | 28 | +---+ 29 | 30 | 31 | 32 | org.apache.maven.plugins 33 | maven-surefire-plugin 34 | 2.12.4 35 | 36 | 37 | 38 | listener 39 | org.tap4j.ext.testng.listener.TapListenerMethod 40 | 41 | 42 | 43 | 44 | 45 | 46 | +---+ 47 | 48 | * TestNG suite xml 49 | 50 | Add the following to your TestNG suite xml file in order to produce TAP Streams 51 | within your TestNG tests. Do not forget to add tap4j jar into your 52 | classpath during execution of the tests. 53 | 54 | +---+ 55 | 56 | 57 | 58 | 59 | 60 | 61 | ... 62 | +---+ 63 | -------------------------------------------------------------------------------- /src/site/apt/yamlish.apt: -------------------------------------------------------------------------------- 1 | YAMLish (diagnostics) 2 | 3 | tap4j uses {{{http://www.yaml.org}YAML}}ish. It is a subset of YAML that can 4 | be used to extend your test results. 5 | 6 | For instance, the following test has extra information about an image 7 | attachment. 8 | 9 | +---+ 10 | 1..3 11 | ok 1 - Running Selenium Login Test 12 | ok 2 - Typing Values 13 | ok 3 - Hitting Enter 14 | --- 15 | extensions: 16 | Files: 17 | login.jpg: 18 | File-Title: login.jpg 19 | File-Description: Login Screenshot 20 | File-Size: 1612 21 | File-Name: message.txt 22 | File-Content: TuNvIGNvbn...6Y2lhIQ== 23 | File-Type: image/png 24 | ... 25 | +---+ 26 | 27 | The File-Content entry holds the Base64 encoded file content. You don't have 28 | to use this entry, you can use File-Location too, and avoid attaching the file 29 | content. 30 | 31 | For producing TAP with YAMLish, you simply have to create java.util.Map and 32 | add it to a TestResult. 33 | 34 | +---+ 35 | TestResult testResult = new TestResult(StatusValues.OK, 1); 36 | testResult.setDescription("- no error"); 37 | testSet.addTestResult(testResult); 38 | 39 | Map yamlish = new HashMap(); 40 | yamlish.put("name", "neo"); 41 | 42 | testResult.setDiagnostic(yamlish); 43 | +---+ 44 | 45 | -------------------------------------------------------------------------------- /src/site/fml/faq.fml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | General 10 | 11 | 12 | 13 | What is TAP 14 | 15 | 16 |

From TestAnything.org Wiki: TAP, the Test Anything Protocol, 17 | is a simple text-based interface between testing modules in a test 18 | harness.

19 |
20 |
21 | 22 |
23 | 24 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /src/site/resources/images/drawing1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/site/resources/images/drawing1.jpg -------------------------------------------------------------------------------- /src/site/resources/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/site/resources/images/logo.png -------------------------------------------------------------------------------- /src/site/resources/images/tap4j-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/site/resources/images/tap4j-project.png -------------------------------------------------------------------------------- /src/site/resources/images/tap4j-project.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tupilabs/tap4j/03ca2ba23ed04daa191386c783d3f0627f78fa3b/src/site/resources/images/tap4j-project.xcf -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/BaseTapTest.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * The MIT License 4 | * 5 | * Copyright (c) 2010 tap4j team (see AUTHORS) 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package org.tap4j; 26 | 27 | import java.io.File; 28 | 29 | import org.tap4j.consumer.TapConsumer; 30 | import org.tap4j.consumer.TapConsumerImpl; 31 | import org.tap4j.model.TestSet; 32 | import org.tap4j.parser.Parser; 33 | import org.tap4j.parser.Tap13Parser; 34 | 35 | /** 36 | * Base class for TAP tests. 37 | */ 38 | public class BaseTapTest { 39 | 40 | /** 41 | * Get a test set for a given file name. 42 | * @param name File name. 43 | * @return Test Set. 44 | */ 45 | protected TestSet getTestSet(String name) { 46 | return this.getTestSet(new Tap13Parser(), name); 47 | } 48 | 49 | /** 50 | * Get a test set for given parser and file name. 51 | * @param parser Parser. 52 | * @param name File name. 53 | * @return Test Set. 54 | */ 55 | protected TestSet getTestSet(Parser parser, String name) { 56 | TapConsumer consumer = getConsumer(parser); 57 | return consumer 58 | .load(new File(getClass() 59 | .getResource(name) 60 | .getFile())); 61 | } 62 | 63 | /** 64 | * Get a tap consumer. 65 | * @return TAP Consumer. 66 | */ 67 | protected TapConsumer getConsumer() { 68 | return getConsumer(new Tap13Parser()); 69 | } 70 | 71 | /** 72 | * Get a consumer for with a given parser. 73 | * @param parser TAP parser. 74 | * @return TAP Consumer. 75 | */ 76 | protected TapConsumer getConsumer(Parser parser) { 77 | return new TapConsumerImpl(parser); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/TestTap13YamlConsumer2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertSame; 29 | import static org.junit.Assert.assertTrue; 30 | 31 | import org.junit.Test; 32 | import org.tap4j.BaseTapTest; 33 | import org.tap4j.model.Directive; 34 | import org.tap4j.model.Plan; 35 | import org.tap4j.model.TestResult; 36 | import org.tap4j.model.TestSet; 37 | import org.tap4j.util.DirectiveValues; 38 | 39 | /** 40 | * @since 1.0 41 | */ 42 | public class TestTap13YamlConsumer2 extends BaseTapTest { 43 | 44 | @Test 45 | public void testTapConsumerYaml() { 46 | final TestSet testSet = getTestSet("/org/tap4j/consumer/tap_with_yaml_comments_bailout_directives.tap"); 47 | assertNotNull(testSet); 48 | final Plan plan = testSet.getPlan(); 49 | assertEquals(1, (int) plan.getInitialTestNumber()); 50 | assertEquals(3, (int) plan.getLastTestNumber()); 51 | assertEquals(3, testSet.getNumberOfTestResults()); 52 | assertTrue(testSet.containsBailOut()); 53 | final TestResult testNumber2WithSkipDirective = testSet.getTestResult(2); 54 | assertNotNull(testNumber2WithSkipDirective); 55 | final Directive skipDirective = testNumber2WithSkipDirective.getDirective(); 56 | assertSame(skipDirective.getDirectiveValue(), DirectiveValues.SKIP); 57 | assertEquals("not implemented yet", skipDirective.getReason()); 58 | assertNotNull(testSet.getFooter()); 59 | } 60 | 61 | @Test(expected = TapConsumerException.class ) 62 | public void testDiagnosticWithoutLastParsedElement() { 63 | getTestSet("/org/tap4j/consumer/tap_with_diagnostic_and_without_lastparsedtestresult.tap"); 64 | } 65 | 66 | @Test(expected = TapConsumerException.class ) 67 | public void testDiagnosticWithWrongIndentation() { 68 | getTestSet("/org/tap4j/consumer/tap_with_diagnostic_and_wrong_indentation.tap"); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/TestTap13YamlConsumerWithMoreThanTenResults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | import org.junit.Test; 29 | import org.tap4j.model.TestSet; 30 | import org.tap4j.parser.Tap13Parser; 31 | 32 | /** 33 | * @since 2.0 34 | */ 35 | public class TestTap13YamlConsumerWithMoreThanTenResults { 36 | 37 | @Test 38 | public void testManyTestResults() { 39 | TapConsumer consumer = new TapConsumerImpl(new Tap13Parser()); 40 | 41 | TestSet testSet = consumer.load("1..20"); 42 | 43 | assertEquals(testSet.getPlan().getLastTestNumber(), 44 | Integer.valueOf(20)); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/TestTapConsumerExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import org.junit.Test; 31 | 32 | 33 | /** 34 | * Test class for TapConsumerException. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestTapConsumerExceptionTest { 39 | 40 | private TapConsumerException exception; 41 | 42 | @Test 43 | public void testTapConsumerException1() { 44 | exception = new TapConsumerException(); 45 | assertNotNull(exception); 46 | } 47 | 48 | @Test 49 | public void testTapConsumerException2() { 50 | exception = new TapConsumerException("Error parsing document"); 51 | assertNotNull(exception); 52 | assertEquals(exception.getMessage(), "Error parsing document"); 53 | } 54 | 55 | @Test 56 | public void testTapConsumerException3() { 57 | exception = new TapConsumerException(new NullPointerException("Null TAP Stream")); // NOPMD 58 | assertNotNull(exception); 59 | assertTrue(exception.getCause() instanceof NullPointerException); 60 | } 61 | 62 | @Test 63 | public void testTapConsumerException4() { 64 | exception = new TapConsumerException("Null", new NullPointerException()); // NOPMD 65 | assertNotNull(exception); 66 | assertEquals(exception.getMessage(), "Null"); 67 | assertTrue(exception.getCause() instanceof NullPointerException); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/TestTapConsumerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer; 25 | 26 | import static org.junit.Assert.assertTrue; 27 | import static org.junit.Assert.assertNotNull; 28 | 29 | import java.lang.reflect.Constructor; 30 | import java.lang.reflect.InvocationTargetException; 31 | 32 | import org.junit.Test; 33 | import org.tap4j.parser.Parser; 34 | import org.tap4j.parser.Tap13Parser; 35 | 36 | /** 37 | * Test class for TAP Consumer Factory. 38 | * 39 | * @since 1.0 40 | */ 41 | public class TestTapConsumerFactory { 42 | 43 | @Test 44 | public void testMakeTap13Consumer() { 45 | final TapConsumer tapConsumer = TapConsumerFactory.makeTap13Consumer(); 46 | final Parser tap13Parser = tapConsumer.getParser(); 47 | assertTrue(tap13Parser instanceof Tap13Parser); 48 | } 49 | 50 | @Test 51 | public void testMakeTap13YamlConsumer() { 52 | final TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 53 | final Parser tap13YamlParser = tapConsumer.getParser(); 54 | assertTrue(tap13YamlParser instanceof Tap13Parser); 55 | } 56 | 57 | @Test 58 | public void testTapConsumerFactoryConstructor() throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { 59 | final Constructor c = TapConsumerFactory.class 60 | .getDeclaredConstructors()[0]; 61 | c.setAccessible(true); 62 | final Object o = c.newInstance((Object[]) null); 63 | assertNotNull(o); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/issue3311330/TestTap13YamlConsumerWithMultipleFiles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer.issue3311330; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | 29 | import org.junit.Test; 30 | import org.tap4j.BaseTapTest; 31 | import org.tap4j.model.TestSet; 32 | 33 | /** 34 | * @since 2.0.4 35 | */ 36 | public class TestTap13YamlConsumerWithMultipleFiles extends BaseTapTest { 37 | 38 | @Test 39 | public void testConsumerWithMultipleFiles() { 40 | TestSet testSet = getTestSet("/org/tap4j/consumer/issue3311330/1.tap"); 41 | assertNotNull("Empty Test Set", testSet); 42 | assertEquals("Wrong number of tests", 2, testSet.getTestResults().size()); 43 | 44 | testSet = getTestSet("/org/tap4j/consumer/issue3311330/fala.tap"); 45 | assertNotNull("Empty Test Set", testSet); 46 | assertEquals("Wrong number of tests", 3, testSet.getTestResults().size()); 47 | 48 | testSet = getTestSet("/org/tap4j/consumer/issue3311330/oi.tap"); 49 | assertNotNull("Empty Test Set", testSet); 50 | assertEquals("Wrong number of tests", 1, testSet.getTestResults().size()); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/issue3311330/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3311330. 3 | * 4 | */ 5 | package org.tap4j.consumer.issue3311330; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/issue3504508/TestIssue3504508.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer.issue3504508; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertNull; 29 | 30 | import java.io.File; 31 | 32 | import org.junit.Test; 33 | import org.tap4j.BaseTapTest; 34 | import org.tap4j.consumer.TapConsumer; 35 | import org.tap4j.consumer.TapConsumerFactory; 36 | import org.tap4j.model.TestSet; 37 | import org.tap4j.parser.Tap13Parser; 38 | import org.tap4j.producer.Producer; 39 | import org.tap4j.producer.TapProducer; 40 | 41 | /** 42 | * Tests for subtests. 43 | * 44 | * @since 0.1 45 | */ 46 | public class TestIssue3504508 extends BaseTapTest { 47 | 48 | @Test 49 | public void testTapConsumer() { 50 | final TestSet testSet = getTestSet(new Tap13Parser(/* enable subtests*/ true), "/org/tap4j/consumer/issue3504508/sample.tap"); 51 | assertNull(testSet.getTestResult(1).getSubtest()); 52 | assertNotNull(testSet.getTestResult(2).getSubtest() 53 | .getTestResult(2).getSubtest()); 54 | assertEquals(3, testSet.getTestResults().size()); 55 | } 56 | 57 | @Test 58 | public void testProducingSubtests() { 59 | final String expected = "1..3\n" 60 | + "ok 1 - First test\n" 61 | + " 1..2\n" 62 | + " ok 1 - This is a subtest\n" 63 | + " 1..2\n" 64 | + " ok 1 - This is a subtest\n" 65 | + " ok 2 - So is this\n" 66 | + " ok 2 - So is this\n" 67 | + "ok 2 - An example subtest\n" 68 | + "ok 3 - Third test\n"; 69 | final TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer(); 70 | final TestSet testSet = consumer.load(new File(TestIssue3504508.class 71 | .getResource("/org/tap4j/consumer/issue3504508/sample.tap").getFile())); 72 | final Producer producer = new TapProducer(); 73 | assertEquals(expected, producer.dump(testSet)); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/issue3504508/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3504508. 3 | * 4 | */ 5 | package org.tap4j.consumer.issue3504508; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for TAP Consumer. 3 | */ 4 | package org.tap4j.consumer; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/subtestOrder/TestSubtestOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.consumer.subtestOrder; 25 | 26 | import org.junit.Test; 27 | import org.tap4j.BaseTapTest; 28 | import org.tap4j.consumer.TapConsumer; 29 | import org.tap4j.consumer.TapConsumerFactory; 30 | import org.tap4j.model.TestSet; 31 | import org.tap4j.producer.TapProducerFactory; 32 | 33 | import java.io.File; 34 | 35 | import static junit.framework.TestCase.assertNotNull; 36 | import static org.junit.Assert.assertEquals; 37 | 38 | /** 39 | * Tests for correct subtests order. 40 | * 41 | * @since 4.3 42 | */ 43 | public class TestSubtestOrder extends BaseTapTest { 44 | @Test 45 | public void testProducingSubtests() { 46 | final TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer(); 47 | final TestSet testSet = consumer.load(new File(TestSubtestOrder.class 48 | .getResource("/org/tap4j/consumer/subtestOrder/subtest.tap").getFile())); 49 | String expected = "1..2\n" 50 | + "ok 1 - First test\n" 51 | + " 1..1\n" 52 | + " 1..1\n" 53 | + " ok 1 - Internal subtest subtest\n" 54 | + " ok 1 - Internal subtest\n" 55 | + "ok 2 - Some subtest\n"; 56 | assertEquals(expected, TapProducerFactory.makeTap13Producer().dump(testSet)); 57 | assertNotNull(testSet.getTestResult(2).getSubtest()); 58 | assertNotNull(testSet.getTestResult(2).getSubtest() 59 | .getTestResult(1).getSubtest()); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/consumer/subtestOrder/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for correct subtests order. 3 | */ 4 | package org.tap4j.consumer.subtestOrder; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/TestDirective.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNull; 28 | 29 | import org.junit.Before; 30 | import org.junit.Test; 31 | import org.tap4j.util.DirectiveValues; 32 | 33 | /** 34 | * Tests a TAP directive. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestDirective { 39 | 40 | private Directive directive; 41 | 42 | @Before 43 | public void setUp() { 44 | directive = new Directive(DirectiveValues.TODO, "Not implemented yet."); 45 | } 46 | 47 | @Test 48 | public void testDirective() { 49 | assertEquals(directive.getReason(), "Not implemented yet."); 50 | assertEquals(directive.getDirectiveValue(), DirectiveValues.TODO); 51 | } 52 | 53 | @Test 54 | public void testNoReason() { 55 | directive = new Directive(DirectiveValues.SKIP, null); 56 | assertNull(directive.getReason()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/TestTAPBailOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertNull; 29 | 30 | import org.junit.Before; 31 | import org.junit.Test; 32 | 33 | 34 | /** 35 | * Tests TAP Bail Out element. 36 | * 37 | * @since 1.0 38 | */ 39 | public class TestTAPBailOut { 40 | 41 | protected BailOut bailOut; 42 | private final static String REASON = "It is monday."; 43 | 44 | @Before 45 | public void setUp() { 46 | bailOut = new BailOut(REASON); 47 | bailOut.setComment(new Comment("Bail out comment")); 48 | } 49 | 50 | @Test 51 | public void testBailOut() { 52 | assertNotNull(bailOut); 53 | assertEquals(bailOut.getReason(), REASON); 54 | assertNotNull(bailOut.getComment()); 55 | assertNotNull(bailOut.getComment().getText()); 56 | bailOut = new BailOut(null); 57 | assertNull(bailOut.getReason()); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/TestTAPFooter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | 29 | import org.junit.Before; 30 | import org.junit.Test; 31 | 32 | /** 33 | * Tests TAP Footer. 34 | * 35 | * @since 1.0 36 | */ 37 | public class TestTAPFooter { 38 | 39 | protected Footer footer; 40 | 41 | private final static String FOOTER_TEXT = "done"; 42 | 43 | @Before 44 | public void setUp() { 45 | footer = new Footer(FOOTER_TEXT); 46 | } 47 | 48 | @Test 49 | public void testFooter() { 50 | assertNotNull(footer); 51 | assertNotNull(footer.getText()); 52 | assertEquals(footer.getText(), FOOTER_TEXT); 53 | } 54 | 55 | @Test 56 | public void testFooterWithComment() { 57 | footer.setComment(new Comment("Footer's comment.")); 58 | assertNotNull(this.footer.getComment()); 59 | assertEquals(this.footer.getComment().getText(), 60 | "Footer's comment."); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/TestTAPHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | 29 | import org.junit.Before; 30 | import org.junit.Test; 31 | 32 | /** 33 | * @since 1.0 34 | */ 35 | public class TestTAPHeader { 36 | 37 | protected Header header; 38 | 39 | protected final static Integer TAP_VERSION = 13; 40 | 41 | @Before 42 | public void setUp() { 43 | this.header = new Header(TAP_VERSION); 44 | } 45 | 46 | @Test 47 | public void testHeader() { 48 | assertNotNull(this.header); 49 | assertEquals(this.header.getVersion(), TestTAPHeader.TAP_VERSION); 50 | } 51 | 52 | @Test 53 | public void testComment() { 54 | this.header.setComment(new Comment("Header's comment.")); 55 | assertNotNull(this.header.getComment()); 56 | assertEquals(this.header.getComment().getText(), "Header's comment."); 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/TestText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.model; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import org.junit.Before; 29 | import org.junit.Test; 30 | 31 | /** 32 | * @since 1.0 33 | */ 34 | public class TestText { 35 | 36 | protected Text text; 37 | 38 | @Before 39 | public void setUp() { 40 | text = new Text("Invalid token"); 41 | } 42 | 43 | @Test 44 | public void testText() { 45 | assertNotNull(text.getValue()); 46 | assertNotNull(text.getDiagnostic()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for TAP models. 3 | */ 4 | package org.tap4j.model; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Root test package. 3 | */ 4 | package org.tap4j; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/TestConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import java.lang.reflect.Constructor; 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | import org.junit.Test; 32 | import org.tap4j.model.Patterns; 33 | 34 | /** 35 | * Tests for parser Patterns. 36 | */ 37 | public class TestConstants { 38 | 39 | @Test 40 | public void testUtilConstructor() throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { 41 | final Constructor c = Patterns.class 42 | .getDeclaredConstructors()[0]; 43 | c.setAccessible(true); 44 | final Object o = c.newInstance((Object[]) null); 45 | assertNotNull(o); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/TestParserExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import org.junit.Test; 31 | 32 | 33 | /** 34 | * Test class for ParserException. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestParserExceptionTest { 39 | 40 | private ParserException exception; 41 | 42 | @Test 43 | public void testTapParserException1() { 44 | exception = new ParserException(); 45 | assertNotNull(exception); 46 | } 47 | 48 | @Test 49 | public void testTapParserException2() { 50 | exception = new ParserException("Error parsing document"); 51 | assertNotNull(exception); 52 | assertEquals(exception.getMessage(), "Error parsing document"); 53 | } 54 | 55 | @Test 56 | public void testTapParserException3() { 57 | exception = new ParserException(new NullPointerException("Null TAP Stream")); // NOPMD 58 | assertNotNull(exception); 59 | assertTrue(exception.getCause() instanceof NullPointerException); 60 | } 61 | 62 | @Test 63 | public void testTapParserException4() { 64 | exception = new ParserException("Null", new NullPointerException()); // NOPMD 65 | assertNotNull(exception); 66 | assertEquals(exception.getMessage(), "Null"); 67 | assertTrue(exception.getCause() instanceof NullPointerException); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3406964/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3406964. 3 | * 4 | */ 5 | package org.tap4j.parser.issue3406964; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3409478/TestDoneTesting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issue3409478; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | import org.junit.Test; 29 | import org.tap4j.consumer.TapConsumer; 30 | import org.tap4j.consumer.TapConsumerFactory; 31 | import org.tap4j.model.TestSet; 32 | 33 | /** 34 | *

Test class for issue 3409478.

35 | *

36 | * Perl's Test::More supports a 'done_testing()', so you do not need to 37 | * predeclare how many tests you are running, this produces: 38 | *

39 | *
    40 | *
  • ok 1 - Test1;
  • 41 | *
  • ok 2 - got document root
  • 42 | *
  • ok 3 - document root ok
  • 43 | *
  • 1..3
  • 44 | *
  • ok
  • 45 | *
46 | * 47 | * @since 2.0.6 48 | */ 49 | public class TestDoneTesting { 50 | 51 | final TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer(); 52 | 53 | @Test 54 | public void testDoneTesting() { 55 | String tapStream = "ok 1 - Test1;\n" + "ok 2 - got document root\n" 56 | + "ok 3 - document root ok\n" + "1..3\n" + "ok"; 57 | 58 | TestSet testSet = consumer.load(tapStream); 59 | assertEquals(3, testSet.getTestResults().size()); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3409478/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3409478. 3 | * 4 | */ 5 | package org.tap4j.parser.issue3409478; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3525603/Test3525603.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issue3525603; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | import org.junit.Test; 29 | import org.tap4j.consumer.TapConsumer; 30 | import org.tap4j.consumer.TapConsumerFactory; 31 | import org.tap4j.model.TestSet; 32 | 33 | /** 34 | * Tests for issue 3525603. 35 | * 36 | * @since 3.0 37 | */ 38 | public class Test3525603 { 39 | 40 | @Test 41 | public void testDoneTestingMark() { 42 | final String tap = "1..1\n" + "ok 1\n" + "ok"; 43 | final TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer(); 44 | final TestSet testSet = consumer.load(tap); 45 | assertEquals(1, testSet.getTestResults().size()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3525603/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3525603. 3 | * 4 | */ 5 | package org.tap4j.parser.issue3525603; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3525607/TestIssue3525607.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issue3525607; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | import java.util.List; 29 | 30 | import org.junit.Test; 31 | import org.tap4j.BaseTapTest; 32 | import org.tap4j.model.Comment; 33 | import org.tap4j.model.TestResult; 34 | import org.tap4j.model.TestSet; 35 | 36 | /** 37 | * Tests for issue 3525607 38 | * 39 | * @since 3.0 40 | */ 41 | public class TestIssue3525607 extends BaseTapTest { 42 | 43 | @Test 44 | public void testTestResultWithCommentDiagnostics() { 45 | final String tap = "1..2\n" + "ok 1 - OK\n" + "# No errors found\n" 46 | + "not ok 2\n" + "# Invalid stream character\n" 47 | + "# Missing end transmission signal\n" 48 | + "# Aborting mission!\n" + "ok"; 49 | final TestSet testSet = getConsumer().load(tap); 50 | assertEquals("No errors found", 51 | testSet.getTestResult(1).getComments().get(0).getText()); 52 | final String expected = "Invalid stream character\n" 53 | + "Missing end transmission signal\n" + "Aborting mission!\n"; 54 | final StringBuilder actualCommentText = new StringBuilder(); 55 | final TestResult testResult = testSet.getTestResult(2); 56 | final List comments = testResult.getComments(); 57 | for (Comment comment : comments) { 58 | actualCommentText.append(comment.getText()); 59 | actualCommentText.append("\n"); 60 | } 61 | assertEquals(expected, actualCommentText.toString()); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issue3525607/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for issue 3525607. 3 | * 4 | */ 5 | package org.tap4j.parser.issue3525607; 6 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub12/TestSubtestAsFirstTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub12; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import java.io.File; 30 | import java.util.List; 31 | 32 | import org.junit.Test; 33 | import org.tap4j.consumer.TapConsumer; 34 | import org.tap4j.consumer.TapConsumerFactory; 35 | import org.tap4j.model.TestResult; 36 | import org.tap4j.model.TestSet; 37 | import org.tap4j.parser.issue3406964.TestDirectives; 38 | 39 | /** 40 | * TAP Streams with a subtest as first test fail, complaining about a duplicate 41 | * TAP plan found. 42 | * 43 | * @since 4.0.2 44 | */ 45 | public class TestSubtestAsFirstTest { 46 | 47 | /** 48 | * Tests substests as first test in a TAP Stream. 49 | */ 50 | @Test 51 | public void testSubtestAsFirstTest() { 52 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 53 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 54 | .getResource("/org/tap4j/parser/issueGitHub12/issue-12-tap-stream.tap") 55 | .getFile())); 56 | 57 | assertNotNull(testSet); 58 | 59 | final List testResults = testSet.getTestResults(); 60 | 61 | assertEquals(2, testResults.size()); 62 | 63 | assertEquals(1, testResults.get(0).getSubtest().getTestResults().size()); 64 | assertEquals(4, testResults.get(1).getSubtest().getTestResults().size()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub12/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #12. 3 | * 4 | * subtest as first test causes ParserException (Duplicated TAP plan found) by @jochenk 5 | */ 6 | package org.tap4j.parser.issueGitHub12; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub14/TestDiagnostics.java: -------------------------------------------------------------------------------- 1 | package org.tap4j.parser.issueGitHub14; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import java.io.File; 7 | 8 | import org.junit.Test; 9 | import org.tap4j.consumer.TapConsumer; 10 | import org.tap4j.consumer.TapConsumerFactory; 11 | import org.tap4j.model.TestResult; 12 | import org.tap4j.model.TestSet; 13 | import org.tap4j.parser.issue3406964.TestDirectives; 14 | 15 | /** 16 | * Diagnostics are added to all test cases, after one with diagnostics was found. 17 | * 18 | * @since 4.0.3 19 | */ 20 | public class TestDiagnostics { 21 | 22 | @Test 23 | public void testDiagnostics() { 24 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 25 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 26 | .getResource("/org/tap4j/parser/issueGitHub14/issue-14-tap-stream.tap") 27 | .getFile())); 28 | 29 | for (TestResult tr : testSet.getTestResults()) { 30 | if (tr.getTestNumber() == 3) { 31 | assertTrue(tr.getDiagnostic().size() > 0); 32 | } else { 33 | assertEquals(0, tr.getDiagnostic().size()); 34 | } 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub14/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #12. 3 | * 4 | * Diagnostics are added to all test cases, after one with diagnostics was found 5 | */ 6 | package org.tap4j.parser.issueGitHub14; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub15/TestSubtestAsFirstTestNoPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub15; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import java.io.File; 30 | import java.util.List; 31 | 32 | import org.junit.Test; 33 | import org.tap4j.consumer.TapConsumer; 34 | import org.tap4j.consumer.TapConsumerFactory; 35 | import org.tap4j.model.TestResult; 36 | import org.tap4j.model.TestSet; 37 | import org.tap4j.parser.issue3406964.TestDirectives; 38 | 39 | /** 40 | * TAP Streams with a subtest as first test fail, complaining about a duplicate 41 | * TAP plan found. 42 | * 43 | * @since 4.2.0 44 | */ 45 | public class TestSubtestAsFirstTestNoPlan { 46 | 47 | /** 48 | * Tests sub-tests as first tests in a TAP Stream with no plan provided up front. 49 | */ 50 | @Test 51 | public void testSubtestAsFirstTest() { 52 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 53 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 54 | .getResource("/org/tap4j/parser/issueGitHub15/issue-15-tap-stream.tap") 55 | .getFile())); 56 | 57 | assertNotNull(testSet); 58 | 59 | final List testResults = testSet.getTestResults(); 60 | 61 | assertEquals(2, testResults.size()); 62 | 63 | assertEquals(2, testResults.get(0).getSubtest().getTestResults().size()); 64 | assertEquals(2, testResults.get(1).getSubtest().getTestResults().size()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub15/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #15. 3 | * 4 | * subtest as first test causes ParserException (Invalid indentation. Check your TAP Stream.) by @jochenk 5 | */ 6 | package org.tap4j.parser.issueGitHub15; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub16/TestOptionalTestNumbers.java: -------------------------------------------------------------------------------- 1 | package org.tap4j.parser.issueGitHub16; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.io.File; 6 | 7 | import org.junit.Test; 8 | import org.tap4j.consumer.TapConsumer; 9 | import org.tap4j.consumer.TapConsumerFactory; 10 | import org.tap4j.model.TestSet; 11 | import org.tap4j.parser.issue3406964.TestDirectives; 12 | 13 | /** 14 | * Optional test numbers are not working 15 | * 16 | * @since 4.0.4 17 | */ 18 | public class TestOptionalTestNumbers { 19 | 20 | @Test 21 | public void testOptionalTestNumbers() { 22 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 23 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 24 | .getResource("/org/tap4j/parser/issueGitHub16/issue-16-tap-stream.tap") 25 | .getFile())); 26 | 27 | assertEquals(3, testSet.getTestResults().size()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub16/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #16. 3 | * 4 | * Optional test numbers are not working 5 | */ 6 | package org.tap4j.parser.issueGitHub16; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub17/TestLastYamlishBeingCut.java: -------------------------------------------------------------------------------- 1 | package org.tap4j.parser.issueGitHub17; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNotNull; 5 | 6 | import java.io.File; 7 | 8 | import org.junit.Test; 9 | import org.tap4j.consumer.TapConsumer; 10 | import org.tap4j.consumer.TapConsumerFactory; 11 | import org.tap4j.model.TestResult; 12 | import org.tap4j.model.TestSet; 13 | import org.tap4j.parser.issue3406964.TestDirectives; 14 | 15 | /*When parsing the TAP Stream below with a TAPConsumerFactory.makeTap13YamlConsumer, it seems that tap4j (using 4.0.4) does not hold onto the YAML diagnostic for anotherDummyTest. Note that it finds it correctly when there are no subtests, and the subtests themselves are handled correctly in the presence of the yaml, but it is not placing this value into the Map when there are subtests. 16 | 17 | TAP version 13 18 | 1..2 19 | --- 20 | datetime: 20100101T000000 21 | ... 22 | ok 1 - someDummyTest 23 | --- 24 | datetime: 20100101T000002 25 | ... 26 | 1..5 27 | ok 28 | ok 29 | ok 30 | ok 31 | ok 32 | ok 2 - anotherDummyTest 33 | --- 34 | datetime: 20100101T000005 35 | ... 36 | 1..1 37 | ok*/ 38 | /** 39 | * Stream with subtests chopping off last yaml diagnostic 40 | * @since 4.0.5 41 | */ 42 | public class TestLastYamlishBeingCut { 43 | 44 | @Test 45 | public void testLastYamlishBeingCut() { 46 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 47 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 48 | .getResource("/org/tap4j/parser/issueGitHub17/issue-17-tap-stream.tap") 49 | .getFile())); 50 | 51 | assertEquals(2, testSet.getTestResults().size()); 52 | 53 | TestResult tr1 = testSet.getTestResult(1); 54 | TestSet tr1Subtest = tr1.getSubtest(); 55 | assertNotNull(tr1Subtest); 56 | assertEquals(5, tr1Subtest.getTestResults().size()); 57 | 58 | TestResult tr2 = testSet.getTestResult(2); 59 | TestSet tr2Subtest = tr2.getSubtest(); 60 | assertNotNull(tr2Subtest); 61 | assertEquals(1, tr2Subtest.getTestResults().size()); 62 | 63 | assertEquals(1, tr2.getDiagnostic().size()); 64 | 65 | TestResult tr2_1 = tr2Subtest.getTestResult(1); 66 | assertNotNull(tr2_1); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub17/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #17. 3 | * 4 | * Stream with subtests chopping off last yaml diagnostic 5 | */ 6 | package org.tap4j.parser.issueGitHub17; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub20/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #20. 3 | * 4 | * Parser has incorrect logic for ending yaml diagnostics 5 | */ 6 | package org.tap4j.parser.issueGitHub20; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub22/TestAllowTapPlanTBeOptional.java: -------------------------------------------------------------------------------- 1 | package org.tap4j.parser.issueGitHub22; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.io.File; 6 | import java.nio.charset.Charset; 7 | 8 | import org.junit.Test; 9 | import org.tap4j.model.TestSet; 10 | import org.tap4j.parser.Tap13Parser; 11 | import org.tap4j.parser.issue3406964.TestDirectives; 12 | 13 | /** 14 | * Parser has incorrect logic for ending yaml diagnostics 15 | * @since 4.0.7 16 | */ 17 | public class TestAllowTapPlanTBeOptional { 18 | 19 | @Test 20 | public void testAllowTapPlanTBeOptional() { 21 | Tap13Parser parser = new Tap13Parser(Charset.defaultCharset().toString(), true, false); 22 | TestSet testSet = parser.parseFile(new File(TestDirectives.class 23 | .getResource("/org/tap4j/parser/issueGitHub22/issue-22-tap-stream.tap") 24 | .getFile())); 25 | 26 | assertEquals(4, testSet.getTestResults().size()); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub22/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #22. 3 | * 4 | * Allow TAP plan to be optional 5 | */ 6 | package org.tap4j.parser.issueGitHub22; 7 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub33/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010-2015 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Tests for GitHub issue #33. 27 | * 28 | * tap4j trips over YAML/TAP output that is included in the diagnostics of its own YAML 29 | */ 30 | package org.tap4j.parser.issueGitHub33; 31 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub37/TestSkipDirective.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010-2015 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub37; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import org.junit.Test; 29 | import org.tap4j.consumer.TapConsumer; 30 | import org.tap4j.consumer.TapConsumerImpl; 31 | import org.tap4j.model.TestSet; 32 | import org.tap4j.parser.Tap13Parser; 33 | 34 | /** 35 | * Makes sure that a SKIP directive is not taken as a comment. 36 | * 37 | * @author Bruno P. Kinoshita 38 | * @since 4.1.1 39 | */ 40 | public class TestSkipDirective { 41 | 42 | @Test 43 | public void testSkipDirectivePresent() { 44 | TapConsumer consumer = new TapConsumerImpl(new Tap13Parser("ISO-8859-1", false, false)); 45 | TestSet ts = consumer.load("#cat /var/lib/jenkins/jobs/gh-mellanox-v1.8-PR/builds/137/tap-master-files/cov_stat.tap\n" + 46 | "not ok 1 #SKIP\n" + 47 | "ok 2 - coverity found no issues for oshmem\n" + 48 | "ok 3 - coverity found no issues for yalla\n" + 49 | "ok 4 - coverity found no issues for mxm\n" + 50 | "ok 5 - coverity found no issues for fca\n" + 51 | "ok 6 - coverity found no issues for hcoll"); 52 | assertNotNull(ts.getTestResults().get(0).getDirective()); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub37/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010-2015 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Tests for issue 37 in GitHub - https://github.com/tupilabs/tap4j/issues/37 27 | * @author Bruno P. Kinoshita 28 | * @since 4.1.1 29 | */ 30 | package org.tap4j.parser.issueGitHub37; 31 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub41/FalseDupPlanTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2016 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub41; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import java.io.File; 30 | import java.util.List; 31 | 32 | import org.junit.Test; 33 | import org.tap4j.consumer.TapConsumer; 34 | import org.tap4j.consumer.TapConsumerFactory; 35 | import org.tap4j.model.TestResult; 36 | import org.tap4j.model.TestSet; 37 | 38 | /** 39 | * TAP Streams with a 1..0 plan could fail, complaining about a duplicate 40 | * TAP plan found. 41 | * 42 | * @since 4.2.1 43 | */ 44 | public class FalseDupPlanTest { 45 | 46 | /** 47 | * 1..0 plan should not break parser. 48 | */ 49 | @Test 50 | public void testParsingWhenEmptyPlansPresent() { 51 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumer(); 52 | 53 | TestSet testSet = tapConsumer.load(new File(FalseDupPlanTest.class 54 | .getResource("/org/tap4j/parser/issueFalseDupPlan/npm-test.tap") 55 | .getFile())); 56 | 57 | assertNotNull(testSet); 58 | 59 | final List testResults = testSet.getTestResults(); 60 | assertEquals(41, testResults.size()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub41/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010-2016 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Tests for GitHub issue #41. 27 | * 28 | * When an empty plan, 1..0, occurred right after a previous plan, it used to be 29 | * evaluated as error added a test case 30 | */ 31 | package org.tap4j.parser.issueGitHub41; 32 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub5/TestRandomStdoutAfterTestPlanAtEnd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub5; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import org.junit.Test; 29 | import org.tap4j.BaseTapTest; 30 | import org.tap4j.model.TestSet; 31 | 32 | /** 33 | * If there is random STDOUT after a tap plan at end, it fails. 34 | *

35 | * This issue has been fixed, as consequence of fixing issue 3409478. 36 | *

37 | * 38 | * @since 2.0.6 39 | */ 40 | public class TestRandomStdoutAfterTestPlanAtEnd extends BaseTapTest { 41 | 42 | /** 43 | * Tests a TapConsumer reading a plan at end with random output afterwards. 44 | */ 45 | @Test 46 | public void testRandomStoutAfterTestPlanAtEnd() { 47 | final String validTapStream = "ok 1\n1..1\nJust some random stuff here"; 48 | final TestSet testSet = getConsumer().load(validTapStream); 49 | assertNotNull(testSet); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub5/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #5. 3 | */ 4 | package org.tap4j.parser.issueGitHub5; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub6/TestMissingTapPlan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.parser.issueGitHub6; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import java.io.File; 29 | 30 | import org.junit.Test; 31 | import org.tap4j.consumer.TapConsumer; 32 | import org.tap4j.consumer.TapConsumerFactory; 33 | import org.tap4j.model.TestSet; 34 | import org.tap4j.parser.issue3406964.TestDirectives; 35 | 36 | /** 37 | * The parser keeps complaining about a missing plan in a stream that does have 38 | * a tap plan. 39 | *

40 | * 41 | * @since 3.3 42 | */ 43 | public class TestMissingTapPlan { 44 | 45 | /** 46 | * Tests the TAP plan of a stream. 47 | */ 48 | @Test 49 | public void testTapPlan() { 50 | TapConsumer tapConsumer = TapConsumerFactory.makeTap13YamlConsumerWithoutSubtests(); 51 | TestSet testSet = tapConsumer.load(new File(TestDirectives.class 52 | .getResource("/org/tap4j/parser/issueGitHub6/test-report.tap") 53 | .getFile())); 54 | 55 | assertNotNull(testSet); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueGitHub6/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for GitHub issue #6. 3 | */ 4 | package org.tap4j.parser.issueGitHub6; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/issueYaml/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for Yaml issue. 3 | */ 4 | package org.tap4j.parser.issueYaml; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/parser/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for TAP regex parser. 3 | */ 4 | package org.tap4j.parser; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/perl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for Perl integration. 3 | */ 4 | package org.tap4j.perl; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/producer/TestTapProducerExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.producer; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNotNull; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import org.junit.Test; 31 | 32 | 33 | /** 34 | * Test class for TapProducerException. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestTapProducerExceptionTest { 39 | 40 | private ProducerException exception; 41 | 42 | @Test 43 | public void testTapProducerException1() { 44 | exception = new ProducerException(); 45 | assertNotNull(exception); 46 | } 47 | 48 | @Test 49 | public void testTapProducerException2() { 50 | exception = new ProducerException("Error parsing document"); 51 | assertNotNull(exception); 52 | assertEquals(exception.getMessage(), "Error parsing document"); 53 | } 54 | 55 | @Test 56 | public void testTapProducerException3() { 57 | exception = new ProducerException(new NullPointerException("Null TAP Stream")); // NOPMD 58 | assertNotNull(exception); 59 | assertTrue(exception.getCause() instanceof NullPointerException); 60 | } 61 | 62 | @Test 63 | public void testTapProducerException4() { 64 | exception = new ProducerException("Null", new NullPointerException()); // NOPMD 65 | assertNotNull(exception); 66 | assertEquals(exception.getMessage(), "Null"); 67 | assertTrue(exception.getCause() instanceof NullPointerException); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/producer/TestTapProducerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.producer; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertTrue; 28 | 29 | import org.junit.Test; 30 | import org.tap4j.representer.Representer; 31 | import org.tap4j.representer.Tap13Representer; 32 | 33 | /** 34 | * Test Class for TAP Producer Factories. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestTapProducerFactory { 39 | 40 | @Test 41 | public void testMakeTap13Producer() { 42 | final Producer tapProducer = new TapProducer(); 43 | final Representer tap13Representer = tapProducer.getRepresenter(); 44 | assertTrue(tap13Representer instanceof Tap13Representer); 45 | } 46 | 47 | @Test 48 | public void testMakeTap13YamlProducer() { 49 | final Producer tapProducer = new TapProducer(); 50 | final Representer tap13YamlRepresenter = tapProducer.getRepresenter(); 51 | assertTrue(tap13YamlRepresenter instanceof Tap13Representer); 52 | } 53 | 54 | @Test 55 | public void testTapProducerFactoryConstructor() throws IllegalArgumentException { 56 | TapProducer producer = new TapProducer(); 57 | assertNotNull(producer); 58 | Representer representer = new Tap13Representer(); 59 | producer = new TapProducer(representer); 60 | assertNotNull(producer); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/producer/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for TAP Producer. 3 | */ 4 | package org.tap4j.producer; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/representer/TestDumperOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.representer; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertFalse; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import java.nio.charset.Charset; 31 | 32 | import org.junit.Before; 33 | import org.junit.Test; 34 | 35 | /** 36 | * Tests for DumperOptions. 37 | * 38 | * @since 4.0 39 | */ 40 | public class TestDumperOptions { 41 | 42 | private DumperOptions options = null; 43 | 44 | @Before 45 | public void setUp() { 46 | options = new DumperOptions(); 47 | } 48 | 49 | @Test 50 | public void testDefaultOptions() { 51 | assertEquals(0, options.getIndent()); 52 | assertEquals(4, options.getSpaces()); 53 | assertTrue(options.isAllowEmptyTestPlan()); 54 | assertFalse(options.isPrintDiagnostics()); 55 | assertTrue(options.isPrintSubtests()); 56 | assertEquals(Charset.defaultCharset().toString(), options.getCharset()); 57 | } 58 | 59 | @Test 60 | public void testChangingOptions() { 61 | int indent = 1; 62 | int spaces = 2; 63 | boolean allowEmptyTestPlan = false; 64 | boolean printDiagnostics = true; 65 | boolean printSubtests = false; 66 | String charset = "ISO-8859-1"; 67 | options.setIndent(indent); 68 | options.setSpaces(spaces); 69 | options.setAllowEmptyTestPlan(allowEmptyTestPlan); 70 | options.setPrintDiagnostics(printDiagnostics); 71 | options.setPrintSubtests(printSubtests); 72 | options.setCharset(charset); 73 | assertEquals(indent, options.getIndent()); 74 | assertEquals(spaces, options.getSpaces()); 75 | assertEquals(allowEmptyTestPlan, options.isAllowEmptyTestPlan()); 76 | assertEquals(printDiagnostics, options.isPrintDiagnostics()); 77 | assertEquals(printSubtests, options.isPrintSubtests()); 78 | assertEquals(charset, options.getCharset()); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/representer/TestRepresenterExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.representer; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertEquals; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import org.junit.Test; 31 | 32 | 33 | /** 34 | * Test class for RepresenterException. 35 | * 36 | * @since 1.0 37 | */ 38 | public class TestRepresenterExceptionTest { 39 | 40 | private RepresenterException exception; 41 | 42 | @Test 43 | public void testTapParserException1() { 44 | exception = new RepresenterException(); 45 | assertNotNull(exception); 46 | } 47 | 48 | @Test 49 | public void testTapParserException2() { 50 | exception = new RepresenterException("Error parsing document"); 51 | assertNotNull(exception); 52 | assertEquals(exception.getMessage(), "Error parsing document"); 53 | } 54 | 55 | @Test 56 | public void testTapParserException3() { 57 | exception = new RepresenterException(new NullPointerException("Null TAP Stream")); // NOPMD 58 | assertNotNull(exception); 59 | assertTrue(exception.getCause() instanceof NullPointerException); 60 | } 61 | 62 | @Test 63 | public void testTapParserException4() { 64 | exception = new RepresenterException("Null", new NullPointerException()); // NOPMD 65 | assertNotNull(exception); 66 | assertEquals(exception.getMessage(), "Null"); 67 | assertTrue(exception.getCause() instanceof NullPointerException); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/representer/TestTapProducerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.representer; 25 | 26 | import static org.junit.Assert.assertNotNull; 27 | 28 | import java.lang.reflect.Constructor; 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | import org.junit.Test; 32 | import org.tap4j.producer.TapProducerFactory; 33 | 34 | /** 35 | * Tests for TAP Producer Factory. 36 | */ 37 | public class TestTapProducerFactory { 38 | 39 | @Test 40 | public void testTap13Producer() { 41 | assertNotNull(TapProducerFactory.makeTap13Producer()); 42 | } 43 | 44 | @Test 45 | public void testTapJUnitProducer() { 46 | assertNotNull(TapProducerFactory.makeTapJunitProducer("any-name")); 47 | } 48 | 49 | @Test(expected=Throwable.class) 50 | public void testPrivateConstructor() throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { 51 | final Constructor c = TapProducerFactory.class 52 | .getDeclaredConstructors()[0]; 53 | c.setAccessible(true); 54 | final Object o = c.newInstance((Object[]) null); 55 | assertNotNull(o); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/representer/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for TAP representer. 3 | */ 4 | package org.tap4j.representer; 5 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/util/TestDirectiveValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNull; 28 | 29 | import org.junit.Test; 30 | 31 | /** 32 | * Tests for directive values. 33 | */ 34 | public class TestDirectiveValues { 35 | 36 | @Test 37 | public void testToString() { 38 | assertEquals("SKIP", DirectiveValues.SKIP.toString()); 39 | assertEquals("TODO", DirectiveValues.TODO.toString()); 40 | } 41 | 42 | @Test 43 | public void testGetStatusValues() { 44 | assertNull(StatusValues.get(null)); 45 | assertEquals(DirectiveValues.SKIP, DirectiveValues.get("SKIP")); 46 | assertEquals(DirectiveValues.TODO, DirectiveValues.get("TODO")); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/util/TestStatusValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertNull; 28 | 29 | import org.junit.Test; 30 | 31 | /** 32 | * Tests for status values. 33 | */ 34 | public class TestStatusValues { 35 | 36 | @Test 37 | public void testToString() { 38 | assertEquals("ok", StatusValues.OK.toString()); 39 | assertEquals("not ok", StatusValues.NOT_OK.toString()); 40 | } 41 | 42 | @Test 43 | public void testGetStatusValues() { 44 | assertNull(StatusValues.get(null)); 45 | assertEquals(StatusValues.OK, StatusValues.get("ok")); 46 | assertEquals(StatusValues.NOT_OK, StatusValues.get("not ok")); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/util/TestTapVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 tap4j team (see AUTHORS) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package org.tap4j.util; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | import org.junit.Test; 29 | 30 | /** 31 | * @since 1.0 32 | */ 33 | public class TestTapVersion { 34 | 35 | @Test 36 | public void testTapVersionToString() { 37 | TapVersionValues version = TapVersionValues.TAP_13; 38 | assertEquals(13, (int) version.getValue()); 39 | assertEquals("13", version.toString()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/org/tap4j/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Tests for utility classes 3 | */ 4 | package org.tap4j.util; 5 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/1.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..3 3 | ok 1 4 | not ok 2 - an important test 5 | --- 6 | file: t/something.t 7 | line: 14 8 | tags: 9 | - unit 10 | - db 11 | results: 12 | have: ~ 13 | want: foobar 14 | ... 15 | ok 3 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/2.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..2 3 | ok 1 4 | --- 5 | ok: 1 # the key "ok" is used here just to illustrate there is no ambiguity 6 | ... 7 | ok 2 8 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/3.tap: -------------------------------------------------------------------------------- 1 | # http://svn.hexten.net/tapx/tap-tests/t/source/simple.yaml 2 | TAP version 13 3 | 1..1 4 | ok 1 5 | TAP done 6 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/4.tap: -------------------------------------------------------------------------------- 1 | # http://svn.hexten.net/tapx/tap-tests/t/source/skip.yaml 2 | TAP version 13 3 | 1..0 # SKIP skip testing 4 | TAP done 5 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/5.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..3 3 | ok 1 4 | not ok 2 - an important test 5 | --- 6 | file: foo.t 7 | line: 45 8 | description: an important test 9 | found: this 10 | wanted: that 11 | raw_test: is( "this", "that", "an important test" ); 12 | extensions: 13 | THAC0: 16 14 | ... 15 | ok 3 16 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/README: -------------------------------------------------------------------------------- 1 | http://testanything.org/wiki/index.php/TAP_diagnostic_syntax -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/comment_planskipall.tap: -------------------------------------------------------------------------------- 1 | # A simple comment for a plan skip all TAP Stream 2 | 1..0 #skip Not implemented yet. -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/header_plan.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..0 3 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/header_plan_tr.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..2 3 | 4 | ok 1 Test 1 5 | ok 2 6 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/header_plan_tr_footer.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..2 3 | 4 | ok 1 Test 1 5 | ok 2 6 | 7 | TAP this is the footer mate # he he he -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/header_planskipall.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 3 | 1..0 # skip Not implemented yet. -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/header_tr_plan.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ok 1 3 | ok 2 4 | 5 | 1..2 6 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_comment_tr_bailout_header.tap: -------------------------------------------------------------------------------- 1 | # A comment for a invalid TAP Stream 2 | 3 | ok 1 4 | 5 | not ok 3 6 | 7 | Bail out! No reason 8 | TAP version 13 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_header_tr.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ok 1 3 | ok 2 Two 4 | ok 3 5 | ok 4 6 | not ok 5 Error on 5 7 | ok 6 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_plan_header_plan.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | TAP version 13 3 | 1..2 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_plan_tr_header.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 3 | not ok 2 - Error 4 | ok 3 5 | TAP version 13 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_tr.tap: -------------------------------------------------------------------------------- 1 | ok 1 Test 1 2 | 3 | not ok 2 - The picture you provided is invalid. 4 | 5 | not ok 3 - Network IO Errror: Timeout limit exceeded: 30 s 6 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_tr_footer.tap: -------------------------------------------------------------------------------- 1 | ok 1 Test 1 2 | ok 2 3 | not ok 3 - Network IO Errror: Timeout limit exceeded: 30 s 4 | 5 | TAP This is the Footer mate 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_tr_header_header_tr.tap: -------------------------------------------------------------------------------- 1 | ok 1 2 | TAP version 13 3 | TAP version 13 4 | ok 2 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/invalid_tr_plan_header.tap: -------------------------------------------------------------------------------- 1 | ok 1 2 | not ok 2 3 | ok 3 4 | 1..3 5 | TAP version 3 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/issue3311330/1.tap: -------------------------------------------------------------------------------- 1 | 1..2 2 | ok 1 3 | --- 4 | name: Bruno 5 | ... 6 | not ok 2 Failed # TODO -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/issue3311330/fala.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 Success 3 | --- 4 | extension: 5 | Files: 6 | 1.txt: 7 | File-Name: 1.txt 8 | Location: /tmp/1.txt 9 | File-Type: text/plain 10 | message: hello 11 | ... 12 | ok 2 No problem 13 | not ok 3 Damn!!! # SKIP this routine wasn't implemented yet -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/issue3311330/oi.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..1 3 | not ok 1 4 | --- 5 | file: org.tap4j.testng.TestGoogleBrunoKinoshita.java 6 | description: null 7 | wanted: 'true' 8 | found: 'false' 9 | extensions: 10 | Start: 1291572796343 11 | End: 1291572797031 12 | Took: 688 13 | Parameters: '' 14 | Attributes: {} 15 | Files: 16 | File: 17 | File-Size: 104192 18 | File-Type: image/jpeg 19 | File-Description: Selenium Test testBuscaBrunoKinoshita 20 | File-Name: testBuscaBrunoKinoshita.jpg 21 | File-Title: testBuscaBrunoKinoshita.jpg 22 | File-Location: C:\dev\java\hudson_workspace\SampleTestNGSelenium\tap\testBuscaBrunoKinoshita.jpg 23 | ... 24 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/issue3504508/sample.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 - First test 3 | 1..2 4 | ok 1 - This is a subtest 5 | 1..2 6 | ok 1 - This is a subtest 7 | ok 2 - So is this 8 | ok 2 - So is this 9 | ok 2 - An example subtest 10 | ok 3 - Third test -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/org.tap4j.testng.TestGoogleBrunoKinoshita.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..1 3 | not ok 1 4 | --- 5 | file: org.tap4j.testng.TestGoogleBrunoKinoshita.java 6 | description: null 7 | wanted: 'true' 8 | found: 'false' 9 | extensions: 10 | Start: 1291572796343 11 | End: 1291572797031 12 | Took: 688 13 | Parameters: '' 14 | Attributes: {} 15 | Files: 16 | File: 17 | File-Size: 104192 18 | File-Type: image/jpeg 19 | File-Description: Selenium Test testBuscaBrunoKinoshita 20 | File-Name: testBuscaBrunoKinoshita.jpg 21 | File-Title: testBuscaBrunoKinoshita.jpg 22 | File-Location: C:\dev\java\hudson_workspace\SampleTestNGSelenium\tap\testBuscaBrunoKinoshita.jpg 23 | ... 24 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/org.tap4j.testng.konobi.tap: -------------------------------------------------------------------------------- 1 | not ok 1 2 | --- 3 | file: org.tap4j.testng.konobi.java 4 | description: null 5 | wanted: 'true' 6 | found: 'false' 7 | extensions: 8 | Start: 1291572796343 9 | End: 1291572797031 10 | Took: 688 11 | Parameters: '' 12 | Attributes: {} 13 | Files: 14 | File: 15 | File-Size: 104192 16 | File-Type: image/jpeg 17 | File-Description: Selenium Test testBuscaBrunoKinoshita 18 | File-Name: testBuscaBrunoKinoshita.jpg 19 | File-Title: testBuscaBrunoKinoshita.jpg 20 | File-Location: C:\dev\java\hudson_workspace\SampleTestNGSelenium\tap\testBuscaBrunoKinoshita.jpg 21 | stack: 22 | - Hello 23 | - "Is there anyone out there?" 24 | - | 25 | Is this what I'm looking for? 26 | test: good 27 | ... 28 | this: { thing: 'here', 29 | breaks: '=0(', 30 | 31 | 1..1 32 | # lets see... 33 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/plan_comment_tr_footer.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | # Test Results 3 | ok 1 4 | not ok 2 - IO Error: Couldn't find file "Bug.txt" 5 | ok 3 6 | TAP End of execution -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/plan_tr.tap: -------------------------------------------------------------------------------- 1 | 1..2 2 | ok 1 Test 1 3 | ok 2 4 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/single_tr.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..1 3 | ok 1 testOk 4 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/subtestOrder/subtest.tap: -------------------------------------------------------------------------------- 1 | ok 1 - First test 2 | ok 1 - Internal subtest subtest 3 | 1..1 4 | ok 1 - Internal subtest 5 | 1..1 6 | ok 2 - Some subtest 7 | 1..2 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/tap_with_diagnostic_and_without_lastparsedtestresult.tap: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bruno 3 | ... 4 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/tap_with_diagnostic_and_wrong_indentation.tap: -------------------------------------------------------------------------------- 1 | 1..2 2 | ok 1 3 | ok 2 4 | --- 5 | name: Bruno 6 | ... 7 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/tap_with_yaml_comments_bailout_directives.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 3 | --- 4 | name: Bruno 5 | ... 6 | not ok 2 # SKIP not implemented yet 7 | # a comment 8 | Bail out! a test failed 9 | ok 3 10 | TAP done -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/consumer/two_tr.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..2 3 | ok 1 testOk 4 | ok 2 anotherOK -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/jmeter/expected/jmeter-template.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..6 3 | not ok 1 009 - Op: consolidacion - [Validacin] - 1AUT Nivel 2 4 | --- 5 | message: 200 - OK- FailureMessage:ppp 6 | severity: 'failAssert ' 7 | dump: 'Warnning: url not registered' 8 | ... 9 | 10 | not ok 2 010 - Op: consolidacion - [Consolidacin] - 1AUT Nivel 2 11 | --- 12 | message: "200 - OK- FailureMessage:Test failed: text expected to equal /\n\t" 13 | severity: 'failAssert ' 14 | dump: 'Warnning: url not registered' 15 | ... 16 | 17 | not ok 3 TEST-SOAP-ABSIS - checkODB - UPLOAD - OK 18 | --- 19 | message: '200 - OK- FailureMessage:Content is not allowed in prolog. 20 | 21 | See log file for further details.- FailureMessage:Test failed: text expected to 22 | contain /testCaseticket/' 23 | severity: 'failAssert ' 24 | dump: Cannot bind to address "http://extcaast02.las2o.es:9014/ASECheckList/SOAPABSIS" No component registered on that endpoint 25 | ... 26 | 27 | not ok 4 002 - TEST - Api Taux - OK - Cataln 28 | --- 29 | message: '200 - OK- FailureMessage:Test failed: text expected to contain /"00047":"ACCIO 30 | ERRONIA"/' 31 | severity: 'failAssert ' 32 | dump: 'Warnning: url not registered' 33 | ... 34 | 35 | not ok 5 003 - TEST - Api Taux - KO - TauxNoExiste 36 | --- 37 | message: '200 - OK- FailureMessage:Test failed: code expected to equal- FailureMessage:Test 38 | failed: ' 39 | severity: 'failAssert ' 40 | dump: 'Warnning: url not registered' 41 | ... 42 | 43 | not ok 6 004 - TEST - Api Taux - KO - MetodoHttpIncorrecto 44 | --- 45 | message: '200 - OK- FailureMessage:Test failed: code expected to equal - FailureMessage:Test 46 | failed: text expected to contain /An error ocurred during api flow execution/' 47 | severity: 'failAssert ' 48 | dump: 'Warnning: url not registered' 49 | ... 50 | 51 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/junit/RunJUnitSuiteWithListener/org.tap4j.ext.junit.RunJUnitSuiteWithListener$FailingTest-SUITE.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 - org.tap4j.ext.junit.TestTap13JUnit1#testFalse 3 | ok 2 - org.tap4j.ext.junit.TestTap13JUnit2#testTrue 4 | not ok 3 - org.tap4j.ext.junit.RunJUnitSuiteWithListener$FailingTest#testFail1 5 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/junit/RunJUnitTestWithListener/org.tap4j.ext.junit.RunJUnitTestWithListener$FailingTest.tap: -------------------------------------------------------------------------------- 1 | 1..1 2 | not ok 1 - org.tap4j.ext.junit.RunJUnitTestWithListener$FailingTest#org.tap4j.ext.junit.RunJUnitTestWithListener$FailingTest # SKIP JUnit test was skipped 3 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/junit/RunJUnitTestWithListener/org.tap4j.ext.junit.TestTap13JUnit1.tap: -------------------------------------------------------------------------------- 1 | 1..1 2 | ok 1 - org.tap4j.ext.junit.TestTap13JUnit1#testFalse 3 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/junit/suiteTapReporterTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/ext/testng/suiteTapReporterTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issue3406964/ihaveskips.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | ok 1 - Time series complete # SKIP skip me please 3 | not ok 2 - Wrong version in path # skip me too 4 | ok 3 #skip well, then... -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issue3406964/ihavetodoes.tap: -------------------------------------------------------------------------------- 1 | 1..2 2 | ok 1 # TODO enhance throughput 3 | not ok 2 #todo configure tail -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub12/issue-12-tap-stream.tap: -------------------------------------------------------------------------------- 1 | 1..3 2 | 1..1 3 | ok 1 - subtest 1 4 | ok 1 - test 1 5 | 1..4 6 | ok 1 - subtest 1 7 | ok 2 - subtest 2 8 | ok 3 - subtest 3 9 | ok 4 - subtest 4 10 | ok 2 - test 2 11 | 1..15 12 | Bail out! 13 | not ok 1 - test 3 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub14/issue-14-tap-stream.tap: -------------------------------------------------------------------------------- 1 | 1..7 2 | ok 1 - S::test_1 3 | ok 2 - S::test_2 4 | not 3 44 - Failure: test_3 5 | --- 6 | message: 'Failed asserting that Y matches expected X.' 7 | severity: fail 8 | data: 9 | got: Y 10 | expected: X 11 | ... 12 | ok 4 - S::test_4 13 | ok 5 - S::test_5 14 | ok 6 - S::test_6 15 | ok 7 - S::test_7 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub15/issue-15-tap-stream.tap: -------------------------------------------------------------------------------- 1 | ok 1 - subtest 1a 2 | ok 2 - subtest 1b 3 | 1..2 4 | ok 1 - Subtest 1 5 | ok 1 - subtest 2a 6 | ok 2 - subtest 2b 7 | 1..2 8 | ok 2 - Subtest 2 9 | 1..2 10 | ok -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub16/issue-16-tap-stream.tap: -------------------------------------------------------------------------------- 1 | ok 2 | not ok 3 | not ok - something is wrong in number 2 4 | 1..3 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub17/issue-17-tap-stream.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..2 3 | --- 4 | datetime: 20100101T000002 5 | ... 6 | 1..5 7 | ok 8 | ok 9 | ok 10 | ok 11 | ok 12 | ok 1 - someDummyTest 13 | --- 14 | datetime: 20100101T000005 15 | ... 16 | 1..1 17 | ok 18 | ok 2 - anotherDummyTest 19 | --- 20 | datetime: 20100101T000000 21 | ... -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub20/issue-20-tap-stream.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..1 3 | ok 1 - sometest 4 | --- 5 | datetime: 2013-11-14T15:42:54 6 | raw_output: | 7 | Running sometest 8 | .......... 9 | .......... 10 | ... 11 | Done sometest 12 | __________ 13 | ... -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub22/issue-22-tap-stream.tap: -------------------------------------------------------------------------------- 1 | ok 1 2 | ok 2 3 | not ok 3 4 | ok 4 -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueGitHub33/issue-33_tap_stream.tap: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | 1..1 3 | ok 1 - sometest 4 | --- 5 | datetime: 2013-11-14T15:42:54 6 | raw_output: | 7 | Running sometest 8 | ..... 9 | ================================================================================ 10 | Verification failed. 11 | 12 | --------------------- 13 | Framework Diagnostic: 14 | --------------------- 15 | ContainsSubstring failed. 16 | --> The string must contain the substring. 17 | 18 | Actual String: 19 | TAP version 13 20 | 1..2 21 | --- 22 | datetime: 2013-09-12T08:35:14 23 | ... 24 | ok 1 - testcases.SingleSilentTest 25 | --- 26 | datetime: 2013-09-12T08:35:15 27 | raw_output: 28 | ... 29 | not ok 2 - testcases.SimpleTestWithSharedFixture 30 | --- 31 | datetime: 2013-09-12T08:35:16 32 | raw_output: 33 | ... 34 | 35 | Expected Substring: 36 | 37 | ok 2 - testcases.SimpleTestWithSharedFixture 38 | --- 39 | datetime: 2013-09-12T08:35:16 40 | ... 41 | 42 | ================================================================================ 43 | Done sometest 44 | __________ 45 | ... -------------------------------------------------------------------------------- /src/test/resources/org/tap4j/parser/issueYaml/phantomjs.tap: -------------------------------------------------------------------------------- 1 | skip 1 PhantomJS 2.1 - Acceptance | company settings: it shows current settings 2 | --- 3 | Log: | 4 | { type: 'warn', 5 | text: '\'DEPRECATION: Ember.K is deprecated in favor of defining a function inline. [deprecation id: ember-metal.ember-k] See http://emberjs.com/deprecations/v2.x#toc_code-ember-k-code for more details.\\n http://localhost:7357/assets/vendor.js:17193:15\\n raiseOnDeprecation@http://localhost:7357/assets/vendor.js:17112:17\\n http://localhost:7357/assets/vendor.js:17193:15\\n invoke@http://localhost:7357/assets/vendor.js:17209:21\\n deprecate@http://localhost:7357/assets/vendor.js:17177:37\\n deprecate@http://localhost:7357/assets/vendor.js:29019:42\\n get@http://localhost:7357/assets/vendor.js:54526:28\\n http://localhost:7357/assets/vendor.js:172502:30\\n exports@http://localhost:7357/assets/vendor.js:140:37\\n _reify@http://localhost:7357/assets/vendor.js:173:66\\n reify@http://localhost:7357/assets/vendor.js:159:33\\n exports@http://localhost:7357/assets/vendor.js:138:15\\n _reify@http://localhost:7357/assets/vendor.js:173:66\\n reify@http://localhost:7357/assets/vendor.js:159:33\\n exports@http://localhost:7357/assets/vendor.js:138:15\\n requireModule@http://localhost:7357/assets/vendor.js:32:25\\n resolveInitializer@http://localhost:7357/assets/vendor.js:143623:25\\n registerInitializers@http://localhost:7357/assets/vendor.js:143636:41\\n http://localhost:7357/assets/vendor.js:143662:25\\n http://localhost:7357/assets/metis.js:284:41\\n exports@http://localhost:7357/assets/vendor.js:140:37\\n _reify@http://localhost:7357/assets/vendor.js:173:66\\n reify@http://localhost:7357/assets/vendor.js:159:33\\n exports@http://localhost:7357/assets/vendor.js:138:15\\n _reify@http://localhost:7357/assets/vendor.js:173:66\\n reify@http://localhost:7357/assets/vendor.js:159:33\\n exports@http://localhost:7357/assets/vendor.js:138:15\\n requireModule@http://localhost:7357/assets/vendor.js:32:25\\n http://localhost:7357/assets/test-support.js:5319:18\\n require@http://localhost:7357/assets/test-support.js:5309:32\\n loadModules@http://localhost:7357/assets/test-support.js:5301:23\\n load@http://localhost:7357/assets/test-support.js:5252:37\\n http://localhost:7357/assets/test-support.js:5173:22\'\n' } 6 | ... 7 | skip 2 PhantomJS 2.1 - Acceptance | company settings: it allows to change settings 8 | ok 3 PhantomJS 2.1 - JSCS - acceptance/company-settings-test.js: should pass jscs 9 | 10 | ok 4 PhantomJS 2.1 - JSCS - validators/unique-vat.js: should pass jscs 11 | ok 5 PhantomJS 2.1 - ESLint - validators/unique-vat.js: should pass ESLint 12 | 1..5 --------------------------------------------------------------------------------