Skip to content

Conversation

@jzethar
Copy link
Collaborator

@jzethar jzethar commented Jul 31, 2024

This PR contains module for auto generating tests for others modules. This tool should help us to create modules faster and without any need to copy-past all the time.
The idea of the module is that we work the same as with simple block parsing, but have opportunity to generate some tests for block or transaction in the block. It does not break the test flow that was previously implemented by @Har01d only complement it.
Also the example was provided for this module. To generate it next params were used: php 3xpl.php 0 AG 40521139 A C 40521136 0x8544cc5773f307fe5319c2bbe1735771387d1287ed11b392d39187747b3ad569 S
where:

  • AG -- auto generating tool
  • num -- block id
  • A -- all events from the block
  • C -- continue test generation
  • transaction -- generate tests for only this transaction from block
  • S -- stop and write test file.
    All Tests will be kept in new folder Tests
    To call them in your module, you can use:
if (file_exists(__DIR__ . '/Tests/{module}Test.php'))
{
    require_once __DIR__ . '/Tests/{module}Test.php';
    $this->tests = {module}Test::$tests;
}

Copy link
Collaborator

@alexqrid alexqrid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tried this new flow in #101 . It's pretty easier to add tests, than before. As this is not breaking the previous tests I believe we should merge this PR @Har01d

@Har01d
Copy link
Collaborator

Har01d commented Aug 3, 2024

Including

if (file_exists(__DIR__ . '/Tests/{module}Test.php'))
{
    require_once __DIR__ . '/Tests/{module}Test.php';
    $this->tests = {module}Test::$tests;
}

in every module doesn't seem to be a good solution. A better approach would be placing something like

$this->tests = true;

and processing tests in CoreModule in case of $this->tests === true.

Also, if we decide to introduce dumping data into a file in PB and others, it should be more consistent. I.e. why we do this for PB, but not for M?

@Har01d Har01d changed the title AutoGenTest module Add a new system for testing modules Sep 24, 2024
@Har01d Har01d self-assigned this Sep 24, 2024
@Har01d Har01d added the API label Sep 24, 2024
@alexqrid
Copy link
Collaborator

Seems that backward compatibilyt is kept, is there any suggestion or let's merge this? @Har01d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants