mauriciotogneri / green-coffee

Green Coffee
MIT License
231 stars 21 forks source link

Test names in report #9

Closed vladimirandroid closed 7 years ago

vladimirandroid commented 7 years ago

Hello! Please help me with displaying real test names in report. I see only "test[0]", "test[1]" but actualy have tests: "Invalid username and password" and "Correct username and password" See screenshot: http://joxi.ru/J2b97L3SXgWYNm

mauriciotogneri commented 7 years ago

Hello,

The name of the tests correspond to the name of the methods with the annotation @Test. In the tutorial I use the following example:

java @Test public void test() { start(new LoginSteps()); }

That's why the tests are named test[0], test[1], etc. Because the method test is executed several times (one for each scenario).

The problem is that the name of the method is declared when you write the tests and, for what I know, it cannot be changed in runtime for another name (for example the name of the scenario).

I will investigate to see if I can find a solution but right now I don't see how I can change that (but let me know if you do so I can fix it and release a new version).

vladimirandroid commented 7 years ago

I think it is possible to use name parameter of @Parameters. Like this: @Parameterized.Parameters(name = "{0}")

Then I get next test names in report: test[com.mauriciotogneri.greencoffee.ScenarioConfig@41ae1ef0] test[com.mauriciotogneri.greencoffee.ScenarioConfig@41ae1f50]

All we need is override toString method of ScenarioConfig to show scenario name. How do you think?

mauriciotogneri commented 7 years ago

Ahhh, ok. I thought that you wanted to change the name (i.e. test) and not the description of each test. I released a new version (2.4.0) with the changes. Let me know if it solves your problem.

vladimirandroid commented 7 years ago

Thank you very much. You solved my problem.

mauriciotogneri commented 7 years ago

I'm glad that it helped you!