Code Monkey home page Code Monkey logo

structured-acceptance-test's People

Contributors

fulldecent avatar ilyalyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ilyalyo

structured-acceptance-test's Issues

nil error

I merged a PR supposedly adding structured-acceptance-test support to my project, but now I get a nil error:

$ cucumber
Feature: Run example tests

  Scenario: Running example tests            # features/run_example_tests.feature:2
/Users/andrew/.gem/ruby/2.3.7/gems/structured-acceptance-test-0.0.6/lib/finding.rb:57:in `block in categories=': undefined method `include?' for nil:NilClass (NoMethodError)
	from /Users/andrew/.gem/ruby/2.3.7/gems/structured-acceptance-test-0.0.6/lib/finding.rb:55:in `each'
	from /Users/andrew/.gem/ruby/2.3.7/gems/structured-acceptance-test-0.0.6/lib/finding.rb:55:in `categories='
	from /Users/andrew/go/src/github.com/mcandre/cowl/lib/cowl.rb:88:in `to_finding'
	from /Users/andrew/go/src/github.com/mcandre/cowl/lib/cowl.rb:152:in `block in check'
	from /Users/andrew/go/src/github.com/mcandre/cowl/lib/cowl.rb:151:in `each'
	from /Users/andrew/go/src/github.com/mcandre/cowl/lib/cowl.rb:151:in `check'
	from /Users/andrew/go/src/github.com/mcandre/cowl/bin/cowl:72:in `block in main'
	from /Users/andrew/go/src/github.com/mcandre/cowl/bin/cowl:58:in `each'
	from /Users/andrew/go/src/github.com/mcandre/cowl/bin/cowl:58:in `main'
	from /Users/andrew/go/src/github.com/mcandre/cowl/bin/cowl:100:in `<top (required)>'
	from /Users/andrew/.gem/ruby/2.3.7/bin/cowl:23:in `load'
	from /Users/andrew/.gem/ruby/2.3.7/bin/cowl:23:in `<main>'
    Given the program has finished           # features/step_definitions/steps.rb:1
    Then the output is correct for each test # features/step_definitions/steps.rb:12
      
      expected: true
           got: false
      
      (compared using ==)
       (RSpec::Expectations::ExpectationNotMetError)
      features/run_example_tests.feature:4:in `Then the output is correct for each test'

Failing Scenarios:
cucumber features/run_example_tests.feature:2 # Scenario: Running example tests

1 scenario (1 failed)
2 steps (1 failed, 1 passed)

Update example-consumer to use our gem

This is the test case:

bash example-process/example-process.bash | ruby stat-reader/stat-reader.rb 

We want to get the expected output:

WARNING: Go to your room
WARNING: Go to your room
FAILURE: Go to your room
SUMMARY: 2 warnings, 1 failure

Importantly, the findings should be presented in realtime as they are output by the process.

  • Move stat-reader to example-consumer
  • Use our ruby gem
    • If necessary, propose changes to our Gem to support this incremental reading. We may have to use a different JSON library.
  • Hard code the output formatting to match the above (issue #26 will introduce a built-in pretty formatting we will use later)
  • Make it work as expected, including incremental rendering
  • Add a README.md

Convert JUnit format

Accept format like this:

<?xml version='1.0' encoding='UTF-8'?>
<testsuites tests='4' failures='0'>
  <testsuite name='Impostor_Tests.ImpostorGameModel_Tests' tests='3' failures='0'>
    <testcase classname='Impostor_Tests.ImpostorGameModel_Tests' name='testElimanateAPlayer' time='0.067'/>
    <testcase classname='Impostor_Tests.ImpostorGameModel_Tests' name='testGameStatusChangedWhenDoneShowingSecretWords' time='0.001'/>
    <testcase classname='Impostor_Tests.ImpostorGameModel_Tests' name='testStartGameWithSamePlayers' time='0.003'/>
  </testsuite>
  <testsuite name='ImpostorUITests.ImpostorUITests' tests='1' failures='0'>
    <testcase classname='ImpostorUITests.ImpostorUITests' name='testScreenshots' time='31.804'/>
  </testsuite>
</testsuites>

And convert to STAT format.

With a script in the tools directory

Update Ruby implementation to support pretty output

Currently our Ruby implementation only supports JSON output. This is great for consumers, but linters prefer a more friendly looking output by default.

Let's make a great looking output option and add it into the Ruby implementation. It should look so good that linters will want to use our STAT implementation just to get this beautiful output.

screen shot 2017-01-13 at 2 38 42 pm

Work plan

  • Document all possible output situations and required output formatting
    • Processes
      • A process with only a name
        ⭐️ web-puc
      • A process with a name and a version
        ⭐️ web-puc, version 0.0.2
      • (Other information is not used.)
    • Findings
      • With failure set to true
        🛑 Rule, description (entire line is red)
      • With failure set to false
        ⚠️ Rule, description (entire line is yellow)
      • With rule, description and location (location only has file name)
        ⚠️ Rule, description (entire line is yellow)
        in index2.php
      • With rule, description and location (location is one line)
        ⚠️ Rule, description (entire line is yellow)
        in index2.php, line 24
      • With rule, description and location (location is multiple lines)
        ⚠️ Rule, description (entire line is yellow)
        in index2.php, lines 24-26
      • With rule, description and location (location is columns on one line)
        ⚠️ Rule, description (entire line is yellow)
        in index2.php, line 24:15-18
      • With rule, description and location (location is columns on multiple lines)
        ⚠️ Rule, description (entire line is yellow)
        in index2.php, line 24:15 to line 25:5
      • With recommendation
        ⚠️ Rule, description (entire line is yellow)
        RECOMMENDATION: Reword to avoid the passive voice.
      • (Other finding information is not used.)
    • Summaries
      • No errors, no warnings
        ✅ PASSED with no warnings (whole line is green)
      • No errors, with warnings
        ⚠️ PASSED with 5 warnings (whole line is yellow)
      • With errors, no warnings
        🛑 FAILED with 5 errors (whole line is red)
      • With errors, with warnings
        🛑 FAILED with 5 errors and 1 warning (whole line is red)
  • Update our Ruby implement to add this outputting option
  • Update example consumer from #25 to use this new outputting format

Follow-on work

Create increment STAT reader

THIS ISSUE IS INCOMPLETE

A STAT data structure is created in #15. Extend this to add methods for incrementally reading a STAT data stream.

When you are reading, call backs will pass back data for the main STAT object and each finding.

The whole point is for this to be asynchronous.

Please design the API and recommend how it should look in an idiosyncratic ruby implementation.

Create XML schema

Our primary supported format is JSON. Only if there is a standard, well documented translation from XML to JSON should we consider this.

If so, then let's also create a XML schema so that valid XML documents can be translated into JSON documents that are valid per JSON schema in #1.

Create clang input translating tool

The Atom editor has a [https://github.com/AtomLinter/linter-clang](built in tool for validating c code with clang) as you type. It takes the error output and displays it inline in the editor. Atom is consuming the compiler output.

Preview

We want to create a consumer that inhales the same information into a STAT data structure. Then this program will simply print out the STAT in json format.

  • Identify which program Atom uses by default to lint c code
  • Make a simple c program with a few errors and generate the same linting output
  • Write a new tool stat-from-clang it will read clang input and produce stat output
  • Validate the output
  • Add a README.md

Create Ruby data structure

This work will go in a new implementations/ruby folder. Eventually this may moved to a new repository.

  • Create STAT data structures that Ruby programs can use
  • The data structures should support all required and optional parameters designated in the specification
  • It should be extensible

Also, please read the specification regarding incremental output. Please add three methods that allow incremental output:

  • PRINT HEADER -- prints from the beginning of the output ({) up to the first finding ("findings":[), ends with a new line, and flushes output
  • PRINT FINDING -- prints one finding, ends with a new line and flushes output
  • PRINT FOOTER -- prints the matching ] and } and flushes output

Then when this is done:

  • Make a Gemfile so that people can use this data structure in their projects
  • Publish this Gemfile in Rubygems so everyone can use it

Incremental reading will be added to this data structure in a separate issue.

Create Atom linter for example-process

Depends on #24

Create an Atom linter that uses the example-process program from Atom.

Preview

Documentation: https://github.com/steelbrain/linter/tree/v1/docs

Discussion: steelbrain/linter#1298

Then people with STAT-compliant programs will have a VERY simple way to make their program compatible with Atom. They will only need to copy our example linter and change the name of the program that is run.

Work plan

  • Make copy of https://github.com/sirbrillig/linter-mixed-indent and get it working in Atom
  • Find a javascript library that can read JSON streams
  • Call our example-process from the linter
    • You can probably find a better example than linter-mixed-indent which already handles calling an external program
  • Update README.md so it is clear how others can copy and easily extend our work to use their own STAT compliant tool

Verify that this tool works correctly by using Atom and creating an animated gif (I use licecap). It should show one finding after 1 second, a second finding after a further 2 seconds and the final finding is shown after a further 3 seconds. It should NOT wait 6 seconds and show all three findings.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.