Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Conversation

astridx
Copy link
Contributor

@astridx astridx commented Sep 22, 2016

Summary of Changes

When I ran ./tests/codeception/vendor/bin/codecept run ./tests/codeception/acceptance/users.feature twice, I got a failure.
The reason for this failure is, that in the first run an user is created and this user is not deleted. It is renamed, but the email address remains the same. So I had the idea to delete this user in the end of the scenario.
I add Scenario:
Delete user
Given I have a user with user name "User Three"
When I Delete the user "User Three"
Then I should see "No Matching Results" for deleted user "User Three"

to the end of my local file users_frontend.feature.

All respective methods are already in the step object.

Copy link
Member

@nibra nibra left a comment

Choose a reason for hiding this comment

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

Thank you, Astrid! Just those little corrections, and this can be merged.

Scenario:
Delete user Given I have a user with user name "User Three"
When I Delete the user "User Three"
Then I should see "No Matching Results" for deleted user "User Three"
Copy link
Member

@nibra nibra Sep 22, 2016

Choose a reason for hiding this comment

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

Small typo: Should be

Scenario: Delete user
    Given I have a user with user name "User Three" 
    When I Delete the user "User Three" 
    Then I should see "No Matching Results" for deleted user "User Three" 

Please remember the newline at the end of the file!

@astridx
Copy link
Contributor Author

astridx commented Sep 23, 2016

Is the code style now OK?

Copy link
Member

@nibra nibra left a comment

Choose a reason for hiding this comment

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

Ready to merge for me.

@astridx
Copy link
Contributor Author

astridx commented Sep 25, 2016

I hope I'm not annoying with my ideas. If you are all sure that the tests should be repeatable, I would change the following, too:
Within the class ../tests/codeception/acceptance/administrator/UserCest.php
I would not only use Faker for the username like is is:

public function __construct()
    {
        $this->faker    = Faker\Factory::create();
        $this->name     = 'User' . $this->faker->randomNumber();
        $this->username = 'uname' . $this->faker->randomNumber();
        $this->email    = '[email protected]';
        $this->password = 'test';
    }

I would use it for the email, too:

public function __construct()
    {
        $this->faker    = Faker\Factory::create();
        $this->name     = 'User' . $this->faker->randomNumber();
        $this->username = 'uname' . $this->faker->randomNumber();
        $this->email    = 'test' . $this->faker->randomNumber() . @joomla.org';
        $this->password = 'test';
    }

If you like it, I will add it to this PR.

@yvesh
Copy link
Contributor

yvesh commented Sep 25, 2016

@astridx To be honest the test data should probably be static, in order to be really repeatable (and always have the same data) and not generated by faker.

The downside is that running tests on the same install (or single tests) would be impossible that way. This is the reason we currently randomized it. Having the mail also randomized for the later reasons is a good idea. Thank you!

@astridx
Copy link
Contributor Author

astridx commented Sep 26, 2016

In this case we should not use Faker. We should use a static user name and delete this user in the end of the test. Are I am right?

@puneet0191
Copy link
Member

@astridx Please use Faker even for generating email's. I don't see any problem in that, also creating a user with Faker and then deleting the user in the end of the Tests should be the right way.

@astridx
Copy link
Contributor Author

astridx commented Sep 27, 2016

@puneet Kala Thank you for your reply. If we delete the user in the end, we do not need Faker. Because then the tests are without Faker repeatable.
Should I add deleting of the user in the end of the file ../tests/codeception/acceptance/administrator/UserCest.php and make the user name static?

@astridx
Copy link
Contributor Author

astridx commented Sep 27, 2016

@puneet Thank you very much. After downgrade firefox everything worked well again.

I made a new PR for the UserCest.php: #83

@yvesh yvesh closed this in 2570285 Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants