Giter VIP home page Giter VIP logo

Comments (4)

Naktibalda avatar Naktibalda commented on June 12, 2024

This is how Codeception step works.
It converts action name to words and appends all arguments.
It looks much better when you use a module that was properly designed for Codeception:

I am on page "/about"
I click "button"
I see "some text"

I aggree that Asserts step output is ugly, but there is not much we can do short of rewriting Asserts module and/or Codeception.

assertThat is the only method that takes constraint as parameter, the output could be improved by modifying Step class to call toString -

} elseif (is_object($argument)) {
if ($argument instanceof FormattedOutput) {
$argument = $argument->getOutput();
} elseif (method_exists($argument, '__toString')) {
$argument = (string)$argument;
} elseif ($argument::class == 'Facebook\WebDriver\WebDriverBy') {
$argument = Locator::humanReadableString($argument);
} else {
$argument = $this->getClassName($argument);
}
}

Generating step outputs from method names is one of the main Codeception ideas, I don't thing that it can be replaced with something similar to Constraint.

from codeception.

neuberkauf avatar neuberkauf commented on June 12, 2024

i figured the Assert language is coming from the underlying PHPUnit. No big deal there.

Adjusting to handle Constraint objects would be fantastic. Seems like a simple thing if you'd like me to check out and submit a PR.

from codeception.

jtheuerkauf avatar jtheuerkauf commented on June 12, 2024
$ php codecept run unit tests/unit/Codeception/StepTest.php

Codeception PHP Testing Framework v5.0.12 https://stand-with-ukraine.pp.ua
[Seed] 109444475

Unit Tests (12) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
✔ StepTest: Multi byte text length is measured correctly(0.74s)
✔ StepTest: Single quoted string as argument(0.00s)
✔ StepTest: See uppercase text(0.00s)
✔ StepTest: Get arguments(0.15s)
✔ StepTest: Array as argument(0.00s)
✔ StepTest: No args(0.00s)
✔ StepTest: Constraint output(0.24s) * new *
✔ StepTest: Formatted output(0.02s)
✔ StepTest: See multi line string in single line(0.00s)
✔ StepTest: Am on url(0.00s)
✔ StepTest: Get html(0.00s)
✔ StepTest: Long arguments(0.02s)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 00:05.290, Memory: 12.00 MB

OK (12 tests, 24 assertions)

from codeception.

neuberkauf avatar neuberkauf commented on June 12, 2024

(Sorry for posting under two accounts... This one is my work account - i forgot to switch over.)

from codeception.

Related Issues (20)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.