acquia / drupal-spec-tool

A tool for specifying Drupal architecture details and generating automated tests for them.
GNU General Public License v2.0
148 stars 36 forks source link

beginner help #68

Open monaw opened 1 year ago

monaw commented 1 year ago

Hi, i am pretty lost and feeling stupid trying to figure out how to use this spec tool. Currently I'm trying to figure out:

  1. how to "run" the spreadsheet so the Overview, Diagrams and Behat sheets are update (Updated: those sheets should run automatically when info they depend on are changed; if it does not looks right, then there is a problem with the formula for that cell)
  2. how to generate the tests and then run them
  3. where i should copy the default features file into my own Drupal project (sorry i don't quite understand the BLT example used in step 3 of the readme)
  4. what's the relationship of the generated test files to the features files
  5. how to use Behat in this setup (i've never used that tool before)

I'd appreciate all help anyone can offer. Just trying to see if I can understand this enough to determine whether this tool will be helpful for our project or not...

Here's what i've done:

  1. read the readme along with other documentation pointed to by the readme, including the Behat beginner's guide
  2. made a copy of the google sheet
  3. added our "publication" content type to the Overview sheet Screen Shot 2022-12-22 at 3 09 06 PM
  4. added 24 fields for the publication to the Fields sheet Screen Shot 2022-12-22 at 3 09 59 PM
  5. installed the spec tool and behat via composer into my docker container running my development instance of Drupal on my laptop Screen Shot 2022-12-22 at 3 10 57 PM
  6. i have the following in vendor/acq2uia/drupal-spec-tool/behat.yml:
    
    ---
    default:
    suites:
    default:
      autoload:
        '': "%paths.base%/features/bootstrap"
      paths:
        - "%paths.base%/features"
      contexts:
        - Acquia\DrupalSpecTool\Context\AccessControlContext
        - Acquia\DrupalSpecTool\Context\ContentModelContext
        - Acquia\DrupalSpecTool\Context\MediaContext
        - Acquia\DrupalSpecTool\Context\MenuContext
        - Acquia\DrupalSpecTool\Context\ViewsContext
        - Acquia\DrupalSpecTool\Context\WorkflowContext
    extensions:
    Behat\MinkExtension:
      goutte: ~
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: drupal
      drupal:
        drupal_root: docroot
      subcontexts:
        paths: [ ]
monaw commented 1 year ago

I took the original google sheet, made a copy and simply added a new entry/row (row #2 - Publication) to the the Bundles tab but it seems the Overview tab isn't updating (still says only 14)...what am I missing?

Screen Shot 2023-01-03 at 1 38 25 PM

Screen Shot 2023-01-03 at 1 39 40 PM

All help is appreciated...

UPDATE (I'm keeping my original comment post above in case this will help somewhere else down the line):

I figured out what the problem was...i added new role at the top of original data (row # 2) which caused the formula to change and ignore the new top row! So instead I have to add new row(s) to the bottom of the sample data or somewhere in the middle...sigh...

Note: my questions/problems listed in the original description/comment still stand...

TravisCarden commented 1 year ago

Hello, welcome @monaw! 🙂 I'm catching up a little after the holiday, and I plan to respond to your issues as soon as possible. While I'm getting to it, I just wanted you to know that you aren't being ignored. And please don't let this make you feel stupid. Usually when newcomers to a project are confused it's because they have a situation or questions the maintainers didn't predict and therefore didn't prepare for or document. As I look at your questions I'm sure we'll find ways that our documentation should be improved for others! More soon...

monaw commented 1 year ago

thanks @TravisCarden for giving me hope! yes, if i can help to improve the documentation for others, let me know (:

TravisCarden commented 1 year ago

Okay, @monaw, a few questions for you. 🙂

  1. Are you trying to set up Behat testing and diagrams because you want/need them? Or just because the documentation mentions the features? (The spreadsheet can be used by itself for requirements elicitation and documentation. It would save you a lot of effort and complexity to omit automation, since you're not already using Behat, as you said.
  2. Are you creating a new site or trying to add the Drupal Spec Tool to an existing site?
  3. What version of Drupal core are you using?

Assuming you do want to automate testing...

  1. Are you already using BLT?
  2. If not, do you want/need to use BLT?
  3. Do you want to run tests in a continuous integration context or just locally?
monaw commented 1 year ago

Answers:

  1. I think behat testing might be helpful for us so I'd like to get it working to see how helpful it can be. I'm currently reading the behat documentation on how to write the testing code...

  2. Sort of both...we have a new project based on Drupal and would like to evaluate your Spec Tool. I have a simple testing site setup for my development currently and am adding your Spec Tool to it; hope that's clear.

  3. Drupal 9.4.8

  4. no, not using BLT

  5. i'm not sure about BLT...haven't played with it yet

  6. both, i'd like to do the testing on my dev box and also we are setting up automated CI/CD for our Drupal project

monaw commented 1 year ago

hi @TravisCarden , couple of more questions:

  1. what's the Github repo's PHP files in src/Context/ meant to be used for? to help write Behat test code or something else?
  2. is there a tool to take your google sheet and actually generate the Drupal scaffolding with it for a site?
monaw commented 1 year ago

@TravisCarden , i just found DEG, is this the recommended tool to use in conjunction with your tool's spread sheet to actual generate the Drupal content?

TravisCarden commented 1 year ago

Hi, @monaw.

  1. The src/Context directory contains the classes that make the feature files work in Behat. Other than adding them to your Behat configuration (see the README), you don't need to do anything with them.
  2. Yes, the Drupal Entity Generator (DEG) would be the available tool for generating the Drupal configuration from the sheet. Note however that it's created and maintained by another team (Acquia Professional Services), and I haven't used it such that I can comment on it. (The Drupal Spec Tool isn't a funded project, so I just support it in my "spare" time. I don't use it on a daily basis like I used to.)

How's it going getting set up?

monaw commented 1 year ago

thanks Travis for your answers! we are currently using the google sheets...haven't gotten to the behat testing part yet...

monaw commented 1 year ago

hi Travis, looks like the DEG tool is using version 4.0.1 of the DST Google Sheet. Do you know if DEG still work with current 5.0 of the DST sheet? What are the important/big differences between DST sheet v4 vs v5? what's your recommendation...try DEG with DST sheet v5 or use DEG with DST sheet v4?

TravisCarden commented 1 year ago

I would expect DEG to continue to work with the 5.0 sheet, @monaw, since there are no schema changes--only default content. That's the only significant difference from v4 to v5. See https://github.com/acquia/drupal-spec-tool/releases/tag/v5.0.0.