Questions tagged [Modular testing] (237)

3
answers

How to handle exceptions in xUnit.net?

Please tell me how in the framework of unit testing xUnit.net to handle that exception? In my case, if one of the properties is less than zero, then an exception will be thrown. For this module I wrote a test: If the number is positive, then all is well, the tests are successfully performed if at least one of the members i...
rachel_McDermott asked April 4th 20 at 13:59
1
answer

How to test your application with database?

There is Appendix c single-file components and retrieve the data from the database. To test the operation with the database, we need a separate test version with fake data or jest to specify the structure of data received?
Parker94 asked April 4th 20 at 13:58
0
answer

Unlike TestInitialize and ClassInitialize in MSTestv2?

Look itvdn - unit testing, MSTest which built and can't understand ClassInitialize. TestInitialize - I understand that marked method before each unit test is triggered ( that is, if I have in the code block marked with TestInitialize is the creation of the object logical => every time the object will be recreated). But h...
Donny63 asked April 4th 20 at 13:41
1
answer

How to test functions, manipulating DOM elements?

Learn unit testing. Use mocha. How to test functions, manipulating DOM elements? What spec. frameworks for this?
Gerald.Maggio asked April 4th 20 at 12:31
1
answer

Learning Unit testing?

You must be familiar with code coverage unit tests, if I understand correctly, the topic is quite extensive: there are separate books, complete video courses, etc. Please share your experience how to study the subject and resources ( because I thought a little information, I could be wrong. I wanted to look ITVDN unit test...
elmer1 asked April 4th 20 at 12:29
1
answer

SyntaxError: Cannot use the import statement outside of a module?

tell me how to solve the problem with the tests my main js (activeBtnClick.js):activeButtonClick export default function(button) { if (button.classList.contains('active')) { button.classList.remove('active'); } else { button.classList.add('active'); } } activeBtnClick.test.js test:activeButtonClick import from './activeBt...
Callie.Corkery asked April 4th 20 at 00:33
1
answer

How to use jest to test DOM element?

there is a function which adds an item or removes it from the class:activeButtonClick export default function(button) { if (button.classList.contains('active')) { button.classList.remove('active'); } else { button.classList.add('active'); } } module.exports = activeButtonClick; How to write a test that would check that in...
Murphy asked April 4th 20 at 00:32
1
answer

The testing program on the Go?

Good day! I wrote a web service in Go, and write tests for it. I wrote a test to test the handler', but get the errorpackage main import ( "net/http" "net/http/httptest" "testing" ) TestHealthCheckHandler func(t *testing.T) { req, err := http.NewRequest("POST", "/ad/getall", nil) if err != nil { t.Fatal(err) } rr :=...
Toni94 asked April 3rd 20 at 23:45
0
answer

How to test an asynchronous function that uses the forkJoin?

There are some such function:public method1(): Observable<any> { return forkJoin({ var1: // some var var2: // some var var3: // some var var4: // some var var5: // some var var6: // some var }).pipe( switchMap(data => { const res = { var1: data.var1, var2: data.var2, var3: data.var3, var4: data.var4, ...
rickey.Wehner asked April 3rd 20 at 23:33
1
answer

PHPunit test not see factory in Laravel, what is the problem?

This test sees the factory for projectsnamespace Tests\Feature; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; use Tests\TestCase; class ProjectsTest extends TestCase { use RefreshDatabase, WithFaker; /** @test */ public function test_a_user_can_create_a_project() { $th...
Daphnee asked April 3rd 20 at 18:24