Add defaultValues test case
Add Assign/get test cases for all the methods
mlaurent |
Ruqola |
Add defaultValues test case
Add Assign/get test cases for all the methods
Use QsignalSpy to test signals
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
+ close other request as you changed it
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
41 | Verify that it doesn't emit signal when you set same serverurl | |
50 | Verify it as we don't emit signal when we assign same username | |
73 | Verify that password/authtoken/userId is cleared after that. > you must verify before that you have a password/authtoken/userId otherwise you can't verify it :)> assign values before to call logout. | |
105 | coding style " = " | |
151 | it's not true as serverUrl is not empty :) |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
73 | Currently, loginstatusChanged() signal is emitted nowhere in rocketchataccountsettings
| |
151 | I think After calling loadsettings() on a RocketChatAccountSetting object, serverUrl is set to (demo.rocket.chat) and before calling it has empty sting....! |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
43 | same as new test. | |
55 | you verify that when it's empty, signal is not emitting (ok) |
write different methods for shouldEmit and shouldNotEmit
to check signals in setUsername and setServerUrl methods
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
61 | There is still the same problem. and after: same for other method. But it's the last changes to do :) | |
92 | Why it's empty ? not finish yet ? | |
184 | still not for serverurl => comment is not correct (and it will not correct as by default we will fallback to demo...) |
Test setServerUrl and setUsername methods by passing empty
strings to them.
They should emit signals
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
92 | that signal( LoginStatusChanged() ) is triggered nowhere in the rocketchataccountsettings.cpp file!! I thought that you will do some modifications in the rocketchataccountsettings.cpp file and then we can add tests for that.. If you say there is no need to test it, I will remove it. | |
184 | Comment removed!! | |
209 | Here it is empty that means before we call loadSetting(), chat.serverUrl() is returning an empty string. That's why I wrote by default it should return empty. Anyways I removed the comment, It should not create confusion in future:) |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
82 | ok with empty but why you don't want to test twice same no empty username and look at that we don't emit twice the signal ? |
Test whether it is emitting or not when we pass same url, name
Actually this is verified in shouldNotEmitSignal method!
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
51 | Here one signal should be emitted, Since we are assigining a new Url("bla bla"). This emission of the signal will append one item to the list(SpyURL) => count is 1. | |
55 | Here one more signal is emitted when we assign a new Url(emptyString). This emission of the signal will append one more item to the same the list(SpyURL) =>total count is = prevCount + 1 that is 2. | |
58 | Here signal is not emitted when we assign same Url as prv.(emptyString). There no emission and item will not be appended to lis(SpyURL) => total count is = prevCount + 0 that is 2. |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
58 | ok I know that you use 2 empty string | |
88 | same here why emptystring and not 'no empty string' ? in some code we can evaluate empty string as special case it's for that that I ask you to use no empty string. > you can use same code with no empty string :) |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
40 | Here in this method(shouldNotEmitSignalWhenNewServerUrlIsSamaAsOld() ), is it checked with non-empty string!!, and that is why I didn't check is that method:) same idea is implemented for userNameChanged also...! |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
40 | ok for here as default servername is not empty by default ok. but I don't see it in: void RocketChatAccountSettingsTest::shouldEmitSignalWhenUserNameChanged() RocketChatAccountSettings *SampleChat = new RocketChatAccountSettings; QSignalSpy SpyName(SampleChat, &RocketChatAccountSettings::userNameChanged); SampleChat->setUserName(QStringLiteral("Donald Knuth")); QCOMPARE(SpyName.count(), 1); QString emptyString; SampleChat->setUserName(emptyString); QCOMPARE(SpyName.count(), 2); SampleChat->setServerUrl(emptyString); QCOMPARE(SpyName.count(), 2); } where do you test "value is not empty here ? string not empty =>emit signal after that you use emptyString > no empty -> empty => signalbut after that you test 'empty -> empty' ok no signal but I ask you 'non empty -> no empty' (with same value) it's still not the case here no ? |
autotests/rocketchataccountsettingstest.cpp | ||
---|---|---|
87 | it's serverUrl here not setUserName |
modify shouldNotEmit method and test it with non-empty strings..!